How can Standalone Agent App receive external input variables and bind them to MCP tool parameters?
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] Please do not modify this template :) and fill in all the required fields.
### 1. Is this request related to a challenge you're experiencing? Tell me about your story.
Background
I am currently using Dify 1.16.1 and am considering migrating from:
Steps to reproduce
Chatflow
↓
Agent V2
↓
MCP Tools
to:
Standalone Agent App
↓
MCP Tools
The main reason for this migration is that Agent V2 in Chatflow currently does not support conversation-level memory across turns, while the Standalone Agent App can maintain conversation memory through conversation_id.
However, I found another limitation in the Standalone Agent App that is important for my use case.
Problem
In a Chatflow Agent node, I can define workflow input variables and use them in the Agent node/tool configuration.
For example, I may have an external variable:
branchId = "12345"
and I want to directly bind it to an MCP tool parameter:
MCP Tool:
get_branch_data(
branchId = "12345"
)
The important point is that I do not want the Agent to decide the value of branchId.
I want the value to be deterministically provided by the workflow/backend and directly assigned to the tool parameter.
However, in the Standalone Agent App in Dify 1.16.1, I cannot find a configuration area for input variables similar to the Chatflow Agent node.
Therefore, I currently cannot easily achieve either of the following:
1. Inject external variables into the Agent prompt
For example:
User query:
{{query}}
External context:
branchId = {{branchId}}
branchName = {{branchName}}
2. More importantly, bind an external variable directly to an MCP tool parameter
For example:
External input:
branchId = "12345"
↓
MCP Tool:
get_branch_data
branchId = {{branchId}}
I would prefer the second approach because branchId is a business constraint and should not be left to the LLM to infer or generate.
My questions
Does Standalone Agent App support external input variables in Dify 1.16.1?
If it does, how can I define and pass these variables from my backend when calling the Agent App API?
If Standalone Agent App does not currently expose input variables, is this an intentional design limitation?
Is there any supported way to bind an external value directly to a specific MCP tool parameter in Standalone Agent App, similar to the variable binding available in a Chatflow Agent node?
For example, if my backend sends:
{
"query": "Check public opinion about this branch.",
"branchId": "12345"
}
can Dify Agent App do something equivalent to:
MCP Tool
get_branch_data(
branchId = external.branchId
)
without asking the LLM to generate or infer branchId?
If this is not currently supported, what is the recommended architecture for this use case?
Would the recommended approach be to:
Backend
↓
Dify Standalone Agent App
↓
Agent
↓
MCP Tool
and pass the fixed business parameter through some kind of execution context / tool context?
Or should this be implemented outside of Dify, for example by having the backend or MCP gateway inject/override the parameter before the MCP tool is executed?
Why this matters
My business application has several parameters that should be controlled deterministically by the application rather than generated by the Agent.
For example:
branchId
branchName
tenantId
userId
permission scope
data scope
These values may determine which business data the MCP tool is allowed to access.
Therefore, I would like to distinguish between:
LLM-controlled parameters
and:
Application-controlled parameters
For example:
Agent decides:
query
time range
aggregation method
Application decides:
tenantId
branchId
userId
permission scope
Ideally, Standalone Agent App would provide a mechanism similar to:
External Input
↓
Tool Parameter Binding
↓
MCP Tool
while still allowing the Agent to autonomously decide which tool to call.
Could you clarify whether this capability is currently supported in Dify 1.16.1, and if not, what the recommended workaround or future direction is?
### 2. Additional context or comments
_No response_
### 3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
Contributor guide
Research direction
Start by tracing the Standalone Agent App API and its MCP tool-parameter handling, since the issue provides no file or test entry point. Determine whether backend-supplied values can be passed separately from LLM-controlled parameters, and define completion as a documented, supported way to bind application-controlled values without asking the model to generate them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100