Skip to content

Conversation

@pragneshbagary
Copy link
Contributor

Issue:
matches, err := ts.sftp.Glob(pattern) , sftp.Glob returns nil when the pattern has no hits, causing to fail schema validation with errors like

$ echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"glob","arguments":{"pattern":"XXX*"}}}' >&"${MCP[1]}"

$ read -t 1 -r line <&"${MCP[0]}"; jq . <<<"$line"
{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": 0,
    "message": "validating tool output: validating root: validating /properties/matches: type: <invalid reflect.Value> has type \"null\", want \"array\""
  }
}

Fix

if matches == nil {
		matches = []string{}
}

Replacing the nil value with an empty slice

Result after fix

$ echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"glob","arguments":{"pattern":"XXX*"}}}' >&"${MCP[1]}"

$ read -t 1 -r line <&"${MCP[0]}"; jq . <<<"$line"
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"matches\":[]}"
      }
    ],
    "structuredContent": {
      "matches": []
    }
  }
}

Signed-off-by: pragneshbagary <pragneshbagary1699@gmail.com>
@AkihiroSuda AkihiroSuda added this to the v2.0.2 milestone Nov 19, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 2308c29 into lima-vm:master Nov 19, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants