Skip to content

Add version tool to MCP server - #3996

Open
Ankitsinghsisodya wants to merge 1 commit into
knative:mainfrom
Ankitsinghsisodya:mcp-version-tool
Open

Add version tool to MCP server#3996
Ankitsinghsisodya wants to merge 1 commit into
knative:mainfrom
Ankitsinghsisodya:mcp-version-tool

Conversation

@Ankitsinghsisodya

Copy link
Copy Markdown
Contributor

Changes

  • 🎁 Add a version MCP tool that reports the version (and git commit
    hash, when available) of the func client binary being driven, by
    shelling out to func version --output json the same way the other MCP
    tools do
  • 🎁 Add tests covering the happy path, source builds with no commit
    hash, executor errors, and malformed JSON output

/kind enhancement

Relates to #

Release Note
Added a version tool to the MCP server so agents can query the version of the func client binary and gate feature usage on version support.

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.
Copilot AI lite review requested due to automatic review settings August 7, 2026 14:08
@knative-prow knative-prow Bot added the kind/enhancement Feature additions or improvements to existing label Aug 7, 2026
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos August 7, 2026 14:08
@knative-prow

knative-prow Bot commented Aug 7, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ankitsinghsisodya
Once this PR has been reviewed and has the lgtm label, please assign matzew for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 version MCP tool and handler that shells out to func version --output json and maps the result into a structured VersionOutput.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Feature additions or improvements to existing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants