fix: include resource templates in access_mcp_resource tool filtering and description#12270
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: include resource templates in access_mcp_resource tool filtering and description#12270roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
… and description - Fix hasAnyMcpResources() to also check resourceTemplates, not just static resources. MCP servers that only expose resource templates (URI templates with parameters) were incorrectly excluded. - Make access_mcp_resource tool description dynamic to include available resources and resource templates from connected MCP servers, giving the model the information it needs to construct valid resource URIs. - Pass mcpHub through getNativeTools() and build-tools.ts so the dynamic description is generated at tool assembly time. - Add comprehensive tests for both fixes.
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #12269
Description
This PR attempts to address Issue #12269 where MCP resources show up in the UI but the model fails to use them. Two root causes were identified and fixed:
1.
hasAnyMcpResources()ignores resource templatesThe tool filtering logic in
filter-tools-for-mode.tsonly checked for staticresourceson MCP servers, notresourceTemplates. Many MCP servers expose resource templates (URI templates with parameters likeorbitcity://event/details/{identifier}) rather than static resources. When a server only had resource templates, theaccess_mcp_resourcetool was excluded from the tool list entirely, making it invisible to the model.Fix: Updated
hasAnyMcpResources()to check bothserver.resourcesandserver.resourceTemplates.2. The model has no information about available resources
Unlike MCP server tools (which each get their own native function definition via
getMcpServerTools()), theaccess_mcp_resourcetool had a static, generic description. The model had no way to know which resources or resource templates were available from connected servers, making it unable to construct valid URIs.Fix: Made the
access_mcp_resourcetool description dynamic by:createAccessMcpResourceTool(mcpHub?)factory function that builds the tool definition with available resource informationmcpHubthroughgetNativeTools()options andbuild-tools.tsso the description is generated at tool assembly timeTest Procedure
access_mcp_resource.spec.tscovering dynamic description generation (no hub, empty servers, static resources, resource templates, multiple servers, etc.)filter-tools-for-mode.spec.tscovering thehasAnyMcpResourcesfix (resource templates only, static resources only, no mcpHub, empty server)Pre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud