whether MCP client can pass some extra fixed parameters without generating by LLM to MCP server #1228
Replies: 3 comments 2 replies
-
|
Below are four ways you can inject extra fixed parameters (like an 1. Merge into the tool‑call argumentsEvery tool invocation in MCP uses a // After your agent parses a tool call from the LLM:
const generatedArgs = toolCall.arguments as Record<string, unknown>;
// Merge in your fixed param
const finalArgs = { ...generatedArgs, appName: 'MyAppName' };
// Send to the MCP server
const result = await client.callTool(toolCall.name, finalArgs);This works because the schema defines: export interface CallToolRequest extends Request {
method: "tools/call";
params: {
name: string;
arguments?: { [key: string]: unknown };
};
}so any extra keys in 2. Use the JSON‑RPC
|
Beta Was this translation helpful? Give feedback.
-
you could try add appName as param in url when initialize mcp client here we have similar use case that put a unique ID in url that will be used in mcp server side to handle auth flow. |
Beta Was this translation helpful? Give feedback.
-
|
fyi if merged #414 will document the _meta practice discussed here (and not preclude others as the spec already allows extra parameters) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Question Category
Your Question
I am a newer to the MCP, and it is so nice. But there is a question confusing me.
AI system can using MCP client to call the MCP server, and the parameter value can be generated and fixed by llm. In some case, I need pass some extra fixed param, how to do that.
For example, I need know who is calling the MCP server, so I need pass the appName to MCP server by MCP client.
Beta Was this translation helpful? Give feedback.
All reactions