Custom Headers for MCP
Learn how to add custom headers to group tool calls together.
Tool calls can be grouped together using custom headers. This can be used to group tool calls that are part of the same chat session, same product, or any other custom grouping.
Adding custom headers
Merge Agent Handler will register any header with a prefix of X- as a custom header, and will store that information. We’ll associate the header with the given tool call. These headers will be visible in the logs dashboard, and filterable using the Request Headers filter.
Example code snippet:
Example headers:
X-chat-session-id: used to group tool calls that are part of the same end-user chat sessionX-workflow-id: used to group tool calls that are part of the same workflowX-product-id: used to group tool calls from that were called from the same product
Within the logs dashboard, you can filter on any custom header sent to Merge Agent Handler.