Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

get_drug_ndcs

Retrieve National Drug Code (NDC) identifiers for medications using their DailyMed SET ID to facilitate accurate drug identification and inventory management.

Instructions

Get NDC codes for a specific drug by its SET ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
setIdYesThe SET ID of the drug to get NDCs for

Implementation Reference

  • The handler function `getSPLNDCs` in `SPLClient` class fetches NDC codes for a specific drug SET ID.
    async getSPLNDCs(setId: string): Promise<any[]> {
      if (!setId || typeof setId !== "string") {
        throw new Error("Valid SET ID is required");
      }
    
      try {
        const response = await this.client.get(`/spls/${setId}/ndcs.json`);
    
        if (
          response.data &&
          response.data.data &&
          Array.isArray(response.data.data)
        ) {
          return response.data.data.map((item: any) => ({
            ndc: item.ndc,
            packageNdc: item.package_ndc,
            productNdc: item.product_ndc,
          }));
        } else {
          throw new Error("Unexpected response structure for SPL NDCs");
        }
      } catch (error) {
        throw new Error(
          `Failed to fetch SPL NDCs: ${error instanceof Error ? error.message : "Unknown error"}`,
        );
      }
    }
  • src/index.ts:87-96 (registration)
    The tool "get_drug_ndcs" is registered and handled in `src/index.ts` within the `setupHandlers` method of the `DailyMedServer` class, delegating the call to the `DailyMedClient`.
    case "get_drug_ndcs":
      const ndcs = await this.client.getSPLNDCs(args.setId as string);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(ndcs, null, 2),
          },
        ],
      };
  • The tool definition and input schema for "get_drug_ndcs" are defined in `src/tools.ts`.
      name: "get_drug_ndcs",
      description: "Get NDC codes for a specific drug by its SET ID",
      inputSchema: {
        type: "object",
        properties: {
          setId: {
            type: "string",
            description: "The SET ID of the drug to get NDCs for",
          },
        },
        required: ["setId"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states it 'gets' NDC codes, implying a read operation, but doesn't describe what the output looks like (e.g., list format, pagination), error conditions, rate limits, or authentication needs. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that front-loads the core purpose. There's no wasted verbiage, repetition, or unnecessary elaboration—every word contributes directly to understanding the tool's function.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't address what the tool returns (e.g., NDC code format, multiple codes per drug), error handling, or usage constraints. For a tool with no structured behavioral or output documentation, the description should provide more operational 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 description adds minimal semantic context beyond the input schema. It mentions 'by its SET ID', which aligns with the 'setId' parameter in the schema (100% coverage). However, it doesn't explain what a SET ID represents, provide format examples, or clarify if it's a unique identifier. With high schema coverage, the baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Get NDC codes for a specific drug by its SET ID'. It specifies the verb ('Get'), resource ('NDC codes'), and key constraint ('by its SET ID'). However, it doesn't explicitly differentiate from sibling tools like 'get_all_ndcs' or 'search_drugs_by_pharmacologic_class', which would require a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools available (like 'get_all_ndcs' for all NDCs or 'search_drugs_by_pharmacologic_class' for different search criteria), there's no indication of when this specific SET ID-based lookup is appropriate or what prerequisites might be needed.

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/RowanErasmus/dailymed-mcp-server'

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