Skip to main content
Glama

mockzilla_docs_search

Search Mockzilla documentation by keyword to retrieve top-scoring sections with topic, heading, and snippet. Use this to verify syntax or features before answering.

Instructions

Search the mockzilla docs by keyword. Returns the top-scoring sections {topic, heading, snippet} so you can identify which topic to read in full. Use this BEFORE answering questions about mockzilla syntax, conventions, or features you're not 100% sure of — the docs are the source of truth, your training is not.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesFree-text query, e.g. 'static directory layout'.
limitNo

Implementation Reference

  • Handler function for mockzilla_docs_search. Tokenizes the query, iterates all doc topics, splits them into sections (by ## headings), scores each section, and returns the top-scoring results with topic, heading, snippet, and score.
    export async function searchDocs(args) {
      const query = args.query;
      if (typeof query !== "string" || query.trim().length === 0) {
        throw new Error("`query` must be a non-empty string");
      }
      const limit = Math.min(Math.max(parseInt(args.limit, 10) || 5, 1), 20);
      const tokens = tokenize(query);
      if (tokens.length === 0) {
        throw new Error("`query` produced no searchable tokens");
      }
    
      const { topics } = await topicsList();
      const sections = [];
      for (const topic of topics) {
        let text;
        try {
          text = await loadTopicText(topic);
        } catch {
          continue; // skip unreadable topics
        }
        sections.push(...sectionsOf(topic, text));
      }
    
      const scored = sections
        .map((s) => ({ ...s, score: scoreSection(s, tokens) }))
        .filter((s) => s.score > 0)
        .sort((a, b) => b.score - a.score)
        .slice(0, limit)
        .map((s) => ({
          topic: s.topic,
          heading: s.heading,
          snippet: snippetForQuery(s.body, tokens),
          score: s.score,
        }));
    
      return { query, results: scored };
    }
  • Registration and input schema for mockzilla_docs_search. Defines the description, inputSchema (query as string, limit as integer 1-20 default 5), and maps to the searchDocs handler.
    mockzilla_docs_search: {
      description:
        "Search the mockzilla docs by keyword. Returns the top-scoring " +
        "sections {topic, heading, snippet} so you can identify which " +
        "topic to read in full. Use this BEFORE answering questions about " +
        "mockzilla syntax, conventions, or features you're not 100% sure " +
        "of — the docs are the source of truth, your training is not.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Free-text query, e.g. 'static directory layout'.",
          },
          limit: {
            type: "integer",
            minimum: 1,
            maximum: 20,
            default: 5,
          },
        },
        required: ["query"],
        additionalProperties: false,
      },
      handler: searchDocs,
    },
  • lib/tools.js:19-19 (registration)
    The LOCAL_TOOLS object exported from lib/tools.js is the tool registration registry. It contains mockzilla_docs_search among other tools.
    export const LOCAL_TOOLS = {
  • Helper to split markdown text into sections by ## headings. Used by searchDocs to create sections for scoring.
    function sectionsOf(topic, text) {
      const lines = text.split("\n");
      const sections = [];
      let current = { topic, heading: "(intro)", body: [] };
    
      for (const line of lines) {
        const m = line.match(/^##+\s+(.*)$/);
        if (m) {
          if (current.body.length > 0 || current.heading !== "(intro)") {
            sections.push({ ...current, body: current.body.join("\n").trim() });
          }
          current = { topic, heading: m[1].trim(), body: [] };
        } else {
          current.body.push(line);
        }
      }
      if (current.body.length > 0 || current.heading !== "(intro)") {
        sections.push({ ...current, body: current.body.join("\n").trim() });
      }
      return sections;
    }
  • Helper to extract a brief snippet (~3 lines) around the first line that matches any search token. Used by searchDocs for each result.
    function snippetForQuery(body, tokens) {
      const lines = body.split("\n");
      let bestIdx = 0;
      for (let i = 0; i < lines.length; i++) {
        const lower = lines[i].toLowerCase();
        if (tokens.some((t) => lower.includes(t))) {
          bestIdx = i;
          break;
        }
      }
      const start = Math.max(0, bestIdx - 1);
      const end = Math.min(lines.length, bestIdx + 4);
      const snippet = lines.slice(start, end).join("\n").trim();
      return snippet.length > 600 ? `${snippet.slice(0, 600)}…` : snippet;
    }
Behavior4/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 transparently describes the output format (topic, heading, snippet) and implies read-only behavior via 'search' and 'identify which topic to read'. However, it does not explicitly state it has no side effects or require authentication, which is acceptable for a search tool.

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?

Two sentences, zero waste. First sentence states action and result format. Second sentence provides usage guidance. Perfectly front-loaded.

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 the tool has no output schema, the description adequately explains what is returned (topic, heading, snippet). It also provides usage context (use before answering). Could mention that limit controls the number of results, but that is partly in the schema. Overall complete for a search tool.

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 50%: query is described well in the schema ('Free-text query...'), but limit lacks a description. The tool description adds no additional parameter context beyond the schema. The limit parameter is somewhat self-explanatory with min/max/default, but the description could have clarified its role (e.g., 'number of top results to return').

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 it searches docs by keyword and returns top-scoring sections with topic, heading, snippet. It distinguishes from siblings like mockzilla_docs_read (which reads full topics) and mockzilla_docs_topics (which lists topics) by focusing on search. The verb 'search' and resource 'mockzilla docs' are specific.

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

Usage Guidelines5/5

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

Explicitly advises to use this tool BEFORE answering questions about mockzilla syntax, conventions, or features when uncertain, stating 'the docs are the source of truth, your training is not'. This provides clear context for when to use vs. relying on memory, though it does not explicitly mention alternatives.

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/mockzilla/mockzilla-mcp'

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