<!-- rye:signed:2026-03-17T01:43:05Z:f546b5f6421d47d19963c045c036f98a43070b2b55ca349751074feb7b8ed4f3:8KZu_0_7VMvKjcXm29F_n5gKTm-MiHZVpNrQPbDoSBUg0TqsdKbwqTkHAKFNtpA9UIWuH_qdsdBRyMeRAIIVBQ==:6ea18199041a1ea8 -->
<!-- rye:unsigned -->
# LSP Query

Query language servers — go to definition, find references, hover info, document symbols, and more.

```xml
<directive name="lsp" version="1.0.0">
  <metadata>
    <description>Query language servers — go to definition, find references, hover info, document symbols, and more.</description>
    <category>rye/code</category>
    <author>rye-os</author>
    <model tier="fast" />
    <limits turns="3" tokens="4096" />
    <permissions>
      <execute>
        <tool>rye.code.lsp.*</tool>
      </execute>
    </permissions>
  </metadata>

  <inputs>
    <input name="operation" type="string" required="true">LSP operation: goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol, goToImplementation, prepareCallHierarchy, incomingCalls, outgoingCalls</input>
    <input name="file_path" type="string" required="true">Path to the file</input>
    <input name="line" type="integer" required="true">Line number (1-based)</input>
    <input name="character" type="integer" required="true">Character offset (1-based)</input>
    <input name="timeout" type="integer" required="false">Timeout in seconds (default: 15)</input>
  </inputs>

  <outputs>
    <output name="result">LSP operation results (locations, symbols, hover info, etc.)</output>
  </outputs>
</directive>
```

<process>
  <step name="validate_inputs">
    Validate that {input:operation}, {input:file_path}, {input:line}, and {input:character} are all provided.
  </step>

  <step name="run_lsp">
    Call the LSP tool with the provided parameters.
    `rye_execute(item_type="tool", item_id="rye/code/lsp/lsp", parameters={"operation": "{input:operation}", "file_path": "{input:file_path}", "line": "{input:line}", "character": "{input:character}", "timeout": "{input:timeout}"})`
  </step>

  <step name="return_result">
    Return output as {output:result}.
  </step>
</process>
