Skip to main content
Glama
backworkai
by backworkai

compare_policies

Compare Medicare coverage policies across jurisdictions for specific procedure codes to identify regional differences in coverage requirements.

Instructions

Compare coverage policies across different MAC jurisdictions for specific procedure codes. Useful to understand regional coverage differences for the same procedures. Shows national vs. jurisdiction-specific policies.

Examples:

  • compare_policies(["76942"]) - compare ultrasound guidance coverage nationally

  • compare_policies(["76942", "76937"], { jurisdictions: ["JM", "JH"] }) - compare specific regions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
procedure_codesYesCPT/HCPCS codes to compare (1-10 codes)
policy_typeNoFilter by policy type
jurisdictionsNoSpecific jurisdictions to compare (e.g., ['JM', 'JH'])

Implementation Reference

  • Handler function that executes the compare_policies tool logic: POSTs to Verity API /policies/compare, formats national and jurisdictional policy comparisons, handles errors.
      async ({ procedure_codes, policy_type, jurisdictions }) => {
        try {
          const result = await verityRequest<any>("/policies/compare", {
            method: "POST",
            body: { procedure_codes, policy_type, jurisdictions },
          });
    
          const lines: string[] = [];
          const summary = result.data.summary;
    
          lines.push(`Coverage Comparison for: ${summary.queried_codes.join(", ")}`);
          lines.push(`Jurisdictions analyzed: ${summary.total_jurisdictions}`);
          lines.push(`With coverage: ${summary.jurisdictions_with_coverage}`);
          lines.push(`National policies: ${summary.national_policies_count}`);
          lines.push(`Regional variation: ${summary.has_variation ? "YES" : "NO"}`);
    
          // National policies
          if (result.data.national_policies?.length > 0) {
            lines.push("\n--- NATIONAL POLICIES ---");
            result.data.national_policies.forEach((p: any) => {
              lines.push(`\n${p.policy_id}: ${p.title}`);
              lines.push(`Type: ${p.policy_type}`);
              if (p.codes?.length > 0) {
                p.codes.forEach((c: any) => {
                  lines.push(`  - ${c.code}: ${c.disposition}`);
                });
              }
            });
          }
    
          // Jurisdiction comparison
          if (result.data.comparison?.length > 0) {
            lines.push("\n--- BY JURISDICTION ---");
            result.data.comparison.forEach((jur: any) => {
              lines.push(`\n[${jur.jurisdiction}] ${jur.mac?.name || ""}`);
              if (jur.mac?.states) lines.push(`States: ${jur.mac.states.join(", ")}`);
    
              if (jur.coverage_summary) {
                const cs = jur.coverage_summary;
                lines.push(`Coverage: ${cs.covered} covered, ${cs.not_covered} not covered, ${cs.requires_pa} require PA, ${cs.conditional} conditional`);
              }
    
              if (jur.policies?.length > 0) {
                jur.policies.forEach((p: any) => {
                  lines.push(`  ${p.policy_id}: ${p.title}`);
                });
              } else {
                lines.push("  No local policies found");
              }
            });
          }
    
          return {
            content: [{ type: "text", text: lines.join("\n") }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error comparing policies: ${error instanceof Error ? error.message : String(error)}` }],
          };
        }
      }
    );
    
    // 5. get_policy_changes - Track policy updates
  • Zod input schema validating procedure_codes array (1-10 strings), optional policy_type enum, optional jurisdictions array.
      inputSchema: {
        procedure_codes: z
          .array(z.string())
          .min(1)
          .max(10)
          .describe("CPT/HCPCS codes to compare (1-10 codes)"),
        policy_type: z.enum(["LCD", "Article", "NCD"]).optional().describe("Filter by policy type"),
        jurisdictions: z
          .array(z.string())
          .max(10)
          .optional()
          .describe("Specific jurisdictions to compare (e.g., ['JM', 'JH'])"),
      },
    },
  • src/index.ts:398-486 (registration)
    MCP server registration of the compare_policies tool, including description, input schema, and handler function.
    server.registerTool(
      "compare_policies",
      {
        description: `Compare coverage policies across different MAC jurisdictions for specific procedure codes.
    Useful to understand regional coverage differences for the same procedures.
    Shows national vs. jurisdiction-specific policies.
    
    Examples:
    - compare_policies(["76942"]) - compare ultrasound guidance coverage nationally
    - compare_policies(["76942", "76937"], { jurisdictions: ["JM", "JH"] }) - compare specific regions`,
        inputSchema: {
          procedure_codes: z
            .array(z.string())
            .min(1)
            .max(10)
            .describe("CPT/HCPCS codes to compare (1-10 codes)"),
          policy_type: z.enum(["LCD", "Article", "NCD"]).optional().describe("Filter by policy type"),
          jurisdictions: z
            .array(z.string())
            .max(10)
            .optional()
            .describe("Specific jurisdictions to compare (e.g., ['JM', 'JH'])"),
        },
      },
      async ({ procedure_codes, policy_type, jurisdictions }) => {
        try {
          const result = await verityRequest<any>("/policies/compare", {
            method: "POST",
            body: { procedure_codes, policy_type, jurisdictions },
          });
    
          const lines: string[] = [];
          const summary = result.data.summary;
    
          lines.push(`Coverage Comparison for: ${summary.queried_codes.join(", ")}`);
          lines.push(`Jurisdictions analyzed: ${summary.total_jurisdictions}`);
          lines.push(`With coverage: ${summary.jurisdictions_with_coverage}`);
          lines.push(`National policies: ${summary.national_policies_count}`);
          lines.push(`Regional variation: ${summary.has_variation ? "YES" : "NO"}`);
    
          // National policies
          if (result.data.national_policies?.length > 0) {
            lines.push("\n--- NATIONAL POLICIES ---");
            result.data.national_policies.forEach((p: any) => {
              lines.push(`\n${p.policy_id}: ${p.title}`);
              lines.push(`Type: ${p.policy_type}`);
              if (p.codes?.length > 0) {
                p.codes.forEach((c: any) => {
                  lines.push(`  - ${c.code}: ${c.disposition}`);
                });
              }
            });
          }
    
          // Jurisdiction comparison
          if (result.data.comparison?.length > 0) {
            lines.push("\n--- BY JURISDICTION ---");
            result.data.comparison.forEach((jur: any) => {
              lines.push(`\n[${jur.jurisdiction}] ${jur.mac?.name || ""}`);
              if (jur.mac?.states) lines.push(`States: ${jur.mac.states.join(", ")}`);
    
              if (jur.coverage_summary) {
                const cs = jur.coverage_summary;
                lines.push(`Coverage: ${cs.covered} covered, ${cs.not_covered} not covered, ${cs.requires_pa} require PA, ${cs.conditional} conditional`);
              }
    
              if (jur.policies?.length > 0) {
                jur.policies.forEach((p: any) => {
                  lines.push(`  ${p.policy_id}: ${p.title}`);
                });
              } else {
                lines.push("  No local policies found");
              }
            });
          }
    
          return {
            content: [{ type: "text", text: lines.join("\n") }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error comparing policies: ${error instanceof Error ? error.message : String(error)}` }],
          };
        }
      }
    );
    
    // 5. get_policy_changes - Track policy updates
    server.registerTool(
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool compares policies and shows 'national vs. jurisdiction-specific policies,' adding context about output scope. However, it lacks details on behavioral traits such as rate limits, authentication needs, error handling, or what the comparison output looks like (e.g., structured data, limitations). The examples hint at usage but don't fully compensate for missing annotation coverage.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by a usage note and output scope. The examples are concise and illustrative, adding practical value without redundancy. Every sentence earns its place, and there is no wasted text.

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

Completeness3/5

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

Given no annotations and no output schema, the description provides adequate context for a read-only comparison tool but has gaps. It explains what the tool does and includes examples, but lacks details on output format, error conditions, or limitations (e.g., max jurisdictions). For a tool with 3 parameters and no structured output, it's minimally viable but could be more complete regarding behavioral aspects.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema: it mentions 'procedure codes' and 'jurisdictions' in the examples but doesn't provide additional semantics like format details or usage nuances. With high schema coverage, the baseline is 3, and the description doesn't significantly enhance parameter understanding.

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: 'Compare coverage policies across different MAC jurisdictions for specific procedure codes.' It specifies the verb ('compare'), resource ('coverage policies'), scope ('across different MAC jurisdictions'), and target ('specific procedure codes'), distinguishing it from siblings like 'get_policy' or 'lookup_code' which likely retrieve individual policies or codes rather than comparative analysis.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: 'Useful to understand regional coverage differences for the same procedures.' It implies usage for comparative analysis across jurisdictions, but does not explicitly state when not to use it or name specific alternatives among the sibling tools (e.g., 'get_policy' for single policies). The examples help illustrate usage but don't provide explicit exclusions.

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

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