Skip to main content
Glama

get_mesh_record

Retrieve detailed cataloging information for confirmed MeSH headings, including scope notes, tree structures, parent descriptors, and cross-references to support medical subject analysis.

Instructions

Retrieve a full MeSH descriptor record including scope note (annotation), tree numbers with their top-level category letters, broader descriptors, and see-also cross-references.

Use this after search_mesh to obtain cataloging details for a confirmed MeSH heading.

Parameters

descriptor : str The MeSH UI code (e.g. "D003920") or full URI returned by search_mesh.

Returns

dict A structured record containing: - ui : MeSH unique identifier (e.g. "D003920") - uri : Full RDF URI - label : Preferred heading label - annotation : Scope note / indexing annotation (if present) - dateIntroduced : Year the heading was introduced - lastUpdated : Date the record was last updated - treeNumbers : List of tree number strings (e.g. "C18.452.394.750") - treeCategories : Top-level category letters derived from tree numbers - broader : List of {label, ui} dicts for parent descriptors - seeAlso : List of {label, ui} dicts for cross-references - qualifierCount : Number of allowable qualifiers (full list via get_mesh_qualifiers)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptorYes

Implementation Reference

  • The get_mesh_record tool definition and handler implementation which retrieves detailed MeSH record data from the NLM API.
    @mcp.tool()
    def get_mesh_record(descriptor: str) -> dict:
        """
        Retrieve a full MeSH descriptor record including scope note (annotation),
        tree numbers with their top-level category letters, broader descriptors,
        and see-also cross-references.
    
        Use this after search_mesh to obtain cataloging details for a confirmed
        MeSH heading.
    
        Parameters
        ----------
        descriptor : str
            The MeSH UI code (e.g. "D003920") or full URI returned by search_mesh.
    
        Returns
        -------
        dict
            A structured record containing:
              - ui             : MeSH unique identifier (e.g. "D003920")
              - uri            : Full RDF URI
              - label          : Preferred heading label
              - annotation     : Scope note / indexing annotation (if present)
              - dateIntroduced : Year the heading was introduced
              - lastUpdated    : Date the record was last updated
              - treeNumbers    : List of tree number strings (e.g. "C18.452.394.750")
              - treeCategories : Top-level category letters derived from tree numbers
              - broader        : List of {label, ui} dicts for parent descriptors
              - seeAlso        : List of {label, ui} dicts for cross-references
              - qualifierCount : Number of allowable qualifiers (full list via
                                 get_mesh_qualifiers)
        """
        ui = _normalise_id(descriptor)
        result = _get(f"{_BASE}/{ui}.json")
        if "error" in result:
            return result
    
        data = result["data"]
        if not isinstance(data, dict):
            return {"error": f"Unexpected response format for descriptor {ui}", "data": data}
    
        out = {
            "ui":  ui,
            "uri": data.get("@id", f"http://id.nlm.nih.gov/mesh/{ui}"),
        }
    
        # ── Label ────────────────────────────────────────────────────────────────
        out["label"] = _text(data.get("label", ui))
    
        # ── Annotation (scope note / indexing guidance) ───────────────────────
        annotation = _text(data.get("annotation", ""))
        if annotation:
            out["annotation"] = annotation
    
        # ── Dates ─────────────────────────────────────────────────────────────
        if data.get("dateIntroduced"):
            out["dateIntroduced"] = str(data["dateIntroduced"])[:4]   # year only
        if data.get("lastUpdated"):
            out["lastUpdated"] = str(data["lastUpdated"])
    
        # ── Tree numbers ──────────────────────────────────────────────────────
        # treeNumber is a list of full URIs like
        # "http://id.nlm.nih.gov/mesh/C18.452.394.750"
        # The tree number string itself is the last path segment.
        raw_trees = data.get("treeNumber", [])
        if isinstance(raw_trees, str):
            raw_trees = [raw_trees]
    
        tree_numbers = [_uri_to_id(t) for t in raw_trees if t]
        if tree_numbers:
            out["treeNumbers"] = sorted(tree_numbers)
            categories = sorted(set(tn[0] for tn in tree_numbers if tn))
            out["treeCategories"] = categories
    
        # ── Broader descriptors ───────────────────────────────────────────────
        # broaderDescriptor is a list of URI strings; resolve each to a label.
        raw_broader = data.get("broaderDescriptor", [])
        if isinstance(raw_broader, str):
            raw_broader = [raw_broader]
    
        broader = []
        for uri in raw_broader:
            b_ui  = _uri_to_id(uri)
            b_lbl = _resolve_label(b_ui)
            broader.append({"label": b_lbl, "ui": b_ui})
        if broader:
            out["broader"] = broader
    
        # ── See also ─────────────────────────────────────────────────────────
        raw_see = data.get("seeAlso", [])
        if isinstance(raw_see, str):
            raw_see = [raw_see]
    
        see_also = []
        for uri in raw_see:
            s_ui  = _uri_to_id(uri)
            s_lbl = _resolve_label(s_ui)
            see_also.append({"label": s_lbl, "ui": s_ui})
        if see_also:
            out["seeAlso"] = see_also
    
        # ── Qualifier count (hint to call get_mesh_qualifiers) ────────────────
        raw_quals = data.get("allowableQualifier", [])
        if isinstance(raw_quals, str):
            raw_quals = [raw_quals]
        out["qualifierCount"] = len(raw_quals)
    
        return out
Behavior4/5

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

With no annotations provided, the description carries the full burden. It effectively discloses the read-only retrieval nature and comprehensively documents the return structure (ui, uri, treeNumbers, etc.). Minor gap: no mention of error handling (e.g., invalid UI codes) or rate limiting, though the data structure documentation is thorough.

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?

Well-structured with clear front-loading of purpose and usage. The Returns section is lengthy, but justified given the absence of a structured output schema (Has output schema: false). The cross-references to sibling tools are efficiently integrated.

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

Completeness5/5

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

Given the rich return structure and lack of output schema/annotations, the description achieves completeness by documenting all return fields, providing parameter examples, and mapping tool relationships. Nothing critical is missing for agent invocation.

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

Parameters5/5

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

Critical compensation for 0% schema coverage. The description provides exact format ('MeSH UI code'), concrete example ('D003920'), and provenance context ('returned by search_mesh'), fully explaining the parameter semantics that the schema omits.

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?

Excellent specificity: 'Retrieve a full MeSH descriptor record' clearly states the verb and resource, and enumerates specific content included (scope note, tree numbers, broader descriptors, see-also references). The workflow distinction from search_mesh ('Use this after search_mesh') further sharpens the scope.

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?

Explicit temporal guidance ('Use this after search_mesh') establishes clear prerequisites. It also references sibling tool get_mesh_qualifiers for related functionality ('full list via get_mesh_qualifiers'), creating a clear mental model of the tool ecosystem.

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/msuicaut/mesh-mcp'

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