Skip to main content
Glama

Get Component References

get_component_references

Find all files that import or use a specific Svelte component to track dependencies and analyze component usage across your project.

Instructions

Find all files that use/import a Svelte component.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to the .svelte component file

Implementation Reference

  • The implementation and registration of the 'get_component_references' tool. The handler function calls the LSP server method '$/getComponentReferences'.
    server.registerTool(
      "get_component_references",
      {
        title: "Get Component References",
        description:
          "Find all files that use/import a Svelte component.",
        inputSchema: z.object({
          filePath: z
            .string()
            .describe("Absolute path to the .svelte component file"),
        }),
      },
      async ({ filePath }): Promise<ToolResult> => {
        try {
          const uri = pathToUri(filePath);
    
          const result = await lsp.request("$/getComponentReferences", uri);
    
          if (!result || !Array.isArray(result) || result.length === 0) {
            return textResult(
              `No references found for component ${basename(filePath)}.`
            );
          }
    
          return textResult(
            formatLocations(result, "component reference")
          );
        } catch (ex) {
          // This endpoint may not be available
          if (
            String(ex).includes("Unhandled method") ||
            String(ex).includes("not supported")
          ) {
            return textResult(
              "$/getComponentReferences is not supported by this version of svelteserver."
            );
          }
          return textResult(formatError(ex));
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions the tool 'finds' files, implying a read-only operation, but lacks details on behavioral traits such as search scope (workspace vs. directory), output format, performance considerations, or error handling. The description is minimal and does not adequately compensate for the absence of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It front-loads the core purpose ('Find all files that use/import a Svelte component') without unnecessary elaboration, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of annotations and output schema, the description is incomplete for a tool with potential complexity (e.g., file searching). It does not address return values, error cases, or operational constraints. While concise, it lacks sufficient context to fully guide an agent in using the tool effectively beyond its basic purpose.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'filePath' documented as 'Absolute path to the .svelte component file'. The description adds no additional parameter semantics beyond what the schema provides, such as path format examples or validation rules. Baseline score of 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Find all files') and target resource ('that use/import a Svelte component'), distinguishing it from siblings like 'find_references' (general references) or 'get_file_references' (file-level references). It precisely communicates the tool's specialized scope for Svelte component dependencies.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (finding component imports in files) but does not explicitly state when to use this tool versus alternatives like 'find_references' or 'get_file_references'. No guidance is provided on prerequisites, exclusions, or specific scenarios where this tool is preferred over siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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