gemini-cli - ✅(Solved) Fix Native Support for MCP Resources (read & list) [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25335Fetched 2026-04-14 05:55:54
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1issue_type_added ×1

PR fix notes

PR #25395: feat(core): add tools to list and read MCP resources

Description (problem / solution / changelog)

Summary

This PR introduces core tools for interacting with MCP resources, allowing the agent to list and read static or dynamic resources exposed by MCP servers.

Details

  • Tool Implementation:
    • list_mcp_resources: Lists all available resources across all connected MCP servers, with optional filtering by server name.
    • read_mcp_resource: Reads the content of a specific MCP resource identified by its URI.
  • Core Enhancements:
    • Updated McpClientManager with methods to aggregate resources from all active clients.
    • Registered new tools in the core tool registry.
    • Enabled these tools in "Plan Mode" to allow the agent to research available resources before execution.
  • Documentation:
    • Created docs/tools/mcp-resources.md with usage instructions and examples.
    • Updated docs/reference/tools.md and docs/sidebar.json to include the new tools.
  • Testing:
    • Added comprehensive unit tests for the new tools and manager methods.
    • Added integration tests verifying end-to-end resource listing and reading with a mock MCP server.

Related Issues

Closes #25335

How to Validate

  1. Run unit tests: npm test -w @google/gemini-cli-core -- src/tools/list-mcp-resources.test.ts src/tools/read-mcp-resource.test.ts
  2. Run integration tests: npm run test:e2e -- integration-tests/mcp-resources.test.ts
  3. Manual validation: Connect an MCP server with resources (e.g., the everything server) and use:
    • "list mcp resources"
    • "read mcp resource demo://resource/static/document/architecture.md" <img width="3320" height="2086" alt="image" src="https://github.com/user-attachments/assets/2f74d33b-748f-4a38-a074-78513fc43cdc" />

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

Changed files

  • docs/cli/plan-mode.md (modified, +3/-1)
  • docs/reference/tools.md (modified, +7/-0)
  • docs/sidebar.json (modified, +8/-1)
  • docs/tools/mcp-resources.md (added, +44/-0)
  • docs/tools/mcp-server.md (modified, +2/-1)
  • integration-tests/mcp-list-resources.responses (added, +2/-0)
  • integration-tests/mcp-read-resource.responses (added, +2/-0)
  • integration-tests/mcp-resources.responses (added, +4/-0)
  • integration-tests/mcp-resources.test.ts (added, +178/-0)
  • packages/core/src/config/config.ts (modified, +8/-0)
  • packages/core/src/policy/policies/read-only.toml (modified, +4/-1)
  • packages/core/src/policy/toml-loader.test.ts (modified, +19/-0)
  • packages/core/src/tools/definitions/base-declarations.ts (modified, +4/-0)
  • packages/core/src/tools/definitions/coreTools.ts (modified, +16/-0)
  • packages/core/src/tools/definitions/model-family-sets/default-legacy.ts (modified, +35/-0)
  • packages/core/src/tools/definitions/model-family-sets/gemini-3.ts (modified, +35/-0)
  • packages/core/src/tools/definitions/types.ts (modified, +2/-0)
  • packages/core/src/tools/list-mcp-resources.test.ts (added, +156/-0)
  • packages/core/src/tools/list-mcp-resources.ts (added, +123/-0)
  • packages/core/src/tools/mcp-client-manager.test.ts (modified, +60/-0)
  • packages/core/src/tools/mcp-client-manager.ts (modified, +30/-2)
  • packages/core/src/tools/read-mcp-resource.test.ts (added, +194/-0)
  • packages/core/src/tools/read-mcp-resource.ts (added, +169/-0)
  • packages/core/src/tools/tool-error.ts (modified, +1/-0)
  • packages/core/src/tools/tool-names.ts (modified, +8/-0)
  • packages/core/src/tools/tool-registry.ts (modified, +12/-0)
RAW_BUFFERClick to expand / collapse

What would you like to be added?

Native support for accessing Model Context Protocol (MCP) resources (e.g., via a read_mcp_resource tool or equivalent capability) and general performance optimizations to reduce latency in interactions involving MCP.

Why is this needed?

Currently, the Gemini CLI lacks native support for interacting with Model Context Protocol (MCP) resources. While it can discover them, the agent does not have tools to list or read them during a conversation. When an agent attempts to access capabilities exposed as resources, it often stalls, enters loops, and falls back to reading help files to understand how to proceed. This leads to significantly high latency (3-9 minutes).

Additional context

Implement native tools in the Gemini CLI to allow the agent to discover and read MCP resources directly, bringing performance parity and feature alignment with industry standards.

  1. Add list_mcp_resources Tool Description: Allows the agent to list all available resources exposed by connected MCP servers. Parameters: None (or optional server name filter). Purpose: Enables the agent to discover what context is available to it dynamically.
  2. Add read_mcp_resource Tool Description: Allows the agent to read the content of a specific MCP resource using its URI. Parameters: uri (string, required). Purpose: Provides low-latency, direct access to the data exposed by the resource, preventing documentation-reading fallbacks.

extent analysis

TL;DR

Implement native tools in the Gemini CLI to access Model Context Protocol (MCP) resources, such as list_mcp_resources and read_mcp_resource, to reduce latency.

Guidance

  • Implement the list_mcp_resources tool to allow the agent to discover available MCP resources, which can help reduce the time spent on discovering context.
  • Develop the read_mcp_resource tool to enable direct access to MCP resource content using its URI, reducing the need for fallbacks and lowering latency.
  • Consider adding optional parameters to list_mcp_resources, such as a server name filter, to enhance flexibility and performance.
  • Evaluate the current Gemini CLI architecture to ensure seamless integration of the new tools and optimal performance.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The proposed solution focuses on adding native support for MCP resource access, which may require modifications to the existing Gemini CLI architecture. The exact implementation details and potential challenges are not specified in the issue.

Recommendation

Apply workaround: Implement the proposed list_mcp_resources and read_mcp_resource tools to reduce latency and improve performance, as this approach directly addresses the stated needs and limitations of the current Gemini CLI.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - ✅(Solved) Fix Native Support for MCP Resources (read & list) [1 pull requests, 1 comments, 2 participants]