-
Notifications
You must be signed in to change notification settings - Fork 727
Closed as duplicate of#431
Closed as duplicate of#431
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When using the CLI mode, and a tool input schema defines the type as "array", the CLI passes the value to the server as a single string instead of a JSON array.
To Reproduce
Steps to reproduce the behavior:
- Use the following tool description and execution:
server.setRequestHandler(ListToolsRequestSchema, () => {
return {
tools: [{
name: "some-tool",
description: "sample description",
inputSchema: {
type: "object",
properties: {
prop: "array",
description: "This should be an array"
}
},
required: ["prop"]
}]
}
})
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const name = request.params.name;
switch (name) {
case 'some-tool':
return {
content: [{
type: "text",
text: `The arguments provided were ${JSON.stringify(request.params.arguments)}`
}]
};
default:
throw new Error('unknown tool');
}
});
- Use the inspector CLI mode to invoke the tool, e.g.,
noglob npx @modelcontextprotocol/inspector --cli node dist/index.js --method tools/call --tool-name some-tool --tool-arg prop=["abcd","defg"]
(noglob
is necessary when using zsh
, because brackets are how zsh
detects a glob.)
3. Observe that the return value is:
{
"content": [
{
"type": "text",
"text": "The arguments provided were {\"prop\":\"[abcd,defg]\"}"
}
]
}
Expected behavior
The value of prop
should be ["abcd", "defg"]
, not "[abcd,defg]"
.
Logs
N/A
Additional context
N/A
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working