Skip to content

analyze_files should have better error when encountering a missing path. #282

@gspencergoog

Description

@gspencergoog

The Gemini CLI agent ran the analyze_files tool with an invalid path and it gave this error.

 ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ x  analyze_files (dart MCP Server) {"roots":[{"root":"file:///usr/L/g/h/g/c/g/packages/spikes/json_client"}]}         │
 │                                                                                                                           │
 │    MCP tool 'analyze_files' reported tool error for function call:                                                        │
 │    {"name":"analyze_files","args":{"roots":[{"root":"file:///usr/L/g/h/g/c/g/packages/spikes/json_client"}]}} with    │
 │    response: [{"functionResponse":{"name":"analyze_files","response":{"error":{"content":[{"type":"text","text":"Null     │
 │    check operator used on a null value\n#0      DartAnalyzerSupport._analyzeFiles                                         │
 │    (package:dart_mcp_server/src/mixins/analyzer.dart:277)\n<asynchronous suspension>\n#1      ToolsSupport._callTool      │
 │    (package:dart_mcp/src/server/tools_support.dart:113)\n<asynchronous suspension>\n#2      Server._handleSingleRequest   │
 │    (package:json_rpc_2/src/server.dart:212)\n<asynchronous suspension>\n#3      Server._handleRequest                     │
 │    (package:json_rpc_2/src/server.dart:187)\n<asynchronous suspension>\n"}],"isError":true}}}}]                           │
 ╰───────────────────────────────────────────────────────────────────────────────────────────────────────

I would have expected it to generate something like:

MCP tool 'analyze_files' reported tool error for function call: 
ERROR: Supplied root file:///usr/L/g/h/g/c/g/packages/spikes/json_client is an invalid path. Please supply a valid root.

So that the LLM knows better what it did wrong. check operator used on a null value is too vague.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions