feat(mcp): add 'describe' tool and update documentation - #3995
feat(mcp): add 'describe' tool and update documentation#3995Ankitsinghsisodya wants to merge 3 commits into
Conversation
- Introduced the 'describe' tool with support for both path and name parameters. - Updated instructions to clarify the requirements for 'delete' and 'describe' tools. - Added help resources for the 'describe' tool in the MCP server. This enhances the functionality of the MCP by providing a way to describe functions in the cluster.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ankitsinghsisodya The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Adds a new MCP describe tool to expose func describe --output json as structured JSON, updates MCP guidance docs, and introduces unit tests for the new tool so agents don’t need to parse human-formatted CLI output.
Changes:
- Added
describeMCP tool, registered it in the server, and added a matching help resource. - Documented
describeusage (includingpath/namemutual exclusivity) inpkg/mcp/instructions.md. - Added tests covering argument passing, JSON parsing, and validation errors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp/tools_test.go | Adds a shared test helper for decoding StructuredContent into typed structs. |
| pkg/mcp/tools_describe.go | Implements the new describe tool, input validation, CLI invocation, and structured output mapping. |
| pkg/mcp/tools_describe_test.go | Adds unit tests for describe args, mutual exclusivity validation, and malformed output handling. |
| pkg/mcp/mcp.go | Registers the new describe tool and adds a help resource for it. |
| pkg/mcp/instructions.md | Documents describe usage and updates the “read help first” guidance list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Added a new test to verify that the describe handler correctly parses JSON output even when preceded by non-JSON warnings in stderr. - Introduced a new function, parseDescribeOutput, to extract and parse the JSON object from combined stdout+stderr output, ensuring robustness against leading noise. This improves the reliability of the describe tool in real-world scenarios where warnings may be emitted before the JSON payload.
- Added ExecuteSplit method to the executor interface, allowing separate capture of stdout and stderr. - Updated the describe handler to utilize ExecuteSplit, ensuring JSON parsing is unaffected by stderr warnings. - Modified tests to validate the new execution method and its behavior with leading stderr content. This enhancement increases the robustness of the describe tool by preventing stderr noise from interfering with JSON output parsing.
Changes
describeMCP tool that wrapsfunc describe --output jsonand returns structured JSON (name, namespace, URL, routes, image, readiness, deployer, labels, subscriptions, revision) instead of requiring agents to parse text outputdescribehelp resource and document the tool's path/name mutual-exclusivity inpkg/mcp/instructions.md/kind enhancement
Fixes #
Release Note
release-note Added a `describe` MCP tool that returns structured JSON (URL, image, namespace, labels, subscriptions, readiness) for a deployed Function, so AI agents no longer need to parse `func describe`'s text output. Docs
```docs
```