Skip to main content
Glama

Query NPI Providers

query_npi_providers

Search the National Provider Identifier registry for healthcare providers by state, specialty, name, city, or ZIP code to find medical professionals and facilities.

Instructions

Search the NPI (National Provider Identifier) registry for healthcare providers. Filter by state, specialty, name, city, or ZIP code. Returns up to 100 results per query. Source: CMS NPPES, updated weekly. ~7.2 million providers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateNoTwo-letter US state code (e.g. CA, NY, TX)
specialtyNoProvider specialty or taxonomy description (e.g. Cardiology, Family Medicine)
nameNoProvider name (partial match on first or last name, or organization name)
cityNoCity name
zipNo5-digit ZIP code
limitNoMaximum number of results to return (default 25, max 100)

Implementation Reference

  • The handler function for the `query_npi_providers` tool.
    async ({ state, specialty, name, city, zip, limit }) => {
      const res = await apiGet<NpiQueryResponse>("/api/v1/npi", {
        state,
        specialty,
        name,
        city,
        zip,
        limit: limit ?? 25,
      });
    
      if (!res.ok) {
        return {
          content: [
            {
              type: "text" as const,
              text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
            },
          ],
          isError: true,
        };
      }
    
      const { count, data } = res.data;
      const summary = `Found ${count} NPI provider(s).`;
      const json = JSON.stringify(data, null, 2);
    
      return {
        content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
      };
    },
  • Input validation schema for the `query_npi_providers` tool.
    inputSchema: {
      state: z
        .string()
        .length(2)
        .optional()
        .describe("Two-letter US state code (e.g. CA, NY, TX)"),
      specialty: z
        .string()
        .optional()
        .describe(
          "Provider specialty or taxonomy description (e.g. Cardiology, Family Medicine)",
        ),
      name: z
        .string()
        .optional()
        .describe(
          "Provider name (partial match on first or last name, or organization name)",
        ),
      city: z.string().optional().describe("City name"),
      zip: z
        .string()
        .optional()
        .describe("5-digit ZIP code"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Maximum number of results to return (default 25, max 100)"),
    },
  • src/tools/npi.ts:29-68 (registration)
    Registration of the `query_npi_providers` tool.
    server.registerTool(
      "query_npi_providers",
      {
        title: "Query NPI Providers",
        description:
          "Search the NPI (National Provider Identifier) registry for healthcare providers. " +
          "Filter by state, specialty, name, city, or ZIP code. Returns up to 100 results per query. " +
          "Source: CMS NPPES, updated weekly. ~7.2 million providers.",
        inputSchema: {
          state: z
            .string()
            .length(2)
            .optional()
            .describe("Two-letter US state code (e.g. CA, NY, TX)"),
          specialty: z
            .string()
            .optional()
            .describe(
              "Provider specialty or taxonomy description (e.g. Cardiology, Family Medicine)",
            ),
          name: z
            .string()
            .optional()
            .describe(
              "Provider name (partial match on first or last name, or organization name)",
            ),
          city: z.string().optional().describe("City name"),
          zip: z
            .string()
            .optional()
            .describe("5-digit ZIP code"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum number of results to return (default 25, max 100)"),
        },
      },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively adds context beyond the input schema: it specifies the result limit ('Returns up to 100 results per query'), data source and update frequency ('Source: CMS NPPES, updated weekly'), and dataset size ('~7.2 million providers'). However, it does not mention error handling, rate limits, or authentication needs, which are relevant for a public API tool.

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 efficiently structured in three sentences: the first states the purpose, the second lists filters and result limits, and the third provides source metadata. Each sentence adds essential information without redundancy, making it front-loaded and zero-waste.

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?

Given the tool's moderate complexity (search with multiple filters), no annotations, and no output schema, the description is reasonably complete. It covers purpose, filters, result limits, and data source, but lacks details on output format, pagination, error cases, or performance characteristics. For a search tool without structured output documentation, it could benefit from more behavioral context.

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?

The input schema has 100% description coverage, providing clear documentation for all 6 parameters. The description adds minimal semantic value by listing filterable fields ('Filter by state, specialty, name, city, or ZIP code') but does not elaborate on syntax, interactions, or default behaviors beyond what the schema already states. The baseline score of 3 is appropriate as the schema does the heavy lifting.

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 the tool's purpose: 'Search the NPI (National Provider Identifier) registry for healthcare providers.' It specifies the verb ('Search'), resource ('NPI registry'), and target ('healthcare providers'), distinguishing it from sibling tools like 'lookup_npi' or 'npi_stats' by emphasizing search/filtering capabilities rather than direct lookup or statistical analysis.

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

Usage Guidelines3/5

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

The description implies usage by listing filterable fields (state, specialty, name, city, ZIP code) and noting the data source (CMS NPPES), but it does not explicitly state when to use this tool versus alternatives like 'lookup_npi' or 'npi_stats'. No guidance on prerequisites, exclusions, or specific scenarios is provided, leaving usage context inferred rather than clearly defined.

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/carrierone/verilexdata-mcp'

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