-
Notifications
You must be signed in to change notification settings - Fork 374
Open
Description
I have tried to run the sample from the doc with a simple mcp calculator (https://docs.langchain.com/oss/python/langchain/mcp).
It works with claude or gpt but it does not work with mistral.
I have made other tests with MultiServerMCPClient and Mistral but I always have the same error:
httpx.HTTPStatusError: Error response 422 while fetching https://api.mistral.ai/v1/chat/completions: {"detail":[{"type":"string_type","loc":["body","messages",2,"tool","content","str"],"msg":"Input should be a valid string","input":[{"type":"text","text":"8","id":"lc_dece2988-cfd4-4169-8fba-2c72c3d114af"}]},{"type":"extra_forbidden","loc":["body","messages",2,"tool","content","list[tagged-union[TextChunk,ImageURLChunk,DocumentURLChunk,ReferenceChunk,BBoxChunk,FileURLChunk,AudioChunk,FileChunk,ThinkChunk]]",0,"text","id"],"msg":"Extra inputs are not permitted","input":"lc_dece2988-cfd4-4169-8fba-2c72c3d114af"},{"type":"string_type","loc":["body","messages",3,"tool","content","str"],"msg":"Input should be a valid string","input":[{"type":"text","text":"96","id":"lc_02676c04-2c51-4365-96e5-50394ec47bdc"}]},{"type":"extra_forbidden","loc":["body","messages",3,"tool","content","list[tagged-union[TextChunk,ImageURLChunk,DocumentURLChunk,ReferenceChunk,BBoxChunk,FileURLChunk,AudioChunk,FileChunk,ThinkChunk]]",0,"text","id"],"msg":"Extra inputs are not permitted","input":"lc_02676c04-2c51-4365-96e5-50394ec47bdc"}]}
Here is the code sample :
client = MultiServerMCPClient(
{
"math": {
"transport": "stdio", # Local subprocess communication
"command": "python",
# Absolute path to your math_server.py file
"args": ["/test-mcp/src/test_mcp/math_server.py"],
}
}
)
tools = await client.get_tools()
agent = create_agent(
"mistralai:mistral-large-latest",
tools
)
math_response = await agent.ainvoke(
{"messages": [{"role": "user", "content": "what's (3 + 5) x 12?"}]}
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels