Skip to content

feat(tools/looker): Looker agent management from MCP#2830

Open
drstrangelooker wants to merge 24 commits intomainfrom
looker-agent
Open

feat(tools/looker): Looker agent management from MCP#2830
drstrangelooker wants to merge 24 commits intomainfrom
looker-agent

Conversation

@drstrangelooker
Copy link
Copy Markdown
Contributor

Description

Looker agent management from MCP

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #2827

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates a new tool into the system that allows for the programmatic management of Looker Agents. This enhancement provides LLMs with direct capabilities to interact with Looker Agent resources, streamlining automation and extending the platform's reach into Looker's agent ecosystem. The changes include the core implementation of the tool, its registration within the command-line interface, and comprehensive user documentation.

Highlights

  • New Looker Agent Management Tool: A new looker-agent tool has been introduced, enabling Large Language Models (LLMs) to manage Looker Agents directly from the Multi-Cloud Platform (MCP).
  • CRUD Operations for Looker Agents: The new tool supports list, get, create, and delete operations for Looker Agents, leveraging the Looker Go SDK.
  • Comprehensive Documentation: Detailed documentation for the looker-agent tool has been added, covering its configuration, parameters, and usage examples for each supported operation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@drstrangelooker
Copy link
Copy Markdown
Contributor Author

@hiracky16 lets continue from here so that all the tests run properly.

@drstrangelooker
Copy link
Copy Markdown
Contributor Author

Do you want this to be in a prebuilt tool set? Also we should have some integration tests in tests/looker/looker_integration_test.go. These run against the looker instance sandbox.looker-devrel.com.

@drstrangelooker drstrangelooker added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new looker-agent tool, enabling LLMs to perform CRUD operations (list, get, create, delete) on Looker agents. The changes include the tool's core implementation, registration, documentation, and unit tests. Feedback from the review suggests adhering to naming conventions for tool names as per the style guide, utilizing NewStringParameterWithAllowedValues for more robust parameter validation, and dynamically referencing the tool's name in debug logs for improved maintainability.

@github-actions
Copy link
Copy Markdown
Contributor

@drstrangelooker
Copy link
Copy Markdown
Contributor Author

@hiracky16 I didn't realise you weren't a googler. You may not be able to commit to this branch. If you fork this branch and the set PRs against it I'll merge them in.

@hiracky16
Copy link
Copy Markdown
Contributor

@drstrangelooker Thank you for the suggestion. I've significantly expanded the description field in the documentation to include detailed instructions for LLMs, explaining each operation and its required parameters. This should make it much easier for agents to use the tool correctly.
Please review #2834

hiracky16 and others added 2 commits March 25, 2026 10:21
## Description

Addresses the feedback from the maintainers regarding the `looker-agent`
tool.
@github-actions
Copy link
Copy Markdown
Contributor

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

…r for agent tool (#2864)

## Description
This PR significantly enhances the `looker-agent` tool by adding missing
parameters required for effective agent management.

In the initial implementation, only `name` and `description` (internal)
were supported. However, crucial fields for Looker AI Agents such as
`instructions` (system prompt), `sources` (data models/explores), and
`code_interpreter` were missing. This update fills those gaps and also
introduces an update operation.

## Changes
- New Parameters: Added `instructions`, `sources` (JSON-encoded array),
and `code_interpreter` (boolean) to both `create` and `update`
operations.
- Update Operation: Implemented the `update` operation to allow
modification of existing agents.
- Robustness:
- Updated error handling to use `http.StatusBadRequest` for client-side
validation errors.
- Added safety checks for parameter access to prevent runtime panics.
- Enhanced Testing: Rewrote and expanded unit tests to cover all new
parameters, operations, and validation logic (including MCP manifest
verification).
- Documentation: Updated the tool's documentation with detailed LLM
instructions and usage examples for all new fields.

## Impact
The `looker-agent` tool is now fully capable of managing the complete
lifecycle and configuration of Looker AI Agents, enabling sophisticated
analytical workflows.

## Verification
- Comprehensive unit tests added and passed: go test -v
./internal/tools/looker/lookeragent/...
- Verified MCP manifest generation and schema correctness.
@hiracky16
Copy link
Copy Markdown
Contributor

hiracky16 commented Mar 29, 2026

@drstrangelooker
Following up on your previous guidance about creating a PR against this branch, I've just opened a new one to address the remaining feedback and enhance the tool: PR #2887 : fix(tools/looker): address CI failures and enhance agent tool functionality.

Please let me know if there's anything else needed to merge #2830! I'm happy to make further adjustments as required.

hiracky16 and others added 2 commits March 30, 2026 15:14
…nality (#2887)

…ort agent instructions/update

## Description

This PR addresses CI failures observed in #2830 and enhances the
`looker-agent` tool with missing functionality and improved robustness.

Based on the CI results in
#2830, I have fixed the
linting issues and the documentation build error. I have also taken this
opportunity to implement essential missing features such as agent
instructions and update operations.

## PR Checklist

> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:

- [ ] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [ ] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
  before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

@drstrangelooker
Copy link
Copy Markdown
Contributor Author

@hiracky16 I had to refactor the docs to go with the changed documentation structure.

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

@duwenxin99 duwenxin99 added the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@github-actions github-actions bot removed the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@drstrangelooker drstrangelooker added the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@github-actions github-actions bot removed the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@drstrangelooker
Copy link
Copy Markdown
Contributor Author

@hiracky16

Got this feedback...

This new tool doesn't align well with our Style Guide https://mcp-toolbox.dev/reference/style-guide/. Not blocking, but take a look

  1. Mixing Read and Write Operations

The most significant violation is the combination of list, get, create, update, and delete operations into a single tool via an operation parameter.

Style Guide Rule: "Never mix read and write logic in a single function. This enables clear consent models where users can auto-approve low-risk reads but must manually approve destructive writes" (source).

Recommendation: Split the tool into separate tools: list_agents, get_agent, create_agent, update_agent, and delete_agent.

  1. Parameter Count and Complexity

The current tool defines 6 parameters (operation, agent_id, name, instructions, sources, code_interpreter) (source).

Style Guide Rule: "Aim for fewer than 5 parameters per tool" (source).

Recommendation: Splitting the tool into specific actions (as suggested in point 1) will naturally reduce the parameter count for each tool to a more manageable number (e.g., delete_agent would only need 1 parameter).

@duwenxin99
Copy link
Copy Markdown
Contributor

🚀 Cloudflare Preview Ready!

🔎 View Preview: https://pr-2830.toolbox-docs-6xc.pages.dev

(Note: Subsequent pushes to this PR will automatically update the preview at this same URL)

The old doc workflow is deprecated. The doc changes can be previewed in the Cloudfare link. It will be auto-updated with the "deploy doc preview" label.

@drstrangelooker
Copy link
Copy Markdown
Contributor Author

@hiracky16 I refactored this into 5 tools and set the annotations. Can you take a look and test everything in your environment?

@drstrangelooker drstrangelooker added the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@github-actions github-actions bot removed the docs: deploy-preview Label to trigger Github Action docs preview. label Apr 1, 2026
@hiracky16
Copy link
Copy Markdown
Contributor

@drstrangelooker
LGTM!
Thank you for the feedback and the refactoring.
The changes look great and make the code much cleaner.

codeInterpreterParameter := parameters.NewBooleanParameterWithDefault("code_interpreter", false, "Optional. Enables Code Interpreter for this Agent.")
params := parameters.Parameters{nameParameter, instructionsParameter, sourcesParameter, codeInterpreterParameter}

annotations := cfg.Annotations
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't allow the Toolbox user to overwrite the readOnly annotation for this tool, because it will never be readOnly. If the Toolbox user mis-configure it to be not read-only, it will mislead the client to allow the LLM to execute this tool without end-user approval. Should we fetch the user annotations first, and append readOnly on top of that?

params := parameters.Parameters{agentIdParameter}

annotations := cfg.Annotations
if annotations == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this tool - we should make sure the readOnly and destructive annotations cannot be overwritten.


annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


go 1.25.7

toolchain go1.26.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Moderately-important priority. Fix may not be included in next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants