get_hover
Retrieve documentation and type information for Svelte symbols to understand code functionality and structure during development.
Instructions
Get hover documentation and type info for a symbol.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| symbolName | Yes | Name of the symbol to find | |
| symbolKind | No | Kind of symbol |
Implementation Reference
- src/tools/navigation.ts:100-125 (handler)The handler function for the get_hover tool, which prepares the symbol request and calls the LSP's textDocument/hover method.
async ({ filePath, symbolName, symbolKind }): Promise<ToolResult> => { try { const prep = await prepareSymbolRequest(lsp, filePath, symbolName, symbolKind); if ("error" in prep) return textResult(prep.error); const result = await lsp.request( "textDocument/hover", makePositionParams(prep.ctx) ); if (!result) return textResult("No hover information available."); const contents = result.contents; if (!contents) return textResult("No hover information available."); if (typeof contents === "string") return textResult(contents); if (contents.value) return textResult(contents.value); if (Array.isArray(contents)) { const parts: string[] = []; for (const item of contents) { if (typeof item === "string") parts.push(item); else if (item.value) parts.push(item.value); } return textResult(parts.join("\n")); } - src/tools/navigation.ts:88-99 (registration)The registration of the get_hover tool in the MCP server, including its schema and metadata.
server.registerTool( "get_hover", { title: "Get Hover Info", description: "Get hover documentation and type info for a symbol.", inputSchema: z.object({ filePath: z.string().describe("Absolute path to the file"), symbolName: z.string().describe("Name of the symbol to find"), symbolKind: z.string().optional().describe("Kind of symbol"), }), },