CoplayDev/unity-mcp

Some MCP commands not working in Gemini CLI

Closed this issue ยท 9 comments

Gemini CLI: 0.4.1
UnityMCP: 3.4.0

Got these errors in VSC Gemini CLI terminal after updating Gemini CLI, I don't know if this a Gemini CLI issue or whether they've changed how MCP's are handled, wanted to make you aware.

(base) PS C:\UnityProjects\Game> gemini [DEBUG] [IDEClient] Attempting to connect to IDE via HTTP SSE Skipping tool 'manage_scene' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'manage_gameobject' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'manage_asset' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'manage_shader' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'read_console' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'execute_menu_item' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'list_resources' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'read_resource' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server. Skipping tool 'find_in_file' from MCP server 'unityMCP' because it has missing types in its parameter schema. Please file an issue with the owner of the MCP server.

I have encountered a same issue last week and created a patch here.
3d8c5de

It seems the gemini cli does a more strict param validation.

This is great. Would you like to submit a PR? We're always looking for more contributors. @Nemo-G

Thanks @gravitydeepimpactsun, and for looking into it. I might have a look as well, and see if with Pydantic we can get a more type friendly requests and responses.

@dsarno Sure. I can create a PR. But does @msanatan mean you would look into the issue make some adjustments yourself?

Hi @Nemo-G thank you. I will defer to @msanatan for an answer.

@Nemo-G please go ahead with your PR. Can you make one change for me? Instead of Optional[int] use int -> None. This is the preferred way to do union types is with the shorthand in Python. Also, be sure to merge the latest code from our main into your branch.

What I'd like to do has overlap with this issue, but it has other components. Please, as @dsarno said, we'd love to have contributions from everyone!

@Nemo-G I've done a pretty comprehensive update, can you try v4.1.0 and let us know if it works w/o your modifications?

Essentially, the MCP tools and all their arguments now have well defined descriptions. It should now work consistently across all clients, and in some cases the LLM should be a bit smarter because the parameters have useful info and better typing.

Unity-MCP 4.1.1 and Gemini CLI 0.6.1, told Gemini to test all MCP commands:

Most seemed to work now and the original error in OP is gone but...

Now testing list_resources. This will be a key indicator if the update was successful.
 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 โ”‚ โœ“  list_resources (unityMCP MCP Server) {"pattern":"**/*.cs","under":"Assets"}   โ”‚
 โ”‚                                                                                  โ”‚
 โ”‚    {                                                                             โ”‚
 โ”‚      "success": true,                                                            โ”‚
 โ”‚      "data": {                                                                   โ”‚
 โ”‚        "uris": [                                                                 โ”‚
 โ”‚          "unity://spec/script-edits"                                             โ”‚
 โ”‚        ],                                                                        โ”‚
 โ”‚        "count": 1                                                                โ”‚
 โ”‚      }                                                                           โ”‚
 โ”‚    }                                                                             โ”‚
 โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โœฆ list_resources: Failure. The tool is still not returning the list of user scripts, which 
  will block many downstream tests.

Now testing manage_script (legacy). Since list_resources is broken, I will guess a 
  common script path.
 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 โ”‚ โœ“  manage_script (unityMCP MCP Server) {"path":"Assets/_scripts/PlayerController.cs","acโ€ฆ  โ”‚
 โ”‚                                                                                            โ”‚
 โ”‚    {                                                                                       โ”‚
 โ”‚      "success": false,                                                                     โ”‚
 โ”‚      "code": "Script not found at                                                          โ”‚
 โ”‚    'Assets/_scripts/PlayerController.cs/PlayerController.cs'.",                            โ”‚
 โ”‚      "error": "Script not found at                                                         โ”‚
 โ”‚    'Assets/_scripts/PlayerController.cs/PlayerController.cs'."                             โ”‚
 โ”‚    }                                                                                       โ”‚
 โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โœฆ manage_script: Failure. Could not find the script, which is expected given the 
  list_resources issue.

No problem

Unity-MCP 4.1.1 and Gemini CLI 0.6.1, told Gemini to test all MCP commands:

Most seemed to work now and the original error in OP is gone but...

Now testing list_resources. This will be a key indicator if the update was successful.
 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 โ”‚ โœ“  list_resources (unityMCP MCP Server) {"pattern":"**/*.cs","under":"Assets"}   โ”‚
 โ”‚                                                                                  โ”‚
 โ”‚    {                                                                             โ”‚
 โ”‚      "success": true,                                                            โ”‚
 โ”‚      "data": {                                                                   โ”‚
 โ”‚        "uris": [                                                                 โ”‚
 โ”‚          "unity://spec/script-edits"                                             โ”‚
 โ”‚        ],                                                                        โ”‚
 โ”‚        "count": 1                                                                โ”‚
 โ”‚      }                                                                           โ”‚
 โ”‚    }                                                                             โ”‚
 โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โœฆ list_resources: Failure. The tool is still not returning the list of user scripts, which 
  will block many downstream tests.

Now testing manage_script (legacy). Since list_resources is broken, I will guess a 
  common script path.
 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 โ”‚ โœ“  manage_script (unityMCP MCP Server) {"path":"Assets/_scripts/PlayerController.cs","acโ€ฆ  โ”‚
 โ”‚                                                                                            โ”‚
 โ”‚    {                                                                                       โ”‚
 โ”‚      "success": false,                                                                     โ”‚
 โ”‚      "code": "Script not found at                                                          โ”‚
 โ”‚    'Assets/_scripts/PlayerController.cs/PlayerController.cs'.",                            โ”‚
 โ”‚      "error": "Script not found at                                                         โ”‚
 โ”‚    'Assets/_scripts/PlayerController.cs/PlayerController.cs'."                             โ”‚
 โ”‚    }                                                                                       โ”‚
 โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โœฆ manage_script: Failure. Could not find the script, which is expected given the 
  list_resources issue.

Thanks for sharing. The response from the tool seems correct , it's returning what the function is expected to return as I looked at the code. So Gemini is wrong in classifying as a failure, but it's right in that this probably isn't what you're expecting

In #287 we'll properly manage MCP tools, resources and prompts as they're meant to used, which should make Gemini CLI and all MCP hosts more performant and effective. That will fix the failure you've shared.

I'll close this one now. Thanks for flagging and assisting @gravitydeepimpactsun @Nemo-G