Skip to main content
Glama

search_docs

Search Vega-Lite documentation to find information about charts, encodings, marks, and visualization specifications.

Instructions

Search through Vega-Lite documentation for information about charts, encodings, marks, and more

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (e.g., 'bar chart', 'color encoding', 'scale domain')

Implementation Reference

  • Main handler function that loads and searches documentation from JSON files (Vega-Lite and Deneb) or uses fallback data, performs fuzzy matching, sorts by relevance, and returns top 10 results.
    export async function searchDocs(query: string): Promise<SearchResult> {
      const vegaLitePath = path.join(__dirname, "..", "data", "documentation.json");
      const denebPath = path.join(__dirname, "..", "data", "deneb-documentation.json");
    
      let allDocs: DocSection[] = [];
      const sources: string[] = [];
    
      try {
        // Try to load Vega-Lite documentation
        const vegaLiteData = await fs.readFile(vegaLitePath, "utf-8");
        const vegaLiteDocs: DocSection[] = JSON.parse(vegaLiteData);
        vegaLiteDocs.forEach(doc => doc.source = 'vega-lite');
        allDocs = allDocs.concat(vegaLiteDocs);
        sources.push('vega-lite');
      } catch (error) {
        // Vega-Lite docs not available, will use fallback
      }
    
      try {
        // Try to load Deneb documentation
        const denebData = await fs.readFile(denebPath, "utf-8");
        const denebDocs: DocSection[] = JSON.parse(denebData);
        denebDocs.forEach(doc => doc.source = 'deneb');
        allDocs = allDocs.concat(denebDocs);
        sources.push('deneb');
      } catch (error) {
        // Deneb docs not available, will use fallback
      }
    
      // If no docs loaded, use fallback
      if (allDocs.length === 0) {
        return getFallbackDocs(query);
      }
    
      // Simple text search (case-insensitive)
      const lowerQuery = query.toLowerCase();
      const results = allDocs.filter((doc) => {
        return (
          doc.title.toLowerCase().includes(lowerQuery) ||
          doc.content.toLowerCase().includes(lowerQuery) ||
          doc.category.toLowerCase().includes(lowerQuery)
        );
      });
    
      // Sort by relevance (simple: title matches first, then content matches)
      results.sort((a, b) => {
        const aTitle = a.title.toLowerCase().includes(lowerQuery);
        const bTitle = b.title.toLowerCase().includes(lowerQuery);
        if (aTitle && !bTitle) return -1;
        if (!aTitle && bTitle) return 1;
        return 0;
      });
    
      return {
        results: results.slice(0, 10), // Return top 10 results
        query,
        totalResults: results.length,
        sources,
      };
    }
  • Tool schema definition including name, description, and input schema (requires 'query' string) returned by ListTools handler.
    {
      name: "search_docs",
      description: "Search through Vega-Lite documentation for information about charts, encodings, marks, and more",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query (e.g., 'bar chart', 'color encoding', 'scale domain')",
          },
        },
        required: ["query"],
        additionalProperties: false,
      },
    },
  • src/index.ts:105-118 (registration)
    Dispatch handler in CallToolRequest that validates input, calls searchDocs, and formats response as JSON text content.
    case "search_docs": {
      if (!args?.query) {
        throw new Error("Query parameter is required");
      }
      const results = await searchDocs(args.query as string);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • TypeScript interface defining the output structure of the searchDocs function.
    interface SearchResult {
      results: DocSection[];
      query: string;
      totalResults: number;
      sources: string[]; // Which sources were searched
  • TypeScript interface defining the structure of individual documentation sections used in search.
    interface DocSection {
      title: string;
      url: string;
      content: string;
      category: string;
      source?: string; // 'vega-lite' or 'deneb'
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches documentation but doesn't describe how results are returned (e.g., format, pagination), potential limitations (e.g., search scope, rate limits), or error handling. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/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 appropriately sized for a simple tool, though it could be slightly more structured by front-loading key details like the resource name earlier.

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 tool's complexity (a search function with one parameter) and lack of annotations and output schema, the description is incomplete. It doesn't explain what the search returns (e.g., links, snippets, full text), how results are formatted, or any behavioral traits like search limitations. For a tool with no structured output information, more context is needed to be fully helpful.

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 input schema has 100% description coverage, with the 'query' parameter documented as 'Search query (e.g., 'bar chart', 'color encoding', 'scale domain')'. The description adds minimal value beyond this, only implying the query is for Vega-Lite topics. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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 tool's purpose: 'Search through Vega-Lite documentation for information about charts, encodings, marks, and more.' It specifies the verb ('Search') and resource ('Vega-Lite documentation'), and mentions the types of content covered. However, it doesn't explicitly differentiate from sibling tools like 'get_example' or 'get_schema_info', which might also retrieve documentation-related information.

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. It doesn't mention when to choose 'search_docs' over sibling tools such as 'get_example' (which might fetch specific examples) or 'get_schema_info' (which could provide schema details), nor does it specify any prerequisites or exclusions for its use.

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/inteligencianegociosmmx/vegaLite_mcp_server'

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