Add version tool to MCP server - #3996
Conversation
The MCP server's healthcheck tool only reports its own hardcoded protocol version, not the version of the func binary it drives via the executor. Agents had no way to query that, so they could not gate feature usage on server version support. Add a version tool that shells out to "func version --output json", following the same executor pattern as the other tools (list, create, etc.), and returns the version and git commit hash.
|
[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
This PR adds a new MCP tool (version) to the pkg/mcp server, enabling agents to query the driven func client binary’s version (and git commit hash when present) by executing func version --output json, then returning a structured JSON response.
Changes:
- Added a
versionMCP tool and handler that shells out tofunc version --output jsonand maps the result into a structuredVersionOutput. - Registered the new tool in the MCP server initialization.
- Added unit tests for the happy path, missing commit hash, executor failure, and malformed JSON output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/mcp/tools_version.go | Implements the version tool definition, executes func version --output json, and converts its JSON output into VersionOutput. |
| pkg/mcp/tools_version_test.go | Adds coverage for success and key failure/edge cases (no commit, executor error, malformed JSON). |
| pkg/mcp/mcp.go | Registers the new version tool with the MCP server. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes
versionMCP tool that reports the version (and git commithash, when available) of the
funcclient binary being driven, byshelling out to
func version --output jsonthe same way the other MCPtools do
hash, executor errors, and malformed JSON output
/kind enhancement
Relates to #
Release Note
Added a
versiontool to the MCP server so agents can query the version of the func client binary and gate feature usage on version support.