diff --git a/src/grpc/session.rs b/src/grpc/session.rs index 02fcb8a..420f89e 100644 --- a/src/grpc/session.rs +++ b/src/grpc/session.rs @@ -484,6 +484,15 @@ you also have access to server-side tools: search_archive, search_web, research, ("list_directory", "List files and directories. Use path for the directory (default: project root) and optional depth."), ]; + // LSP tools — use path, line, column for navigation + let lsp_tools = vec![ + ("lsp_definition", "Go to the definition of the symbol at the given position. Returns file:line:column."), + ("lsp_references", "Find all references to the symbol at the given position."), + ("lsp_hover", "Get type information and documentation for the symbol at the given position."), + ("lsp_diagnostics", "Get compilation errors and warnings for a file."), + ("lsp_symbols", "List symbols in a file (document outline) or search workspace symbols. Use path for a file, or query for workspace search."), + ]; + for (name, desc) in client_tools { tools.push(mistralai_client::v1::agents::AgentTool::function( name.into(), @@ -504,6 +513,22 @@ you also have access to server-side tools: search_archive, search_web, research, )); } + for (name, desc) in lsp_tools { + tools.push(mistralai_client::v1::agents::AgentTool::function( + name.into(), + desc.into(), + serde_json::json!({ + "type": "object", + "properties": { + "path": { "type": "string", "description": "File path" }, + "line": { "type": "integer", "description": "1-based line number" }, + "column": { "type": "integer", "description": "1-based column number" }, + "query": { "type": "string", "description": "Symbol search query (for workspace symbols)" } + } + }), + )); + } + tools } diff --git a/src/orchestrator/tool_dispatch.rs b/src/orchestrator/tool_dispatch.rs index 5c38bfd..50625c2 100644 --- a/src/orchestrator/tool_dispatch.rs +++ b/src/orchestrator/tool_dispatch.rs @@ -11,6 +11,12 @@ const CLIENT_TOOLS: &[&str] = &[ "bash", "list_directory", "ask_user", + // LSP tools (client-side, future: sidecar) + "lsp_definition", + "lsp_references", + "lsp_hover", + "lsp_diagnostics", + "lsp_symbols", ]; /// Route a tool call to server or client. @@ -37,6 +43,15 @@ mod tests { assert_eq!(route("ask_user"), ToolSide::Client); } + #[test] + fn test_lsp_tools_are_client_side() { + assert_eq!(route("lsp_definition"), ToolSide::Client); + assert_eq!(route("lsp_references"), ToolSide::Client); + assert_eq!(route("lsp_hover"), ToolSide::Client); + assert_eq!(route("lsp_diagnostics"), ToolSide::Client); + assert_eq!(route("lsp_symbols"), ToolSide::Client); + } + #[test] fn test_server_tools() { assert_eq!(route("search_archive"), ToolSide::Server);