Skip to main content
Glama

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
NameRequiredDescriptionDefault
filePathYesAbsolute path to the file
symbolNameYesName of the symbol to find
symbolKindNoKind of symbol

Implementation Reference

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

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