# Feature Request: Pass \_meta through to MCP \`callTool()\` in \`@langchain/mcp-adapters\`

**URL:** https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225
**Category:** LangChain
**Tags:** js-help
**Created:** [July 23, 2026, 7:31am UTC](https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225 "2026-07-23T07:31:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![star67](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/star67/32/3333_2.png) [@star67](https://forum.langchain.com/u/star67)
#### Post date: [July 23, 2026, 7:31am UTC](https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225/1 "2026-07-23T07:31:55Z")

</div>

# Problem

There is a `_meta filed per MCP `[\_meta specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#_meta):

> The `_meta` property/parameter is reserved by MCP to allow clients and servers to attach additional metadata to their interactions.

`Currently @langchain/mcp-adapters` does NOT expose a way to attach MCP protocol `_meta`on tool invocations.

It makes it hard to cover the following use cases:

- Distributed tracing / correlation IDs on `tools/call` without HTTP header forks
- Per-request session / user / tenant context the LLM must not see in tool args
- Parity with Python adapters and LangChain4j for multi-language stacks
  - Java: [MCP \_meta fields by jmartisk · Pull Request #4780 · langchain4j/langchain4j · GitHub](https://github.com/langchain4j/langchain4j/pull/4780)
  - Python: [feat: add support for passing metadata to MCP tool calls by udayshnk · Pull Request #423 · langchain-ai/langchain-mcp-adapters · GitHub](https://github.com/langchain-ai/langchain-mcp-adapters/pull/423)

# Proposal

1. Extend `beforeToolCall` / tool-call modification to allow `_meta` (e.g. return `{ args?, headers?, _meta? }` or `meta`)
  - 

```javascript
const client = new MultiServerMCPClient({
  mcpServers: { /* ... */ },
  beforeToolCall: ({ name, args }, _state, config) => ({
    args,
    // protocol-level metadata — must NOT require fork()
    _meta: {
      "com.example/correlation_id": config?.configurable?.correlation_id,
      "com.example/trace_id": config?.configurable?.session_id,
    },
  }),
});

```

2. Forward that value into the underlying MCP SDK `callTool` params as protocol `_meta`
3. Optionally surface response `_meta` on the tool result / artifact (as Python PR #423 does).

---

<div class="post-metadata">

### Author: ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)
#### Post date: [July 23, 2026, 10:51am UTC](https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225/2 "2026-07-23T10:51:20Z")

</div>

Hey @star67. Welcome to Langchain Community.

Today `beforeToolCall` in `@langchain/mcp-adapters` only supports `{ args?, headers? }`. Headers go through `client.fork()` (HTTP/SSE only), and the actual `callTool` payload is just `{ name, arguments }`, no request `_meta` gets forwarded. Response `_meta` is already surfaced as an `mcp_meta` artifact, but that doesn’t help for request-side correlation / session / tenant context.

One small correction on parity: Python isn’t fully there yet either. **[PR #423](https://github.com/langchain-ai/langchain-mcp-adapters/pull/423)** adds this via interceptors (`metaParams`), but it’s still open and waiting on maintainers. So JS isn’t uniquely behind, both need this.

Your proposal looks right though. Extending `beforeToolCall` to return `_meta` and forwarding it into the MCP SDK `callTool` params keeps that data out of tool args (so the model never sees it) and works for stdio too, unlike headers.

Best next step: open a feature request / PR on **[langchain-ai/langchainjs](https://github.com/langchain-ai/langchainjs)** for `@langchain/mcp-adapters`, mirroring the Python interceptor approach.

---

<div class="post-metadata">

### Author: ![star67](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/star67/32/3333_2.png) [@star67](https://forum.langchain.com/u/star67)
#### Post date: [July 24, 2026, 1:47pm UTC](https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225/3 "2026-07-24T13:47:46Z")

</div>

Hey @keenborder786 , thanks for your reply!  
Here is the PR [feat(mcp-adapters): forward \_meta from beforeToolCall to MCP callTool requests by star67 · Pull Request #11251 · langchain-ai/langchainjs · GitHub](https://github.com/langchain-ai/langchainjs/pull/11251)

---

<div class="post-metadata">

### Author: ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)
#### Post date: [July 25, 2026, 2:34pm UTC](https://forum.langchain.com/t/feature-request-pass-meta-through-to-mcp-calltool-in-langchain-mcp-adapters/4225/4 "2026-07-25T14:34:31Z")

</div>

if this helped you , I would appreciate if you can mark the answer as solution.
