Skip to main content
Glama

Find Workspace Symbols

find_workspace_symbols

Search for Svelte symbols across your entire workspace to quickly locate components, functions, and variables. Filter results by path or regex to find specific code elements.

Instructions

Search for symbols across the entire workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for the symbol name
pathFilterNoOptional path filter (case-insensitive substring match)
filterNoOptional regex filter on symbol names
limitNoMax results to return. Default: 50

Implementation Reference

  • Tool registration for "find_workspace_symbols" in src/tools/navigation.ts.
    server.registerTool(
      "find_workspace_symbols",
      {
        title: "Find Workspace Symbols",
        description:
          "Search for symbols across the entire workspace.",
        inputSchema: z.object({
          query: z.string().describe("Search query for the symbol name"),
          pathFilter: z
            .string()
            .optional()
            .describe(
              "Optional path filter (case-insensitive substring match)"
            ),
          filter: z
            .string()
            .optional()
            .describe("Optional regex filter on symbol names"),
          limit: z
            .number()
            .default(50)
            .describe("Max results to return. Default: 50"),
        }),
      },
  • Handler implementation for "find_workspace_symbols" in src/tools/navigation.ts.
    async ({ query, pathFilter, filter, limit }): Promise<ToolResult> => {
      try {
        const result = await lsp.request("workspace/symbol", { query });
    
        if (!Array.isArray(result) || result.length === 0) {
          return textResult(`No symbols matching '${query}' found.`);
        }
    
        const filterRegex = filter ? new RegExp(filter, "i") : null;
        const lines: string[] = [];
        let shown = 0;
        let matched = 0;
        let total = 0;
    
        for (const sym of result) {
          const name = sym.name ?? "?";
          const kind = symbolKindName(sym.kind ?? 0);
          const container = sym.containerName ?? "";
          const loc = sym.location;
          const path = loc?.uri ? uriToPath(loc.uri) : "?";
          const line = (loc?.range?.start?.line ?? 0) + 1;
    
          if (
            pathFilter &&
            !path.toLowerCase().includes(pathFilter.toLowerCase())
          )
            continue;
    
          total++;
          if (filterRegex && !filterRegex.test(name)) continue;
          matched++;
          if (shown >= limit) continue;
    
          const containerSuffix =
            container.length > 0 ? ` [${container}]` : "";
          lines.push(`  ${name} (${kind})${containerSuffix} - ${path}:${line}`);
          shown++;
        }
    
        if (shown === 0) {
          return textResult(
            `No symbols matching '${query}' found` +
              (filter ? ` with filter '${filter}'` : "") +
              (pathFilter ? ` in paths matching '${pathFilter}'` : "") +
              "."
          );
        }
    
        let header = "Found ";
        if (filter) {
          header +=
            shown < matched
              ? `${shown} of ${matched} symbol(s) matching '${filter}'`
              : `${matched} symbol(s) matching '${filter}'`;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on permissions, rate limits, error handling, or output format. It doesn't clarify what 'symbols' entail (e.g., functions, variables) or how results are structured, which is insufficient for a tool with potential complexity.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse 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 lack of annotations and output schema, the description is incomplete for a search tool with four parameters. It doesn't explain what 'symbols' are, how results are returned, or any behavioral traits like pagination or error cases, leaving significant gaps for the agent to navigate.

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?

The description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage with clear descriptions for all four parameters. This meets the baseline score of 3, as the schema adequately documents the parameters without needing extra explanation in the description.

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

Purpose4/5

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

The description clearly states the action ('Search for symbols') and scope ('across the entire workspace'), which is specific and distinguishes it from sibling tools like 'find_document_symbols' that might search within a single document. However, it doesn't explicitly differentiate from other symbol-related tools like 'find_definition' or 'find_references', keeping it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'find_document_symbols' or 'find_definition'. It lacks any mention of prerequisites, exclusions, or specific contexts where this tool is preferred, leaving the agent to infer usage from the tool name alone.

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