Skip to main content
Glama

get_mesh_qualifiers

Retrieve allowable MeSH subheading qualifiers for a medical descriptor to refine subject headings in cataloging workflows.

Instructions

Retrieve the allowable subheading qualifiers for a MeSH descriptor.

MeSH qualifiers (subheadings) refine the topical focus of a heading — for example "Diabetes Mellitus/therapy" or "Neoplasms/diagnosis". Only qualifiers designated by NLM as allowable for the given descriptor are returned.

This is the MeSH equivalent of the maySubdivideGeographically check used in the cataloger MCP server for LCSH headings.

Note: The NLM public API does not expose qualifier abbreviations (e.g. /su for surgery). Use the full qualifier label when constructing headings in MARC: $a Diabetes Mellitus $x surgery.

Parameters

descriptor : str The MeSH UI code (e.g. "D003920") or full URI returned by search_mesh. include_annotations : bool If True, fetch each qualifier's .json record to include its indexing annotation. Makes up to 34 additional HTTP requests — use only when you need the annotation text for a specific qualifier. Default False.

Returns

dict Contains: - descriptor : The UI code queried - qualifierCount : Total number of allowable qualifiers - qualifiers : List of {label, ui, uri} dicts sorted alphabetically. If include_annotations=True, each dict also has an 'annotation' key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptorYes
include_annotationsNo

Implementation Reference

  • The 'get_mesh_qualifiers' function retrieves allowable subheading qualifiers for a MeSH descriptor, processes the response from the NLM API, and optionally fetches annotations for each qualifier.
    def get_mesh_qualifiers(descriptor: str, include_annotations: bool = False) -> dict:
        """
        Retrieve the allowable subheading qualifiers for a MeSH descriptor.
    
        MeSH qualifiers (subheadings) refine the topical focus of a heading —
        for example "Diabetes Mellitus/therapy" or "Neoplasms/diagnosis". Only
        qualifiers designated by NLM as allowable for the given descriptor are
        returned.
    
        This is the MeSH equivalent of the maySubdivideGeographically check used
        in the cataloger MCP server for LCSH headings.
    
        Note: The NLM public API does not expose qualifier abbreviations (e.g.
        /su for surgery). Use the full qualifier label when constructing headings
        in MARC: $a Diabetes Mellitus $x surgery.
    
        Parameters
        ----------
        descriptor : str
            The MeSH UI code (e.g. "D003920") or full URI returned by search_mesh.
        include_annotations : bool
            If True, fetch each qualifier's .json record to include its indexing
            annotation. Makes up to 34 additional HTTP requests — use only when
            you need the annotation text for a specific qualifier. Default False.
    
        Returns
        -------
        dict
            Contains:
              - descriptor     : The UI code queried
              - qualifierCount : Total number of allowable qualifiers
              - qualifiers     : List of {label, ui, uri} dicts sorted
                                 alphabetically. If include_annotations=True,
                                 each dict also has an 'annotation' key.
        """
        ui = _normalise_id(descriptor)
    
        result = _get(f"{_LOOKUP_BASE}/qualifiers", params={"descriptor": ui})
        if "error" in result:
            return result
    
        raw = result["data"]
        if not isinstance(raw, list):
            return {"error": "Unexpected response format from NLM qualifiers endpoint", "data": raw}
    
        qualifiers = []
        for item in raw:
            q_uri   = item.get("resource", "")
            q_label = item.get("label", "")
            q_ui    = _uri_to_id(q_uri) if q_uri else ""
    
            entry = {"label": q_label, "ui": q_ui, "uri": q_uri}
    
            if include_annotations and q_ui:
                ann_result = _get(f"{_BASE}/{q_ui}.json")
                if "data" in ann_result:
                    ann_text = _text(ann_result["data"].get("annotation", ""))
                    if ann_text:
                        entry["annotation"] = ann_text
    
            qualifiers.append(entry)
    
        qualifiers.sort(key=lambda x: x["label"])
    
        return {
            "descriptor":     ui,
            "qualifierCount": len(qualifiers),
            "qualifiers":     qualifiers,
        }
Behavior5/5

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

Excellent disclosure given no annotations exist. It explicitly warns about performance costs ('Makes up to 34 additional HTTP requests'), documents API limitations ('NLM public API does not expose qualifier abbreviations'), and details the exact return structure including optional keys, providing necessary behavioral context beyond what annotations would typically cover.

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?

Structured clearly with Parameters/Returns sections. While lengthy, every sentence serves a purpose given the lack of schema documentation and output schema. The technical details (MARC formatting, HTTP request counts) are essential for correct usage, justifying the length despite the density.

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?

Thoroughly complete for a tool with no output schema and no annotations. It documents the return dictionary structure, explains domain-specific concepts (MeSH qualifiers vs. headings), provides usage constraints, and includes practical cataloging guidance (MARC subfield construction).

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?

With 0% schema description coverage (only titles provided), the description fully compensates by documenting both parameters in detail: descriptor includes format examples ('D003920') and provenance ('returned by search_mesh'), while include_annotations explains the side effects, cost, and default value.

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 opens with the specific action and resource ('Retrieve the allowable subheading qualifiers for a MeSH descriptor') and distinguishes from siblings by focusing narrowly on qualifiers/subheadings versus records or trees. It clarifies the domain-specific concept with concrete examples ('Diabetes Mellitus/therapy').

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

Usage Guidelines4/5

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

Provides clear workflow context by noting the descriptor parameter can be 'returned by search_mesh', establishing a tool chain. It explicitly warns when to use the include_annotations flag ('use only when you need the annotation text'). However, it does not explicitly contrast with siblings get_mesh_record or get_mesh_tree to clarify when to prefer this tool over those 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/msuicaut/mesh-mcp'

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