Skip to content

Filter 8: mcp_tool #27

Description

@leseb

Purpose

Execute a single MCP tool call against an MCP server. Handle session reuse, approval policy, and event emission.

Behavior

  • Look up server config from responses.mcp_tool_map
  • Check approval policy: always (require approval), never (auto-approve), filter list
    • Default: approval required
    • If approval required: emit mcp_call.approval_request event
  • Reuse MCP session from responses.mcp_sessions (keyed on endpoint + headers hash)
    • Create new session if not cached (protocol auto-detection: STREAMABLE_HTTP → SSE fallback)
  • Call tools/call on MCP server
  • Emit mcp_call.in_progress, mcp_call.completed / mcp_call.failed events
  • Parse result: text content, image content
  • Return tool result message for next inference turn

Request parameters

  • type: "mcp"
  • server_label, server_url, connector_id, headers, authorization
  • require_approval: "always" | "never" | ApprovalFilter
  • allowed_tools: list[str] | AllowedToolsFilter

Praxis trait methods

  • on_response — execute MCP tool call, return result

Routing

Routed to via branch chains based on tool_parse classification. When tool_parse identifies an mcp / mcp_call tool type, the branch chain routes to this filter for execution. Results feed back into the next inference round via agentic_loop.

Same architectural pattern as web_search and file_search execution filters — a leaf execution filter that takes a tool call and produces a tool result.

Dependencies

Reference

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions