I have an MCP server with a tool that accepts a list of strings as input. I keep running into a problem trying to have the Cursor agent execute the a tool from the MCP server. The error message shows that invalid JSON is being produced. For example my tool with two input parameters and the error I get:
Expected ‘,’ or ‘}’ after property value in JSON at position 50 (line 1 column 51)
I’m unable to find logs detailing what might be happening here. From my investigation I don’t believe the execution of this tool is actually making it to my MCP server which leads me to believe it’s something internal to the Cursor application. Additionally, I’ve tested this same MCP server on other platforms like ChatGPT and Claude and it seems to work fine over there. Once I change the list parameter into a regular string parameter though Cursor is then able to execute the tool again.
Hey, thanks for the detailed report. It looks like this is a bug on our side in how Cursor serializes array or list parameters when calling MCP tools.
To help us dig in further, could you share:
The JSON schema for your tool parameters, especially how my_list_param is defined like type: "array", items, etc.
How your MCP server is configured in Cursor, stdio or SSE, plus the relevant part of your mcp.json or settings
Your Cursor version (Help > About) and your OS
Also, when you see the error, does it show up in the Cursor chat UI, or somewhere in your MCP server logs? I want to confirm Cursor is failing before it even sends the request to the server.
For now, you already found the best workaround, accept a string parameter instead of a list. You can parse it server-side, like splitting on commas or accepting a JSON-formatted string.
I’ll share this with the team as soon as I have the details.
@mcp.tool(
description=my_tool_description,
annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False},
)
async def my_tool(
id: Annotated[str, Field(description="str ID for item")],
my_list: Annotated[Optional[List[str]], Field(description="List of fields to get for item")] = None,
):
my_tool_description =
…
Usage examples for agents
-------------------------
1) User: "Give me the first and second from item ABC."
-> Call:
{
"id": "ABC",
"my_list": ["first", "second"]
}
…
There are no logs from the MCP server because it doesn’t seem like the request ever makes it there. It is my belief Cursor fails before sending the request for this reason. The error I do see comes from Cursor chat UI. There is no error logs I could find in Cursor output logs (View > Output)
Thanks for the details. We have everything we need now, and the issue is clear.
This is a bug on our side. Cursor is serializing array-type parameters incorrectly when calling MCP tools. The request never reaches the server. It breaks during JSON creation.
I’ve passed this on to the team. Let me know if you have any other questions.