[PR #28306] feat: add inputs parameter to MCP tool invocation methods #32008

Open
opened 2026-02-21 20:50:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/28306

State: open
Merged: No


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • feat: Forward chat input variables to MCP server via _meta

    • Enables passing additional variables from chat request inputs to MCP servers, facilitating use cases like identity verification and permission control.
  • feat: Support MCP protocol-reserved _meta parameter in tool invocations

    • Adds the _meta field to CallToolRequestParams to comply with the MCP specification, enabling transmission of metadata such as progressToken or identityToken.

These changes improve flexibility for MCP-level business logic, allowing for more fine-grained control and context-aware processing based on upstream chat request details.

References:

Screenshots

Before After
sql execution in MCP cannot be authenticated The functions can be expanded by customizing parameters
32765fe0b941c70ffb5cad795c14777

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/28306 **State:** open **Merged:** No --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary - **feat**: Forward chat input variables to MCP server via `_meta` - Enables passing additional variables from chat request `inputs` to MCP servers, facilitating use cases like identity verification and permission control. - **feat**: Support MCP protocol-reserved `_meta` parameter in tool invocations - Adds the `_meta` field to `CallToolRequestParams` to comply with the MCP specification, enabling transmission of metadata such as `progressToken` or `identityToken`. These changes improve flexibility for MCP-level business logic, allowing for more fine-grained control and context-aware processing based on upstream chat request details. **References**: - [MCP Spec - General Fields](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/draft/basic/index.mdx#general-fields) - [#28076](https://github.com/langgenius/dify/discussions/28076), [#28167](https://github.com/langgenius/dify/discussions/28167) ## Screenshots | Before | After | |--------|-------| | sql execution in MCP cannot be authenticated | The functions can be expanded by customizing parameters | ||<img width="567" height="116" alt="32765fe0b941c70ffb5cad795c14777" src="https://github.com/user-attachments/assets/f7bf2373-0705-4bfa-a591-91d76959d21d" />| ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:50:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32008