lookup_npi
Retrieve detailed healthcare provider information using a 10-digit NPI number. Access provider name, address, specialty, and enumeration date through Verilex Data's structured dataset.
Instructions
Look up a single healthcare provider by their 10-digit NPI number. Returns full provider details including name, address, specialty, and enumeration date.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| npi | Yes | The 10-digit NPI number |
Implementation Reference
- src/tools/npi.ts:103-139 (handler)Implementation of the 'lookup_npi' tool registration and its handler logic.
server.registerTool( "lookup_npi", { title: "Lookup NPI Provider", description: "Look up a single healthcare provider by their 10-digit NPI number. " + "Returns full provider details including name, address, specialty, and enumeration date.", inputSchema: { npi: z .string() .regex(/^\d{10}$/, "NPI must be exactly 10 digits") .describe("The 10-digit NPI number"), }, }, async ({ npi }) => { const res = await apiGet<{ dataset: string; data: Record<string, unknown> }>( `/api/v1/npi/${npi}`, ); if (!res.ok) { const msg = res.status === 404 ? `NPI ${npi} not found in the registry.` : `API error (${res.status}): ${JSON.stringify(res.data)}`; return { content: [{ type: "text" as const, text: msg }], isError: res.status !== 404, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data.data, null, 2) }, ], }; }, );