get_signature_help
Retrieve method signature overloads and parameter information for Svelte functions to understand how to use them correctly in your code.
Instructions
Get method signature overloads and parameter info at a symbol position.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| symbolName | Yes | Name of the symbol (method/function call) to get signatures for | |
| symbolKind | No | Kind of symbol |
Implementation Reference
- src/tools/intellisense.ts:103-187 (handler)Tool 'get_signature_help' is registered and implemented in this block, using LSP 'textDocument/signatureHelp' to retrieve and format method signatures.
server.registerTool( "get_signature_help", { title: "Get Signature Help", description: "Get method signature overloads and parameter info at a symbol position.", inputSchema: z.object({ filePath: z.string().describe("Absolute path to the file"), symbolName: z .string() .describe( "Name of the symbol (method/function call) to get signatures for" ), symbolKind: z.string().optional().describe("Kind of symbol"), }), }, 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/signatureHelp", makePositionParams(prep.ctx) ); if (!result) return textResult( `No signature help available for '${symbolName}'.` ); const signatures = result.signatures; if (!Array.isArray(signatures) || signatures.length === 0) { return textResult(`No signatures found for '${symbolName}'.`); } const activeSignature = result.activeSignature ?? 0; const activeParam = result.activeParameter ?? 0; const lines: string[] = [ `Signature(s) for '${symbolName}' (${signatures.length} overload(s)):`, "", ]; for (let i = 0; i < signatures.length; i++) { const sig = signatures[i]; const label = sig.label ?? "?"; const isActive = i === activeSignature; const sigActiveParam = sig.activeParameter ?? activeParam; lines.push(`${isActive ? " >> " : " "}${label}`); // Documentation const doc = extractMarkupContent(sig.documentation); if (doc) lines.push(` ${doc}`); // Parameters if (Array.isArray(sig.parameters) && sig.parameters.length > 0) { for (let p = 0; p < sig.parameters.length; p++) { const param = sig.parameters[p]; let paramLabel: string; if (Array.isArray(param.label)) { paramLabel = label.substring(param.label[0], param.label[1]); } else { paramLabel = param.label ?? "?"; } const paramDoc = extractMarkupContent(param.documentation); const marker = isActive && p === sigActiveParam ? "*" : " "; let entry = ` ${marker} ${paramLabel}`; if (paramDoc) entry += ` - ${paramDoc}`; lines.push(entry); } } if (i < signatures.length - 1) lines.push(""); } return textResult(lines.join("\n")); } catch (ex) { return textResult(formatError(ex)); } } );