Skip to main content
Glama

claims_validate

Validates healthcare claims pre-submission to detect errors, missing fields, and code mismatches. Provides actionable fix suggestions to avoid claim rejections.

Instructions

Pre-submission claims validation. Checks for errors, missing fields, code mismatches, and provides fix suggestions before you submit to the payer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
claimYesClaim data to validate

Implementation Reference

  • Zod schema for claims_validate input. Expects a claim object with patientId, providerId, dateOfService, diagnosisCodes, procedureCodes, and optional modifiers/placeOfService fields.
    schema: {
      claim: z.object({
        patientId: z.string(),
        providerId: z.string(),
        dateOfService: z.string().describe('YYYY-MM-DD'),
        diagnosisCodes: z.array(z.string()),
        procedureCodes: z.array(z.string()),
        modifiers: z.array(z.string()).optional(),
        placeOfService: z.string().optional(),
      }).describe('Claim data to validate'),
    },
  • src/tools.js:83-99 (registration)
    Tool registration entry in MCP_TOOLS array. Defines name, description, price, endpoint URL, and schema for the claims_validate tool.
    {
      name: 'claims_validate',
      description: 'Pre-submission claims validation. Checks for errors, missing fields, code mismatches, and provides fix suggestions before you submit to the payer.',
      price: '$0.05',
      endpoint: '/agent/v1/claims/validate',
      schema: {
        claim: z.object({
          patientId: z.string(),
          providerId: z.string(),
          dateOfService: z.string().describe('YYYY-MM-DD'),
          diagnosisCodes: z.array(z.string()),
          procedureCodes: z.array(z.string()),
          modifiers: z.array(z.string()).optional(),
          placeOfService: z.string().optional(),
        }).describe('Claim data to validate'),
      },
    },
  • Generic async handler registered via s.tool() that calls the external REST API endpoint /agent/v1/claims/validate. Handles payment errors (402), non-ok responses, and attaches billing info from response headers.
    s.tool(tool.name, tool.description, tool.schema, async (params) => {
      const toolDef = getToolByName(tool.name);
      if (!toolDef) {
        return { content: [{ type: 'text', text: `Unknown tool: ${tool.name}` }], isError: true };
      }
      try {
        const response = await fetch(`${API_BASE_URL}${toolDef.endpoint}`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            ...(API_KEY && { 'X-API-Key': API_KEY }),
            'X-Agent-ID': 'mcp-client',
            'User-Agent': '@mymedi-ai/mcp-server/1.2.1',
          },
          body: JSON.stringify(params),
        });
        if (response.status === 402) {
          const paymentInfo = await response.json();
          return {
            content: [{ type: 'text', text: JSON.stringify({
              error: 'payment_required',
              message: `This tool costs ${toolDef.price} per call. Register at ${API_BASE_URL}/bot-marketplace/register for an API key with 10 free starter credits, or pay per call with on-chain USDC (no signup) via the x402 protocol.`,
              price: toolDef.price, register: `${API_BASE_URL}/bot-marketplace/register`, ...paymentInfo,
            }, null, 2) }], isError: true,
          };
        }
        if (!response.ok) {
          const error = await response.json().catch(() => ({ message: response.statusText }));
          return { content: [{ type: 'text', text: JSON.stringify({ error: true, status: response.status, ...error }, null, 2) }], isError: true };
        }
        const data = await response.json();
        const creditsSpent = response.headers.get('X-Credits-Spent');
        const creditsRemaining = response.headers.get('X-Credits-Remaining');
        if (creditsSpent) {
          data._billing = { creditsSpent: parseInt(creditsSpent, 10), creditsRemaining: creditsRemaining ? parseInt(creditsRemaining, 10) : undefined, priceUSD: toolDef.price };
        }
        return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
      } catch (err) {
        return { content: [{ type: 'text', text: JSON.stringify({ error: true, message: err.message, hint: 'Ensure MCP_API_BASE_URL and MCP_API_KEY environment variables are set.' }, null, 2) }], isError: true };
      }
    });
Behavior3/5

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

No annotations provided, so description must disclose behavior. It states it checks and provides fix suggestions, implying non-destructive operation. But it lacks details on idempotency, side effects, or required permissions, leaving 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?

Single concise sentence front-loading the purpose and features, with no wasted words.

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 nested objects and no output schema or annotations, the description provides adequate context for what the tool does and when to use it. However, return value format and error handling are not addressed, leaving some incompleteness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters, but description adds meaning by explaining that the claim object is validated for errors, missing fields, and code mismatches with fix suggestions, going beyond raw schema structure.

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?

Description clearly states it validates claims before submission, checking errors, missing fields, code mismatches, and providing suggestions. This distinguishes it from sibling tools like code_validate (code-level) and compliance_audit (broader regulatory checks).

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?

Explicitly says 'before you submit to the payer,' indicating when to use. However, it does not mention when not to use or directly reference alternatives, though the sibling context provides differentiation.

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/MyMedi-AI/mymedi-ai-mcp-server'

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