Skip to main content
Glama

Search clinic protocol documents

search_protocols

Search clinic protocols by keyword to obtain ranked snippets. Cite these snippets when answering to support accuracy and reference.

Instructions

Keyword search over the clinic's protocol library. Returns ranked snippets the model can cite when answering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clinic_idYes
queryYes
limitNo

Implementation Reference

  • Main handler for the search_protocols tool. Parses input (clinic_id, query, limit), tokenizes query, scores protocol docs by TF in title (3x) and body (1x), returns top hits ranked by score.
    export function searchProtocols(
      store: ClinicStore,
      raw: unknown,
    ): { hits: ProtocolHit[] } {
      const args = Args.parse(raw);
      const queryTerms = tokenize(args.query);
      if (queryTerms.length === 0) return { hits: [] };
    
      const docs = store.listProtocolDocs(args.clinic_id);
      const scored: ProtocolHit[] = [];
    
      for (const doc of docs) {
        const titleTokens = tokenize(doc.title);
        const bodyTokens = tokenize(doc.body);
        let score = 0;
        for (const term of queryTerms) {
          score += titleTokens.filter((t) => t === term).length * 3;
          score += bodyTokens.filter((t) => t === term).length;
        }
        if (score === 0) continue;
        scored.push({
          id: doc.id,
          title: doc.title,
          score,
          snippet: snippetAround(doc.body, queryTerms),
        });
      }
    
      scored.sort((a, b) => b.score - a.score);
      return { hits: scored.slice(0, args.limit) };
    }
  • Input schema for search_protocols: requires clinic_id (string) and query (1-500 chars), optional limit (1-20, default 5).
    export const searchProtocolsInput = {
      clinic_id: z.string(),
      query: z.string().min(1).max(500),
      limit: z.number().int().min(1).max(20).default(5),
    };
  • Output type for each protocol document hit: id, title, numeric score, and snippet.
    export interface ProtocolHit {
      id: string;
      title: string;
      score: number;
      snippet: string;
    }
  • src/server.ts:83-92 (registration)
    Registration of 'search_protocols' tool in the MCP server with its title, description, input schema, and handler wrapper.
    server.registerTool(
      "search_protocols",
      {
        title: "Search clinic protocol documents",
        description:
          "Keyword search over the clinic's protocol library. Returns ranked snippets the model can cite when answering.",
        inputSchema: searchProtocolsInput,
      },
      wrap((args) => searchProtocols(store, args)),
    );
  • ClinicStore helper that returns protocol documents for a given clinic, used by searchProtocols to retrieve candidate docs.
    listProtocolDocs(clinicId: string): ProtocolDoc[] {
      this.assertClinic(clinicId);
      return this.protocolDocs.filter((d) => d.clinic_id === clinicId);
    }
Behavior3/5

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

Without annotations, the description carries full burden. It discloses that the tool returns ranked snippets that can be cited, which is informative, but lacks details on side effects, authentication, or rate limits. The behavior is adequately described for a simple read-only search.

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 extremely concise with two front-loaded sentences, each adding value: it states the action and the return format. No extraneous words.

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 output schema and parameter descriptions, the description is incomplete. It does not specify return structure beyond 'snippets', nor does it clarify the role of clinic_id. The tool requires more context for reliable use.

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

Parameters1/5

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

Schema description coverage is 0% and the description does not explain any parameters (clinic_id, query, limit). The agent must infer semantics solely from the parameter names and constraints, which is insufficient.

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 tool performs keyword search over the clinic's protocol library and returns ranked snippets for citation, making its purpose distinct from sibling tools that handle appointments, escalation, slot finding, and intake recording.

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 for searching protocols via keyword, but does not provide explicit guidance on when to use this tool versus alternatives or when not to use it.

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/dominikstefanski/clinic-mcp'

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