Skip to content

Commit 54eff56

Browse files
committed
docs: update README and add note for JSON handling in testMatchCodeRuleTool
1 parent 2cc7815 commit 54eff56

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Launch the MCP server over stdio:
5050
```bash
5151
swift run ast-grep-mcp-swift --config /absolute/path/to/sgconfig.yaml
5252
swift run ast-grep-mcp-swift --verbose --config /absolute/path/to/sgconfig.yaml # verbose debug logs to stderr
53-
swift run ast-grep-mcp-swift --version # or -v, print version information
53+
swift run ast-grep-mcp-swift --version # print version information
5454
```
5555

5656
You can omit `--config` if you rely on defaults or the `AST_GREP_CONFIG` environment variable.

Sources/ast-grep-mcp-swift/ast_grep_mcp_swift.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ private func testMatchCodeRuleTool(_ args: [String: Value]?, configPath: String?
342342
throw MCPError.internalError("No matches found for the given code and rule. Try adding `stopBy: end` to inside/has rules.")
343343
}
344344

345+
// Note: Use plain text JSON here instead of jsonResourceContent to avoid
346+
// "TypeError: Cannot read properties of undefined (reading 'uri')" in some MCP clients.
345347
let jsonText = try encodeJSON(matches)
346348
return .init(content: [.text(jsonText)], isError: false)
347349
}

0 commit comments

Comments
 (0)