Skip to content

feat(mcp): add 'invoke' tool and update documentation - #3986

Open
Ankitsinghsisodya wants to merge 4 commits into
knative:mainfrom
Ankitsinghsisodya:feat/mcp-invoke-tool
Open

feat(mcp): add 'invoke' tool and update documentation#3986
Ankitsinghsisodya wants to merge 4 commits into
knative:mainfrom
Ankitsinghsisodya:feat/mcp-invoke-tool

Conversation

@Ankitsinghsisodya

Copy link
Copy Markdown
Contributor

Changes

  • 🎁 Add an invoke MCP tool that lets agents send a test request to a local or remote running Function, mirroring func invoke (path, target, format, id, source, type, data, content-type, request-type, file, insecure, verbose)
  • 🎁 Add a func://help/invoke MCP resource exposing func invoke --help
  • 🎁 Document the invoke tool in the MCP agent instructions, including the deploy-then-verify workflow (invoke a Function after deploying it to confirm it responds successfully before reporting success)

/kind enhancement

Release Note

Added an `invoke` tool to the func MCP server, allowing AI agents to send a test request to a local or remote running Function and verify it responds successfully (e.g. after a deploy).

Docs


- Introduced the 'invoke' tool to send test requests to running Function instances.
- Updated instructions to include usage details for the 'invoke' tool, emphasizing the importance of absolute paths and providing guidance on parameters.
- Added help resources for the 'invoke' command in the MCP server setup.
Copilot AI review requested due to automatic review settings August 3, 2026 08:05
@knative-prow knative-prow Bot added kind/enhancement Feature additions or improvements to existing size/L 🤖 PR changes 100-499 lines, ignoring generated files. labels Aug 3, 2026
@Ankitsinghsisodya

Copy link
Copy Markdown
Contributor Author

cc: @lkingland

@knative-prow

knative-prow Bot commented Aug 3, 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 jrangelramos 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 requested review from dsimansk and jrangelramos August 3, 2026 08:07

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

Adds an MCP invoke tool to the pkg/mcp server so agents can send test requests to a running Function (mirroring func invoke), plus a help resource and updated agent instructions to support a deploy-then-verify workflow.

Changes:

  • Introduces invoke as a new MCP tool backed by func invoke, with structured input/output and argument mapping.
  • Registers invoke in the MCP server and exposes func://help/invoke.
  • Updates MCP agent instructions to include invoke guidance (notably post-deploy verification).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
pkg/mcp/tools_invoke.go Implements the new invoke MCP tool and maps structured input to func invoke CLI flags.
pkg/mcp/tools_invoke_test.go Adds unit tests validating argument passthrough, no-arg invocation behavior, and error surfacing.
pkg/mcp/mcp.go Registers the invoke tool and adds the func://help/invoke resource.
pkg/mcp/instructions.md Documents invoke usage and recommends deploy-then-invoke verification for agents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/mcp/tools_invoke.go
Comment thread pkg/mcp/tools_invoke.go Outdated
Comment thread pkg/mcp/tools_invoke.go Outdated
Comment thread pkg/mcp/instructions.md Outdated
…safety

- Updated the documentation to clarify that the 'path' parameter is now required for the invoke tool, ensuring users specify the function directory.
- Added cautionary notes regarding potential side effects when invoking functions, especially in remote scenarios.
- Enhanced test coverage for the invoke tool, including checks for missing 'path' arguments and readonly mode restrictions.
- Clarified the 'target' parameter description in the InvokeInput struct to specify that it defaults to auto-discovery, preferring local when both local and remote instances are available. This enhances user understanding of the parameter's behavior.
- Updated the invoke tool to support CloudEvent extension attributes, allowing users to pass key-value pairs as repeated '--extension key=value' flags.
- Modified the documentation to reflect that the MCP server's read-only mode now also disables the invoke operation, alongside deploy and delete.
- Enhanced test coverage for the invoke tool, ensuring proper handling of extensions and readonly mode restrictions.
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