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
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | 5-character NHI rejection code, e.g. '0317A', '0338A' |
Implementation Reference
- src/tools/lookupRejectionCode.ts:25-36 (handler)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; } - src/types.ts:3-13 (schema)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; } - src/tools/lookupRejectionCode.ts:4-19 (registration)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, ], })); - src/index.ts:61-62 (handler)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);