Skip to content

MCP: add invoke tool to test deployed Functions from agent context #3727

@sneharathod7

Description

@sneharathod7

Summary

The MCP server currently does not expose an invoke tool, even though func invoke already exists as a CLI command. After deploying a Function through the MCP workflow, agents have no MCP-native way to verify the deployment by sending a test request.

Related to #3646 (LFX: End-to-End Agentic Workflow).

Current Behavior

  1. Agent deploys a Function using the deploy MCP tool
  2. Agent wants to validate the deployed Function
  3. No invoke MCP tool exists
  4. Validation requires external shell commands or manual HTTP requests outside the MCP workflow

Expected Behavior

An MCP invoke tool should allow agents to:

  • send requests to deployed or locally running Functions
  • support HTTP and CloudEvent invocation formats
  • optionally provide request body and content type
  • return invocation response details

Why This Matters

The current MCP workflow supports create → build → deploy, but there is no MCP-native mechanism for validating the deployed Function afterward.

Adding invoke would help complete the Function lifecycle exposed to agents and improve the end-to-end workflow envisioned in #3646.

Possible Implementation Direction

A new pkg/mcp/tools_invoke.go tool could wrap the existing func invoke command following the same registration and handler patterns already used by tools such as tools_create.go.

The implementation could expose fields such as:

  • path
  • invocation format
  • request body
  • content type
  • target mode (local/remote)

Tool registration and tests could follow the existing MCP tool patterns already used throughout pkg/mcp.

Notes

  • func invoke already exists as a fully implemented CLI command in cmd/invoke.go
  • Invocation is effectively a read-only operation, so it should not require write-enabled MCP mode

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions