Skip to main content
Glama

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)"),
        },
      },

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