Skip to content

feat: support mcp_list_tools - #172

Draft
maralbahari wants to merge 28 commits into
vllm-project:mainfrom
EmbeddedLLM:mcp-tool-list
Draft

feat: support mcp_list_tools#172
maralbahari wants to merge 28 commits into
vllm-project:mainfrom
EmbeddedLLM:mcp-tool-list

Conversation

@maralbahari

@maralbahari maralbahari commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Stack

Summary

Expose MCP tool discovery through the Responses API using OpenAI-compatible mcp_list_tools output items and streaming lifecycle events.

The gateway previously discovered remote MCP tools internally but did not include the discovery lifecycle in the public response.

Changes

  • Add mcp_list_tools as a first-class response output item.
  • Use McpClient::list_tools() during MCP handler initialization to discover tools from the remote server.
  • Represent each discovered tool with:
    • name
    • description
    • input schema
    • read_only annotation
  • Apply allowed_tools filtering to the discovered tool set.
  • Retain the discovery output in the request-scoped tool registry.
  • Include an mcp_list_tools item in streaming and non-streaming response output.
  • Emit the OpenAI-compatible streaming lifecycle:
    • response.output_item.added
    • response.mcp_list_tools.in_progress
    • response.mcp_list_tools.completed
    • response.output_item.done
  • Preserve the same mcpl_ item ID and output index throughout the lifecycle.
  • Add support for response.mcp_list_tools.failed.
  • Extend ResponseAccumulator to reconstruct mcp_list_tools items from upstream streaming events.
  • Keep mcp_list_tools as public response metadata rather than an executable tool call or client-action item.

Testing

  • Added serialization and round-trip coverage for mcp_list_tools output items.
  • Added accumulator coverage for reconstructing list-tools items from output_item.added and output_item.done.
  • Added handler and registry coverage for MCP discovery metadata and stable lifecycle identity.
  • Added lifecycle assertions for event order, item IDs, output indices, and contiguous sequence numbers.
  • Updated MCP integration tests to compare gateway list-tools output and lifecycle events with OpenAI recordings.
  • Re-recorded MCP cassettes for:
    • tool discovery without a tool call
    • successful MCP calls
    • missing arguments
    • invalid argument types
    • non-streaming MCP calls
  • Allow OpenAI and gateway cassettes to use different MCP server URLs while comparing the remaining MCP declaration and response behavior.

Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
…-header

Signed-off-by: maral <maralbahari.98@gmail.com>
…to mcp-tool-list

Signed-off-by: maral <maralbahari.98@gmail.com>
@maralbahari maralbahari changed the title Mcp tool list feat: support mcp_list_tools Aug 7, 2026
Signed-off-by: maral <maralbahari.98@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant