Skip to content

Conversation

MasterOdin
Copy link

@MasterOdin MasterOdin commented Sep 5, 2025

Closes #2616

Updates the MCP tool call customisation docs so that:

  1. Gives more information on accessing the metadata, using MCP SDK as grounding example with link to appropriate docs
  2. Gives example mcp_server.py script so that the entire thing is runnable as-is which demonstrates the behavior

@MasterOdin MasterOdin force-pushed the docs-tool-call-customisation branch from 9917ade to e896eda Compare September 5, 2025 15:31
@MasterOdin MasterOdin force-pushed the docs-tool-call-customisation branch from e896eda to b8fb2a4 Compare September 5, 2025 16:58
@@ -169,7 +169,39 @@ The MCP servers provide the ability to set a `process_tool_call` which allows
the customisation of tool call requests and their responses.

A common use case for this is to inject metadata to the requests which the server
call needs.
call needs. Accessing the metadata is then SDK specific, for example with the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding het new section, can you add it below the existing example though? I think the flow of "here's how to send metadata", "here's how to receive it" is more clear.

Copy link
Author

Choose a reason for hiding this comment

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

To clarify, you're asking for the flow to be:

A common use case for this is to inject metadata to the requests which the server call needs.

mcp_process_tool_call.py code example
mcp_server.py code example

Please note, how to access the metadata is SDK specific, for example with the MCP Python SDK, it is accessible via the Context parameter for tool calls as shown above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@MasterOdin I was thinking:

A common use case for this is to inject metadata to the requests which the server call needs:

mcp_process_tool_call.py code example

How to access the metadata is MCP server SDK specific. For example with the MCP Python SDK, it is accessible via the Context parameter for tool calls:

mcp_server.py code example

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

Successfully merging this pull request may close these issues.

How to access metadata added in MCPServer.process_tool_call from MCP server tool
2 participants