pa_status
Check the status of a prior authorization request: returns current status, dates, and expiration info using authorization ID or tracking number.
Instructions
Check the status of a prior authorization request. Returns current status, dates, and expiration info.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| authorizationId | No | Prior authorization ID | |
| trackingNumber | No | Tracking number (alternative to authorizationId) |
Implementation Reference
- src/tools.js:59-68 (schema)Tool definition and schema for 'pa_status'. Defines the tool's name, description, price, endpoint, and Zod schema with optional 'authorizationId' and 'trackingNumber' parameters.
{ name: 'pa_status', description: 'Check the status of a prior authorization request. Returns current status, dates, and expiration info.', price: '$0.02', endpoint: '/agent/v1/pa/status', schema: { authorizationId: z.string().optional().describe('Prior authorization ID'), trackingNumber: z.string().optional().describe('Tracking number (alternative to authorizationId)'), }, }, - src/index.js:19-61 (registration)Generic tool registration in the MCP server. The 'pa_status' tool is registered via the loop over MCP_TOOLS; its handler makes a POST request to '/agent/v1/pa/status' with the provided parameters.
for (const tool of MCP_TOOLS) { 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 }; } }); } - src/index.js:68-71 (registration)Sandbox/scanning registration for 'pa_status'. Returns 'sandbox' text without making real API calls, used for tool discovery without credentials.
for (const tool of MCP_TOOLS) { sandboxServer.tool(tool.name, tool.description, tool.schema, async () => ({ content: [{ type: 'text', text: 'sandbox' }] })); } - src/tools.js:255-257 (helper)Helper function to look up a tool definition by name. Used by the handler to retrieve endpoint and price info for 'pa_status'.
export function getToolByName(name) { return MCP_TOOLS.find((t) => t.name === name); }