Outlines one file: every declaration in it, with its kind and its span.
Outlines one file: every declaration in it, with its kind and its span.
POST /v1/lsp/symbols
| Address | https://api.hanzo.ai/v1/lsp/symbols |
| Method | POST |
| Operation | post_lsp_symbols |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Outlines one file: every declaration in it, with its kind and its span. The position is ignored — the answer is the whole file.
Request
6 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification — not a byte offset and not a rune index. |
line | body | integer | — | Line is 0-based, per the LSP specification. |
path | body | string | — | Path is the repo-relative file, e.g. |
relation | body | string | — | Relation refines locate: definition, reference, type or implementation. |
repo | body | string | — | Repo is the repository NAME within the caller's own org, e.g. "cloud". |
rev | body | string | — | Rev is a branch, tag or commit sha. Empty means the default branch. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | Answer | ok |
200 body — 44 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
cold | body | boolean | — | Cold reports that this request paid to PREPARE the revision — the tree write, the dependency fetch and the language server's first index. |
completions | body | Completion[] | — | Completions is complete's answer: the candidates at the position, typed and resolved through the repository's dependencies rather than guessed from text. |
completions[].detail | body | string | — | Detail is the server's short elaboration, typically the type or signature. |
completions[].kind | body | integer | — | Kind is the LSP CompletionItemKind number (2 method, 3 function, 5 field, 6 variable, …), passed through as the protocol spells it. |
completions[].label | body | string | — | Label is the text a client would insert, and what an editor lists. |
diagnostics | body | Diagnostic[] | — | Diagnostics is diagnostics' answer: every problem the server finds in the whole file, position ignored. |
diagnostics[].code | body | object | — | Code is the checker's own identifier for the rule, a string or a number depending on the server. |
diagnostics[].message | body | string | — | Message is the problem in the server's own words, meant to be shown. |
diagnostics[].range | body | Range | — | |
diagnostics[].range.end | body | Position | — | |
diagnostics[].range.end.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
diagnostics[].range.end.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
diagnostics[].range.start | body | Position | — | |
diagnostics[].range.start.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
diagnostics[].range.start.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
diagnostics[].severity | body | integer | — | Severity is the LSP's: 1 error, 2 warning, 3 information, 4 hint. |
diagnostics[].source | body | string | — | Source is which checker reported it ("compiler", "go vet", a linter's name), which is what separates a build error from a style opinion. |
hover | body | string | — | Hover is hover's answer: the type and documentation as the language server itself renders them, so it is prose meant to be shown, not parsed. |
lang | body | string | — | Lang is the language the server that answered speaks ("go"), as the daemon reports it. |
locations | body | Location[] | — | Locations is locate's answer: where the symbol is defined, referenced, typed or implemented, per the relation asked for. |
locations[].external | body | boolean | — | External is true when the answer left the repository — the case a static index cannot answer, and the reason this service resolves through dependencies. |
locations[].path | body | string | — | Path is repo-relative while External is false, and the module coordinate ("golang.org/x/[email protected]/semver/semver.go") once it is true. |
locations[].range | body | Range | — | |
locations[].range.end | body | Position | — | |
locations[].range.end.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
locations[].range.end.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
locations[].range.start | body | Position | — | |
locations[].range.start.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
locations[].range.start.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
op | body | string | — | Op is the question that was asked: hover, locate, symbols, diagnostics or complete. |
path | body | string | — | Path is the repo-relative file the question was about, echoed back. |
repo | body | string | — | Repo is the repository the question was about, echoed back. |
rev | body | string | — | Rev is the RESOLVED commit sha, never the branch or tag that was asked for. |
symbols | body | Symbol[] | — | Symbols is symbols' answer: the file's whole outline, position ignored. |
symbols[].detail | body | string | — | Detail is the server's short elaboration, typically the signature. |
symbols[].kind | body | integer | — | Kind is the LSP SymbolKind number (5 class, 6 method, 12 function, 23 struct, …), passed through rather than translated to a word — these callers already speak… |
symbols[].name | body | string | — | Name is the declared identifier. |
symbols[].range | body | Range | — | |
symbols[].range.end | body | Position | — | |
symbols[].range.end.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
symbols[].range.end.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
symbols[].range.start | body | Position | — | |
symbols[].range.start.character | body | integer | — | Character is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index. |
symbols[].range.start.line | body | integer | — | Line is 0-BASED, per the LSP specification — one less than the line an editor shows a human. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, LspApi } from 'hanzoai';
const api = new LspApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postLspSymbols({ character: 0, line: 0 });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LspApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LspApi(client).post_lsp_symbols(character=0, line=0)cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.LspAPI.PostLspSymbols(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, lsp_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = lsp_api::post_lsp_symbols(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LspApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new LspApi(client).postLspSymbols();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/lsp/symbols \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"character": 0,
"line": 0
}'The door declares no tool for lsp — tools/list on https://api.hanzo.ai/v1/mcp names the products it does reach. Use HTTP or an SDK.
How is this guide?