Skip to main content
Glama

lookup_rejection_code

Look up Taiwan NHI rejection codes (5-character) to retrieve severity, category, and official Chinese description. Resolve payment denials using data sourced from 健保署.

Instructions

Look up a Taiwan NHI rejection code (5-character, e.g. '0317A'). Returns severity, category, and the official Chinese description. Data is sourced from 健保署 專業審查不予支付理由代碼 and maintained by OPDSTAR (https://opdstar.com).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes5-character NHI rejection code, e.g. '0317A', '0338A'

Implementation Reference

  • The async handler function that executes the lookup_rejection_code tool logic. It validates the 'code' parameter, makes an HTTP GET request to '/lookup-rejection-code' via the client, and returns the result.
    export async function runLookupRejectionCode(
      client: OpdstarClient,
      args: LookupRejectionCodeArgs
    ): Promise<LookupRejectionCodeResult> {
      if (!args || typeof args.code !== 'string') {
        throw new Error('Missing required parameter: code');
      }
      const result = (await client.get('/lookup-rejection-code', {
        code: args.code.trim().toUpperCase(),
      })) as LookupRejectionCodeResult;
      return result;
    }
  • TypeScript interface defining the input arguments — requires a single 'code' string.
    export interface LookupRejectionCodeArgs {
      code: string;
    }
  • TypeScript interface defining the shape of the lookup result, including optional fields like description, severity, category, etc.
    export interface LookupRejectionCodeResult {
      code: string;
      found?: boolean;
      description?: string;
      severity?: 'critical' | 'warning';
      category?: string;
      category_name?: string;
      opdstar_relevant?: boolean;
      source_url?: string;
      message?: string;
    }
  • Tool definition object with name, description, and JSON Schema input validation that validates a 5-character code pattern (e.g., '0317A').
    export const LOOKUP_REJECTION_CODE_DEF = {
      name: 'lookup_rejection_code',
      description:
        "Look up a Taiwan NHI rejection code (5-character, e.g. '0317A'). Returns severity, category, and the official Chinese description. Data is sourced from 健保署 專業審查不予支付理由代碼 and maintained by OPDSTAR (https://opdstar.com).",
      inputSchema: {
        type: 'object',
        properties: {
          code: {
            type: 'string',
            description: "5-character NHI rejection code, e.g. '0317A', '0338A'",
            pattern: '^[0-9]{4}[A-Z]$',
          },
        },
        required: ['code'],
      },
    } as const;
  • src/index.ts:47-54 (registration)
    Registration of the tool definition in the ListTools handler so the MCP server advertises it.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        LOOKUP_REJECTION_CODE_DEF,
        GET_PROCEDURES_FOR_ICD_DEF,
        GET_INDICATOR_DEF,
        SEARCH_NHI_WIKI_DEF,
      ],
    }));
  • Dispatch in the CallTool request handler that routes the 'lookup_rejection_code' tool name to its implementation function.
    case 'lookup_rejection_code':
      result = await runLookupRejectionCode(client, args as never);
Behavior4/5

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

The description reveals the data source (健保署, maintained by OPDSTAR) and the return fields (severity, category, official Chinese description). For a read-only lookup with no annotations, it provides sufficient transparency about behavior and output, though it could mention that no side effects occur.

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?

Two sentences: first sentence encapsulates purpose and output, second sentence states data provenance. No redundant words; information is front-loaded and efficient.

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

Completeness4/5

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

For a simple 1-parameter tool without output schema or annotations, the description covers purpose, parameter format, return fields, and data source. It is sufficiently complete for an agent to correctly invoke the tool.

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 coverage is 100% and already provides the parameter description, pattern, and example. The description adds minor context (e.g., '5-character NHI rejection code') but does not significantly augment the schema's meaning. Baseline of 3 is appropriate.

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 it looks up Taiwan NHI rejection codes, specifies the 5-character format with example '0317A', and lists what it returns (severity, category, official Chinese description). This distinguishes it from sibling tools like search_nhi_wiki which are for general NHI searches.

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?

No guidance on when to use this tool versus alternatives (e.g., search_nhi_wiki for broader queries). The description only explains what the tool does without providing context for decision-making.

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/tatsuju/opdstar-nhi-mcp'

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