Skip to main content
Glama

outgoing_calls

Analyze Svelte code to identify all functions and methods called by a specific symbol, enabling developers to trace dependencies and understand code flow within their projects.

Instructions

Find all functions/methods called by the specified symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to the file
symbolNameYesName of the symbol to find
symbolKindNoKind of symbol

Implementation Reference

  • The handler function for 'outgoing_calls' which attempts to retrieve call hierarchy information from the LSP and formats the result.
      async ({ filePath, symbolName, symbolKind }): Promise<ToolResult> => {
        try {
          const prep = await prepareSymbolRequest(lsp, filePath, symbolName, symbolKind);
          if ("error" in prep) return textResult(prep.error);
    
          // Try native call hierarchy
          try {
            const prepareResult = await lsp.request(
              "textDocument/prepareCallHierarchy",
              makePositionParams(prep.ctx)
            );
            if (Array.isArray(prepareResult) && prepareResult.length > 0) {
              const result = await lsp.request(
                "callHierarchy/outgoingCalls",
                { item: prepareResult[0] }
              );
              if (Array.isArray(result) && result.length > 0) {
                const lines: string[] = [
                  `Found ${result.length} call(s) from '${symbolName}':`,
                  "",
                ];
                for (const call of result) {
                  if (call.to) {
                    lines.push(formatHierarchyItem(call.to));
                  }
                }
                return textResult(lines.join("\n"));
              }
            }
          } catch {
            // call hierarchy not supported
          }
    
          return textResult(
            `No outgoing calls found from '${symbolName}'.`
          );
        } catch (ex) {
          return textResult(formatError(ex));
        }
      }
    );
  • Tool registration for 'outgoing_calls' including input schema definition.
    server.registerTool(
      "outgoing_calls",
      {
        title: "Outgoing Calls",
        description:
          "Find all functions/methods called by the specified 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"),
        }),
      },

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