Skip to main content
Glama

tanstack_search_docs

Search TanStack documentation using a query string. Retrieve matching pages with titles, URLs, and breadcrumbs. Filter results by library or framework.

Instructions

Search across TanStack documentation for a query string. Returns matching pages with titles, URLs, and breadcrumbs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (e.g. 'server functions', 'loaders', 'mutations')
libraryNoFilter to a specific library (e.g. start, router, query)
frameworkNoFilter to a specific framework (e.g. react, vue, solid)
limitNoMax results to return (default 10, max 50)

Implementation Reference

  • src/index.ts:239-269 (registration)
    Registration of the tanstack_search_docs tool via server.tool() with name, description, Zod schema, and handler function.
    // 6. tanstack_search_docs
    server.tool(
      "tanstack_search_docs",
      "Search across TanStack documentation for a query string. Returns matching pages with titles, URLs, and breadcrumbs.",
      {
        query: z.string().describe("Search query (e.g. 'server functions', 'loaders', 'mutations')"),
        library: z
          .string()
          .optional()
          .describe("Filter to a specific library (e.g. start, router, query)"),
        framework: z
          .string()
          .optional()
          .describe("Filter to a specific framework (e.g. react, vue, solid)"),
        limit: z
          .number()
          .min(1)
          .max(50)
          .optional()
          .describe("Max results to return (default 10, max 50)"),
      },
      async ({ query, library, framework, limit }) => {
        const args = ["search-docs", query, "--json"];
        if (library) args.push("--library", library);
        if (framework) args.push("--framework", framework);
        if (limit) args.push("--limit", String(limit));
    
        const { stdout } = await runCli(args);
        return jsonResult(parseJsonOutput(stdout));
      },
    );
  • The async handler function for tanstack_search_docs. It builds CLI args (search-docs, query, optional --library, --framework, --limit), runs the CLI via runCli, parses JSON output, and returns it.
    async ({ query, library, framework, limit }) => {
      const args = ["search-docs", query, "--json"];
      if (library) args.push("--library", library);
      if (framework) args.push("--framework", framework);
      if (limit) args.push("--limit", String(limit));
    
      const { stdout } = await runCli(args);
      return jsonResult(parseJsonOutput(stdout));
    },
  • Zod schema for tanstack_search_docs inputs: query (required string), library (optional string), framework (optional string), limit (optional number, min 1, max 50).
    {
      query: z.string().describe("Search query (e.g. 'server functions', 'loaders', 'mutations')"),
      library: z
        .string()
        .optional()
        .describe("Filter to a specific library (e.g. start, router, query)"),
      framework: z
        .string()
        .optional()
        .describe("Filter to a specific framework (e.g. react, vue, solid)"),
      limit: z
        .number()
        .min(1)
        .max(50)
        .optional()
        .describe("Max results to return (default 10, max 50)"),
    },
  • runCli helper function that executes @tanstack/cli via npx with provided args, used by the tool handler to run 'search-docs' commands.
    async function runCli(
      args: string[],
      timeoutMs = 60_000,
    ): Promise<{ stdout: string; stderr: string }> {
      const { stdout, stderr } = await execFileAsync(
        TANSTACK_CLI,
        [...TANSTACK_ARGS, ...args],
        {
          timeout: timeoutMs,
          maxBuffer: 10 * 1024 * 1024, // 10 MB
          env: { ...process.env, NO_COLOR: "1" },
        },
      );
      return { stdout: stdout.trim(), stderr: stderr.trim() };
    }
  • parseJsonOutput helper used by the tool to extract and parse JSON from CLI stdout.
    function parseJsonOutput(stdout: string): unknown {
      // The CLI may print warnings before the JSON blob – find the first { or [
      const jsonStart = stdout.search(/[\[{]/);
      if (jsonStart === -1) {
        throw new Error(`CLI returned non-JSON output:\n${stdout}`);
      }
      return JSON.parse(stdout.slice(jsonStart));
    }
Behavior4/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It explains that the tool returns 'matching pages with titles, URLs, and breadcrumbs', which is useful. However, it does not disclose other behaviors such as whether it is read-only, whether authentication is needed, or any rate limits. For a simple search tool, the description is reasonably transparent but could be improved.

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 sentence with 15 words, containing no extraneous information. It front-loads the action and clearly states the output. Every word earns its place.

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

Completeness4/5

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

Given no output schema, the description explains what is returned (titles, URLs, breadcrumbs), which partially covers completeness. However, it does not mention relevance ranking, default behavior of filters, or whether results are from all libraries. For a search tool with 4 parameters and no output schema, the description provides adequate but not exhaustive context.

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 for all 4 parameters, so the schema already documents each parameter's meaning. The tool description adds no extra semantic value beyond the schema. Baseline score of 3 is appropriate given high schema coverage.

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 verb 'Search' and resource 'TanStack documentation', specifying the output includes titles, URLs, and breadcrumbs. This distinguishes it from sibling tools like 'tanstack_doc' which likely retrieves a specific document, and 'tanstack_ecosystem' which provides an overview.

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 does not explicitly state when to use this tool versus alternatives. It only describes what it does, not when it's appropriate or when not to use it. Implied usage is for broad searches, but no guidance on exclusions or comparisons to siblings like 'tanstack_doc' or 'listTanStackAddOns'.

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/zPeppOz/tanstack-mcp'

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