Skip to main content
Glama

lookup_code

Look up medical codes (CPT, HCPCS, ICD-10, NDC) to get descriptions, RVU values, and Medicare coverage policies for billing and compliance verification.

Instructions

Look up a medical code (CPT, HCPCS, ICD-10, or NDC) and get coverage information. Returns code details, descriptions, RVU values, and related Medicare policies. Use this to understand what a code means and whether it's covered.

Examples:

  • lookup_code("76942") - ultrasound guidance

  • lookup_code("J0585") - Botox injection

  • lookup_code("M54.5") - low back pain diagnosis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe medical code to look up (e.g., 76942, J0585, M54.5)
code_systemNoCode system hint - auto-detected if not provided
jurisdictionNoMAC jurisdiction code to filter policies (e.g., JM, JH)
includeNoAdditional data: 'rvu', 'policies', or 'rvu,policies'
fuzzyNoEnable fuzzy matching for typos/partial codes

Implementation Reference

  • The asynchronous handler function that executes the lookup_code tool. It makes an API request to Verity's /codes/lookup endpoint, handles the response, formats it using formatCode, and returns structured content or error messages.
      async ({ code, code_system, jurisdiction, include, fuzzy }) => {
        try {
          const result = await verityRequest<any>("/codes/lookup", {
            params: {
              code,
              code_system,
              jurisdiction,
              include: include || "rvu,policies",
              fuzzy: fuzzy ? "true" : "false",
            },
          });
    
          if (!result.data.found && (!result.data.suggestions || result.data.suggestions.length === 0)) {
            return {
              content: [
                {
                  type: "text",
                  text: `Code "${code}" not found. Try:\n- Check spelling\n- Use a different code system\n- Search for the procedure name using search_policies`,
                },
              ],
            };
          }
    
          return {
            content: [{ type: "text", text: formatCode(result.data) }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error looking up code: ${error instanceof Error ? error.message : String(error)}` }],
          };
        }
      }
    );
  • Zod input schema defining the parameters for the lookup_code tool: code (required), code_system (optional enum), jurisdiction (optional), include (optional), fuzzy (optional boolean).
    inputSchema: {
      code: z.string().min(1).max(20).describe("The medical code to look up (e.g., 76942, J0585, M54.5)"),
      code_system: z
        .enum(["CPT", "HCPCS", "ICD10CM", "ICD10PCS", "NDC"])
        .optional()
        .describe("Code system hint - auto-detected if not provided"),
      jurisdiction: z.string().max(10).optional().describe("MAC jurisdiction code to filter policies (e.g., JM, JH)"),
      include: z.string().optional().describe("Additional data: 'rvu', 'policies', or 'rvu,policies'"),
      fuzzy: z.boolean().default(true).describe("Enable fuzzy matching for typos/partial codes"),
    },
  • src/index.ts:231-233 (registration)
    Registration of the 'lookup_code' tool on the MCP server using server.registerTool, including description, inputSchema, and handler function.
    // 1. lookup_code - Look up medical codes
    server.registerTool(
      "lookup_code",
  • Helper function formatCode used by the lookup_code handler to format the API response into a readable string, including code details, RVU data, related policies, and suggestions.
    function formatCode(code: any): string {
      const lines: string[] = [];
      lines.push(`Code: ${code.code} (${code.code_system})`);
      if (code.description) lines.push(`Description: ${code.description}`);
      if (code.short_description) lines.push(`Short: ${code.short_description}`);
      if (code.category) lines.push(`Category: ${code.category}`);
      if (code.is_active !== undefined) lines.push(`Active: ${code.is_active ? "Yes" : "No"}`);
    
      if (code.rvu) {
        lines.push("\nRVU Data:");
        if (code.rvu.work_rvu) lines.push(`  Work RVU: ${code.rvu.work_rvu}`);
        if (code.rvu.total_rvu_facility) lines.push(`  Total RVU (Facility): ${code.rvu.total_rvu_facility}`);
        if (code.rvu.total_rvu_nonfacility) lines.push(`  Total RVU (Non-Facility): ${code.rvu.total_rvu_nonfacility}`);
        if (code.rvu.facility_price) lines.push(`  Facility Price: $${code.rvu.facility_price}`);
        if (code.rvu.non_facility_price) lines.push(`  Non-Facility Price: $${code.rvu.non_facility_price}`);
        if (code.rvu.global_days) lines.push(`  Global Days: ${code.rvu.global_days}`);
      }
    
      if (code.policies && code.policies.length > 0) {
        lines.push("\nRelated Policies:");
        code.policies.forEach((p: any) => {
          lines.push(`  - ${p.policy_id}: ${p.title}`);
          lines.push(`    Type: ${p.policy_type}, Disposition: ${p.disposition}`);
          if (p.jurisdiction) lines.push(`    Jurisdiction: ${p.jurisdiction}`);
        });
      }
    
      if (code.suggestions && code.suggestions.length > 0) {
        lines.push("\nSuggested Codes:");
        code.suggestions.slice(0, 5).forEach((s: any) => {
          lines.push(`  - ${s.code} (${s.code_system}): ${s.description || "No description"}`);
          lines.push(`    Match: ${s.match_type}, Score: ${(s.score * 100).toFixed(0)}%`);
        });
      }
    
      return lines.join("\n");
    }

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/tylergibbs1/verity_mcp'

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