Skip to main content
Glama

loinc_details

Read-onlyIdempotent

Retrieve full details for a given LOINC code, including name, component, property, timing, system, scale type, and method.

Instructions

Get detailed information about a specific LOINC code.

Use this tool to:

  • Get the full name and description of a LOINC code

  • Find the component, property, timing, and system

  • Check the scale type and method

Provide a LOINC number in format "XXXXX-X" (e.g., "2339-0" for Glucose).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loinc_numYesLOINC number (e.g., "2339-0")

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
loinc_numYes
long_common_nameYes
short_nameYes
componentYes
propertyYes
time_aspectYes
systemYes
scale_typeYes
method_typeYes
classYes
statusYes

Implementation Reference

  • handleLOINCDetails - The main handler function that executes the loinc_details tool logic. Parses the input via LOINCByCodeParamsSchema, calls client.getLOINCDetails(), converts the result via loincItemToOutput() and formatLOINCDetails(), and returns a CallToolResult with both text and structured content.
    async function handleLOINCDetails(args: Record<string, unknown>): Promise<CallToolResult> {
      try {
        const params = LOINCByCodeParamsSchema.parse(args);
        const client = getNLMClient();
        const item = await client.getLOINCDetails(params.loinc_num);
    
        if (!item) {
          return {
            content: [{
              type: 'text',
              text: `LOINC code "${params.loinc_num}" not found. Please verify the code is correct.`,
            }],
            isError: true,
          };
        }
    
        const structured: LOINCDetailsOutput = loincItemToOutput(item);
    
        return {
          content: [{ type: 'text', text: formatLOINCDetails(item) }],
          structuredContent: structured,
        };
      } catch (error) {
        return handleToolError(error);
      }
    }
  • Registration of loincDetailsTool with handleLOINCDetails handler via toolRegistry.register(). This is where the loinc_details tool name becomes available in the server.
    toolRegistry.register(loincSearchTool, handleLOINCSearch);
    toolRegistry.register(loincDetailsTool, handleLOINCDetails);
  • loincDetailsTool definition - Tool object with name 'loinc_details', description, inputSchema (built from LOINCByCodeParamsSchema), outputSchema (built from LOINCDetailsOutputSchema), and read-only annotations.
    const loincDetailsTool: Tool = {
      name: 'loinc_details',
      description: `Get detailed information about a specific LOINC code.
    
    Use this tool to:
    - Get the full name and description of a LOINC code
    - Find the component, property, timing, and system
    - Check the scale type and method
    
    Provide a LOINC number in format "XXXXX-X" (e.g., "2339-0" for Glucose).`,
      inputSchema: buildInputSchema(LOINCByCodeParamsSchema),
      outputSchema: buildOutputSchema(LOINCDetailsOutputSchema),
      annotations: READ_ONLY_TOOL_ANNOTATIONS,
    };
  • loincItemToOutput - Helper function that transforms a LOINCItem from the NLM API into the structured LOINCDetailsOutput format.
    function loincItemToOutput(item: LOINCItem): LOINCDetailsOutput {
      return {
        loinc_num: item.LOINC_NUM,
        long_common_name: item.LONG_COMMON_NAME,
        short_name: item.SHORTNAME ?? '',
        component: item.COMPONENT ?? '',
        property: item.PROPERTY ?? '',
        time_aspect: item.TIME_ASPCT ?? '',
        system: item.SYSTEM ?? '',
        scale_type: item.SCALE_TYP ?? '',
        method_type: item.METHOD_TYP ?? '',
        class: item.CLASS ?? '',
        status: item.STATUS ?? '',
      };
    }
  • formatLOINCDetails - Helper function that formats a LOINCItem into a human-readable Markdown table string for the text content response.
    function formatLOINCDetails(item: LOINCItem): string {
      const lines: string[] = [];
    
      lines.push(`# ${item.LOINC_NUM} - ${item.LONG_COMMON_NAME}`);
      lines.push('');
    
      if (item.SHORTNAME) {
        lines.push(`**Short Name:** ${item.SHORTNAME}`);
      }
    
      lines.push('');
      lines.push('## Attributes');
      lines.push('');
      lines.push(`| Attribute | Value |`);
      lines.push(`|-----------|-------|`);
      lines.push(`| Component | ${item.COMPONENT || 'N/A'} |`);
      lines.push(`| Property | ${item.PROPERTY || 'N/A'} |`);
      lines.push(`| Timing | ${item.TIME_ASPCT || 'N/A'} |`);
      lines.push(`| System | ${item.SYSTEM || 'N/A'} |`);
      lines.push(`| Scale Type | ${item.SCALE_TYP || 'N/A'} |`);
      lines.push(`| Method | ${item.METHOD_TYP || 'N/A'} |`);
      lines.push(`| Class | ${item.CLASS || 'N/A'} |`);
      lines.push(`| Status | ${item.STATUS || 'Active'} |`);
    
      return lines.join('\n');
    }
Behavior5/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=true. The description adds specific behavioral context beyond annotations by detailing the information returned (full name, description, component, property, timing, system, scale type, method), confirming the read-only nature and elaborating on the output content.

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 (three short bullet-like lines plus a format instruction) and front-loaded with the primary purpose. Every sentence serves a distinct purpose: stating the main function, listing specific details obtainable, and specifying input format. No unnecessary words.

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 tool's low complexity (one parameter, output schema present), the description provides all necessary context: what the tool does, what specific details it returns, and the expected input format. The output schema likely covers return structure, so no further elaboration is needed.

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

Parameters4/5

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

The input schema covers the sole parameter 'loinc_num' with a pattern and description (100% schema coverage). The description adds value by providing a concrete example ('e.g., 2339-0 for Glucose') and clarifying the format requirement, which aids understanding beyond the schema's regex pattern.

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 'Get detailed information about a specific LOINC code' with a specific verb ('Get') and resource ('specific LOINC code'). It also lists specific outputs (full name, component, property, timing, system, scale type, method), which distinguishes it from sibling tools like loinc_search and loinc_panels that perform different operations.

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?

The description provides a clear list of use cases (e.g., 'Get the full name and description', 'Find the component, property, timing, and system') and specifies the input format ('Provide a LOINC number in format XXXX-X'). However, it lacks explicit guidance on when not to use this tool or mention of alternatives, though the sibling tools are logically distinct.

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/SidneyBissoli/medical-terminologies-mcp'

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