Files
python-sdk/pkg/hanzo-tools-lsp
zooqueenandHanzo Dev e1635ebf98 feat(lsp): repo answers from /v1/code/lsp, file stays local
Mirrors hanzoai/mcp's Rust `lsp` exactly: one tool, two planes, picked by data
the caller already has. `file` names the file; `repo` (a git.hanzo.ai slug,
optional `rev`) says which world it lives in. Without `repo` nothing changes —
the same language server on the same tree. With it, the question goes to the
indexed corpus behind /v1/code/lsp, which reaches across a repo's dependencies
without checking anything out.

One table maps actions onto ops: locate carries a relation (definition|
reference|type|implementation) because "where is X" is one question with four
answers, not four routes; hover, symbols, diagnostics and complete stand on
their own. The body is {repo, rev?, path, line, character, relation?} in LSP's
own frame — 0-based line, UTF-16 character — shifted from the tool's 1-based
`line` by the same expression the local plane uses.

The call goes through the shared HanzoCloud client hanzo-tools-code and
hanzo-tools-net already compose, so there is no second client and no second
lsp tool. Actions a plane cannot serve say so up front rather than spawning a
server or calling out.

test_lsp_tools.py asked for a class named `LspTool`; the class is `LSPTool`,
so those two never ran. One name, and they run.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-06 03:19:28 -07:00
..

hanzo-tools-lsp

Language Server Protocol tools for Hanzo MCP.

Installation

pip install hanzo-tools-lsp

Tools

lsp - Language Server Protocol

Code intelligence via LSP servers.

Go to definition:

lsp(action="definition", file="/path/to/file.py", line=10, character=15)

Find references:

lsp(action="references", file="/path/to/file.py", line=10, character=15)

Hover information:

lsp(action="hover", file="/path/to/file.py", line=10, character=15)

Code completion:

lsp(action="completion", file="/path/to/file.py", line=10, character=15)

Diagnostics:

lsp(action="diagnostics", file="/path/to/file.py")

Rename symbol:

lsp(action="rename", file="/path/to/file.py", line=10, character=15, new_name="newName")

Check status:

lsp(action="status")  # Check LSP server status

Supported Languages

  • Go (gopls)
  • Python (pyright)
  • TypeScript/JavaScript (typescript-language-server)
  • Rust (rust-analyzer)
  • Java (jdtls)
  • C/C++ (clangd)
  • Ruby (solargraph)
  • Lua (lua-language-server)

Language servers are automatically installed as needed.

License

MIT