Skip to main content
Glama

search_mesh

Find standardized biomedical terms, tree numbers, and scope notes in the Medical Subject Headings (MeSH) vocabulary for precise literature searches.

Instructions

Search the Medical Subject Headings (MeSH) vocabulary. Useful for finding standardized biomedical terms, tree numbers, and scope notes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesMeSH term search query
max_resultsNoMaximum results

Implementation Reference

  • The main handler function searchMesh that implements the search_mesh tool logic. It searches the MeSH database using esearch.fcgi, fetches summaries with esummary.fcgi, and returns formatted results including term names, scope notes, and tree numbers.
    export async function searchMesh(args: z.infer<typeof searchMeshSchema>): Promise<string> {
      const searchResult = await client.fetchJson("esearch.fcgi", {
        db: "mesh",
        term: args.query,
        retmax: String(args.max_results),
      }) as { esearchresult: { idlist: string[]; count: string } };
    
      const ids = searchResult.esearchresult.idlist;
      if (ids.length === 0) {
        return JSON.stringify({ total_count: 0, terms: [] }, null, 2);
      }
    
      // Fetch MeSH summaries
      const summaryResult = await client.fetchJson("esummary.fcgi", {
        db: "mesh",
        id: ids.join(","),
        version: "2.0",
      }) as { result?: Record<string, unknown> };
    
      const terms: Array<Record<string, unknown>> = [];
      if (summaryResult.result) {
        for (const id of ids) {
          const entry = summaryResult.result[id] as Record<string, unknown> | undefined;
          if (entry) {
            terms.push({
              uid: id,
              name: entry.ds_meshterms || entry.ds_meshui || id,
              scope_note: entry.ds_scopenote || "",
              tree_numbers: entry.ds_treenumberlist || [],
            });
          }
        }
      }
    
      return JSON.stringify({
        total_count: parseInt(searchResult.esearchresult.count),
        showing: terms.length,
        terms,
      }, null, 2);
    }
  • The searchMeshSchema Zod schema defining the input validation for search_mesh tool, with query (string) and max_results (number 1-50, default 10) parameters.
    export const searchMeshSchema = z.object({
      query: z.string().describe("MeSH term search query"),
      max_results: z.number().min(1).max(50).default(10).describe("Maximum results"),
    });
  • src/index.ts:61-68 (registration)
    Tool registration where search_mesh is registered with the MCP server, including its description and the handler binding to searchMesh function.
    server.tool(
      "search_mesh",
      "Search the Medical Subject Headings (MeSH) vocabulary. Useful for finding standardized biomedical terms, tree numbers, and scope notes.",
      searchMeshSchema.shape,
      async (args) => ({
        content: [{ type: "text", text: await searchMesh(searchMeshSchema.parse(args)) }],
      })
    );
Behavior2/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 mentions what the tool does but lacks behavioral details such as whether it's read-only or mutative, any rate limits, authentication needs, or response format. For a search tool with no annotations, this is a significant gap in disclosing operational traits.

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 appropriately sized with two sentences that are front-loaded and efficient. The first sentence states the core purpose, and the second adds useful context without redundancy, making it concise and well-structured.

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 (search functionality with 2 parameters), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects, output format, and usage guidelines, making it inadequate for an AI agent to fully understand how to invoke and interpret results.

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 100%, so the schema already documents both parameters ('query' and 'max_results') with descriptions and constraints. The description does not add any parameter-specific information beyond what the schema provides, such as examples or additional context, meeting the baseline for high schema coverage.

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 verb ('Search') and resource ('Medical Subject Headings (MeSH) vocabulary'), making the purpose evident. It specifies the type of vocabulary and mentions what can be found (standardized biomedical terms, tree numbers, scope notes), though it doesn't explicitly differentiate from sibling tools like 'search_articles' beyond the resource focus.

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 includes 'Useful for finding standardized biomedical terms...' which implies a general context but provides no explicit guidance on when to use this tool versus alternatives like 'search_articles' or other siblings. There are no when-to-use or when-not-to-use statements, leaving usage unclear relative to other tools.

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/PetrefiedThunder/mcp-pubmed'

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