You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"result": {
"tools": [
{
"name": "sequentialthinking",
"description": "A detailed tool for dynamic ...",
"inputSchema": {
"type": "object",
"properties": {
"thought": {
"type": "string",
"description": "Your current thinking step"
},
"nextThoughtNeeded": {
"type": "boolean",
"description": "Whether another thought step is needed"
},
"thoughtNumber": {
"type": "integer",
"description": "Current thought number",
"minimum": 1
},
"totalThoughts": {
"type": "integer",
"description": "Estimated total thoughts needed",
"minimum": 1
},
"isRevision": {
"type": "boolean",
"description": "Whether this revises previous thinking"
},
"revisesThought": {
"type": "integer",
"description": "Which thought is being reconsidered",
"minimum": 1
},
"branchFromThought": {
"type": "integer",
"description": "Branching point thought number",
"minimum": 1
},
"branchId": {
"type": "string",
"description": "Branch identifier"
},
"needsMoreThoughts": {
"type": "boolean",
"description": "If more thoughts are needed"
}
},
"required": [
"thought",
"nextThoughtNeeded",
"thoughtNumber",
"totalThoughts"
]
}
}
]
},
"jsonrpc": "2.0",
"id": 1
}
As you can see, there is a type mismatch for thoughtNumber param. The MCP server wants an integer but the model generated a String value, so I'm getting an error:
java.lang.IllegalStateException: Error calling tool: [TextContent[audience=null, priority=null, text={
"error": "Invalid thoughtNumber: must be a number",
"status": "failed"
}]]
So, the question is if there is a way to intercept the tool calling process, validate and adjust the request payload to fit the schema through existing Spring AI tools which I can't find or I should use prompt engineering practices or develop some workarounds?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Spring AI version: 1.0.0-M8.
LLM: Llama3.2 (3b) running locally with Ollama.
I'm facing an issue with tool calling payload generated by the model. The function input is:
I've connected to the @modelcontextprotocol/server-sequential-thinking which lists following tools:
As you can see, there is a type mismatch for thoughtNumber param. The MCP server wants an integer but the model generated a String value, so I'm getting an error:
So, the question is if there is a way to intercept the tool calling process, validate and adjust the request payload to fit the schema through existing Spring AI tools which I can't find or I should use prompt engineering practices or develop some workarounds?
Beta Was this translation helpful? Give feedback.
All reactions