Skip to main content
Glama
backworkai
by backworkai

search_criteria

Search Medicare coverage criteria to find specific indications, limitations, or documentation requirements across policies. Filter by section type, policy type, or jurisdiction for targeted results.

Instructions

Search through coverage criteria blocks across Medicare policies. Find specific indications, limitations, or documentation requirements. More targeted than full policy search.

Examples:

  • search_criteria("diabetes") - criteria mentioning diabetes

  • search_criteria("BMI", { section: "indications" }) - BMI requirements for coverage

  • search_criteria("frequency", { section: "limitations" }) - frequency limitations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for criteria text
sectionNoFilter by criteria section type
policy_typeNoFilter by policy type
jurisdictionNoFilter by MAC jurisdiction
limitNoResults per page
cursorNoPagination cursor

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'search_criteria' tool. It makes an API request to '/coverage/criteria' with the provided parameters, processes the results by formatting them into a readable text response, handles empty results and errors appropriately, and returns structured content for the MCP server.
    async ({ query, section, policy_type, jurisdiction, limit, cursor }) => {
      try {
        const result = await verityRequest<any>("/coverage/criteria", {
          params: { q: query, section, policy_type, jurisdiction, limit, cursor },
        });
    
        if (!result.data || result.data.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No criteria found for "${query}". Try:\n- Broader search terms\n- Remove section filter\n- Search full policies instead`,
              },
            ],
          };
        }
    
        const lines: string[] = [`Found ${result.data.length} matching criteria:\n`];
    
        result.data.forEach((criteria: any, i: number) => {
          lines.push(`${i + 1}. [${criteria.section.toUpperCase()}] from ${criteria.policy.policy_id}`);
          lines.push(`   Policy: ${criteria.policy.title}`);
          lines.push(`   Text: ${criteria.text.slice(0, 300)}${criteria.text.length > 300 ? "..." : ""}`);
          if (criteria.tags?.length) lines.push(`   Tags: ${criteria.tags.join(", ")}`);
          if (criteria.requires_manual_review) lines.push(`   Note: Requires manual review`);
          lines.push("");
        });
    
        if (result.meta?.pagination?.cursor) {
          lines.push(`More results available. Use cursor: "${result.meta.pagination.cursor}"`);
        }
    
        return {
          content: [{ type: "text", text: lines.join("\n") }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error searching criteria: ${error instanceof Error ? error.message : String(error)}` }],
        };
      }
    }
  • The schema definition for the 'search_criteria' tool, including a detailed description and Zod-based inputSchema specifying parameters like query, section filters, policy_type, jurisdiction, limit, and cursor with validation rules and descriptions.
      {
        description: `Search through coverage criteria blocks across Medicare policies.
    Find specific indications, limitations, or documentation requirements.
    More targeted than full policy search.
    
    Examples:
    - search_criteria("diabetes") - criteria mentioning diabetes
    - search_criteria("BMI", { section: "indications" }) - BMI requirements for coverage
    - search_criteria("frequency", { section: "limitations" }) - frequency limitations`,
        inputSchema: {
          query: z.string().min(1).max(500).describe("Search query for criteria text"),
          section: z
            .enum(["indications", "limitations", "documentation", "frequency", "other"])
            .optional()
            .describe("Filter by criteria section type"),
          policy_type: z.enum(["LCD", "Article", "NCD", "PayerPolicy"]).optional().describe("Filter by policy type"),
          jurisdiction: z.string().max(10).optional().describe("Filter by MAC jurisdiction"),
          limit: z.number().min(1).max(100).default(20).describe("Results per page"),
          cursor: z.string().optional().describe("Pagination cursor"),
        },
      },
  • src/index.ts:548-612 (registration)
    The server.registerTool call that registers the 'search_criteria' tool with its name, schema, and handler function in the MCP server.
    server.registerTool(
      "search_criteria",
      {
        description: `Search through coverage criteria blocks across Medicare policies.
    Find specific indications, limitations, or documentation requirements.
    More targeted than full policy search.
    
    Examples:
    - search_criteria("diabetes") - criteria mentioning diabetes
    - search_criteria("BMI", { section: "indications" }) - BMI requirements for coverage
    - search_criteria("frequency", { section: "limitations" }) - frequency limitations`,
        inputSchema: {
          query: z.string().min(1).max(500).describe("Search query for criteria text"),
          section: z
            .enum(["indications", "limitations", "documentation", "frequency", "other"])
            .optional()
            .describe("Filter by criteria section type"),
          policy_type: z.enum(["LCD", "Article", "NCD", "PayerPolicy"]).optional().describe("Filter by policy type"),
          jurisdiction: z.string().max(10).optional().describe("Filter by MAC jurisdiction"),
          limit: z.number().min(1).max(100).default(20).describe("Results per page"),
          cursor: z.string().optional().describe("Pagination cursor"),
        },
      },
      async ({ query, section, policy_type, jurisdiction, limit, cursor }) => {
        try {
          const result = await verityRequest<any>("/coverage/criteria", {
            params: { q: query, section, policy_type, jurisdiction, limit, cursor },
          });
    
          if (!result.data || result.data.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No criteria found for "${query}". Try:\n- Broader search terms\n- Remove section filter\n- Search full policies instead`,
                },
              ],
            };
          }
    
          const lines: string[] = [`Found ${result.data.length} matching criteria:\n`];
    
          result.data.forEach((criteria: any, i: number) => {
            lines.push(`${i + 1}. [${criteria.section.toUpperCase()}] from ${criteria.policy.policy_id}`);
            lines.push(`   Policy: ${criteria.policy.title}`);
            lines.push(`   Text: ${criteria.text.slice(0, 300)}${criteria.text.length > 300 ? "..." : ""}`);
            if (criteria.tags?.length) lines.push(`   Tags: ${criteria.tags.join(", ")}`);
            if (criteria.requires_manual_review) lines.push(`   Note: Requires manual review`);
            lines.push("");
          });
    
          if (result.meta?.pagination?.cursor) {
            lines.push(`More results available. Use cursor: "${result.meta.pagination.cursor}"`);
          }
    
          return {
            content: [{ type: "text", text: lines.join("\n") }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error searching criteria: ${error instanceof Error ? error.message : String(error)}` }],
          };
        }
      }
    );
Behavior3/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 implies a read-only search operation without stating it explicitly, and it doesn't cover aspects like rate limits, authentication needs, or pagination behavior (beyond the cursor parameter in the schema). The examples add some context but lack comprehensive behavioral details.

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, with a clear purpose statement followed by targeted examples. Every sentence earns its place by reinforcing usage or providing practical guidance, with no wasted words or redundant information.

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 complexity of a search tool with 6 parameters and no output schema, the description is reasonably complete for guiding usage but lacks details on return values or error handling. It compensates well with examples and context, though it could be more comprehensive for a tool with multiple filtering options.

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 schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'section' in examples, but it doesn't provide additional meaning, syntax, or format details for parameters like 'policy_type' or 'jurisdiction' that aren't covered in the examples.

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 with specific verbs ('Search through coverage criteria blocks') and resources ('across Medicare policies'), distinguishing it from siblings like 'search_policies' by emphasizing it's 'more targeted than full policy search' and focuses on 'specific indications, limitations, or documentation requirements'.

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 this tool ('more targeted than full policy search'), but it doesn't explicitly state when not to use it or name specific alternatives among the sibling tools, such as 'search_policies' for broader searches or 'get_policy' for full policy retrieval.

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