-
Notifications
You must be signed in to change notification settings - Fork 193
feat(mcp): use GraphQL operation descriptions for MCP tool descriptions #2294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mcp): use GraphQL operation descriptions for MCP tool descriptions #2294
Conversation
Extract and use operation descriptions from GraphQL files to provide better context for MCP tools. Operations without descriptions fall back to the default format. - Extract descriptions during operation loading - Merge operation and schema descriptions - Add tests for description extraction and usage
WalkthroughExtracts per-operation descriptions from GraphQL operation files, attach them to Operation objects, prefer those descriptions for MCP tool descriptions (falling back to generated/schema text when empty), add unit tests for extraction and description-selection, and update module dependency versions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2025-09-24T12:54:00.765ZApplied to files:
📚 Learning: 2025-09-24T12:54:00.765ZApplied to files:
📚 Learning: 2025-08-20T22:13:25.222ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- studio@0.136.0
- wgc@0.94.3 - @wundergraph/composition@0.47.1 - controlplane@0.168.5 - @wundergraph/cosmo-shared@0.42.11 - studio@0.136.1
…p-graphql-operation-to-allow
Router image scan passed✅ No security vulnerabilities found in image: |
Router-nonroot image scan passed✅ No security vulnerabilities found in image: |
d660784 to
2a0ad8b
Compare
…to-add-comments-on-a-mcp-graphql-operation-to-allow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
router-tests/mcp_test.go (1)
704-757: Consider testing the actual description selection logic.This test simulates the description selection logic inline (lines 742-747) rather than invoking the actual implementation from
server.go. This creates a maintenance risk: if the server's description selection logic changes, this test might still pass even though the actual behavior differs.Consider one of these approaches:
- Extract the description selection logic in
server.gointo a package-level or exported function that can be called from this test.- Use the existing integration test structure (like "List User Operations" on line 119) to verify description usage end-to-end, which already validates that operation descriptions are correctly used in tool listings.
Option 2 may be preferable since lines 119-161 already provide integration-level verification of the feature.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
router-tests/mcp_test.go(5 hunks)router/pkg/mcpserver/server.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- router/pkg/mcpserver/server.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-20T22:13:25.222Z
Learnt from: StarpTech
PR: wundergraph/cosmo#2157
File: router-tests/go.mod:16-16
Timestamp: 2025-08-20T22:13:25.222Z
Learning: github.com/mark3labs/mcp-go v0.38.0 has regressions and should not be used in the wundergraph/cosmo project. v0.36.0 is the stable version that should be used across router-tests and other modules.
Applied to files:
router-tests/mcp_test.go
🧬 Code graph analysis (1)
router-tests/mcp_test.go (1)
router/pkg/schemaloader/loader.go (2)
NewOperationLoader(38-43)Operation(19-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: build-router
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
- GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
- GitHub Check: build_push_image (nonroot)
- GitHub Check: build_push_image
- GitHub Check: image_scan (nonroot)
- GitHub Check: image_scan
- GitHub Check: build_test
- GitHub Check: integration_test (./events)
- GitHub Check: integration_test (./telemetry)
🔇 Additional comments (2)
router-tests/mcp_test.go (2)
7-8: LGTM!The new imports are appropriate for the added test functionality: file operations for creating temporary test files, GraphQL parsing utilities for schema and operation handling, and logging for the operation loader.
Also applies to: 19-22
564-702: Excellent test coverage for operation description extraction.This test suite thoroughly validates description extraction from GraphQL operations, covering multi-line descriptions, single-line descriptions, operations without descriptions, and mutations. The integration with the actual schemaloader provides confidence that the feature works end-to-end.
…d-comments-on-a-mcp-graphql-operation-to-allow # Conflicts: # router-tests/go.mod # router-tests/go.sum # router/go.mod # router/go.sum
Remove buf.build/go/hyperpb, connectrpc.com/vanguard, and github.com/timandy/routine dependencies that are no longer used after removal of router/pkg/connect_rpc package.
Extract and use operation descriptions from GraphQL files to provide better context for MCP tools. Operations without descriptions fall back to the default format.
partially addresses #2213
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores