Skip to main content
Glama

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
NameRequiredDescriptionDefault
filePathYesAbsolute path to the file
symbolNameYesName of the symbol (method/function call) to get signatures for
symbolKindNoKind of symbol

Implementation Reference

  • 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));
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adainrivers/SvelteLS.MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server