IDE Integration Tools
get_selection
#![allow(unused)] fn main() { // --- Tool definition ------------------ #[tool( description = "\ Get the currently selected text from any active editor in VSCode.\n\ Works with source files, review panels, and any other text editor.\n\ Returns null if no text is selected or no active editor is found.\ " )] async fn get_selection(&self) -> Result<CallToolResult, McpError> { }
Returns: { selectedText: string | null }
Use case: Retrieve user-selected code for analysis or modification
ide_operation
#![allow(unused)] fn main() { // --- Parameters ----------------------- #[derive(Debug, Deserialize, Serialize, schemars::JsonSchema)] struct IdeOperationParams { /// Dialect program to execute program: String, } // --- Tool definition ------------------ #[tool( description = "\ Execute IDE operations using a structured JSON mini-language.\n\ This tool provides access to VSCode's Language Server Protocol (LSP) capabilities\n\ through a composable function system.\n\ \n\ Common operations:\n\ - findDefinitions(\"MyFunction\") or findDefinition(\"MyFunction\") - list of locations where a symbol named `MyFunction` is defined\n\ - findReferences(\"MyFunction\") - list of locations where a symbol named `MyFunction` is referenced\n\ \n\ To find full guidelines for usage, use the `expand_reference` with `walkthrough-format.md`.\n\ " )] async fn ide_operation( &self, Parameters(params): Parameters<IdeOperationParams>, ) -> Result<CallToolResult, McpError> { }
Common Dialect functions:
findDefinitions("symbol")
- Find where a symbol is definedfindReferences("symbol")
- Find all uses of a symbolsearch("file.rs", "pattern")
- Search file for regex patternsearch("dir", "pattern", ".rs")
- Search directory for pattern in specific file types
Use case: Navigate code structure, find definitions, search for patterns