mongodb-mcp-server #839
-
Hi I'm trying to implement in a Asp.NET core application using Ollama and qwen3:30b a connection to the mongodb-mcp-server. It can connect and list all the tools (i can log them) and also call successfully the connect and list database. But when it try to call the find or aggregate tools in the mcp i get the error like:
and also for filter and son on... it looks like it can't translate the query (that i can see and it's corret) to the correct format. I've tried modify the prompt or call the functions via API (using "custom" plugin) but nothing worked and i'm stuccked. Any suggestion or example? Thnx for you time!!! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Superficially, it would appear that the MCP server is rejecting your call inputs because of a type error. Have you checked that your inputs match the advertised schema of the tool? Are you able to call the tool with the same arguments using MCP inspector? |
Beta Was this translation helpful? Give feedback.
-
Hi sorry for the delay but it's quite an intensive period :-) .... i've pushed a very basic repository thet reproduce the problem. in this repo there is not Mongodb plugin that try to send the command to the mcp by http client instead it try to invoke it directly but as you can see if you try to run it (i've also added a very basic read me) you'll see the error is the same. let me know if you need also the example with http client. sorry for the quality of the code Again thnx for your support!! link to the repo: (https://github.com/fscamuzzi/net-mongodb-mcp-example) |
Beta Was this translation helpful? Give feedback.
-
A few comments: I am not very familiar with ollama, but generally it's not good practice to hardcode tool signatures in your system prompt. If the tool signature changes on the server side, your prompt will be out of sync and you'll get type errors. If your LLM API does not allow providing JSON schema tools, then you should write code to map the MCP tool schema to a fragment of the system prompt programmatically. I am also skeptical of the manual mapping of tool calls to invocations. This has the same issue of not being able to handle if the server side tool changes. If you use Microsoft.Extensions.AI this is handled automatically for you, and you don't need to do this. See: https://learn.microsoft.com/en-us/dotnet/ai/microsoft-extensions-ai#tool-calling The benefit of tools and MCP is that they provide a generic way to ingrate with models. You can still write instructions (like the part about being an ACTION model and not just talking about using tools) but you don't have to manually wire the tools up. |
Beta Was this translation helpful? Give feedback.
Sounds like a potential duplicate of #274. I would recommend providing a self-contained repro (aka a console app that runs without additional input and performs the unexpected action).