rr_record_pi_review
Record proforma invoice details on purchase orders to manage supplier documentation and track financial commitments for inventory replenishment.
Instructions
Record proforma invoice details on a PO
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| po_id | Yes | ||
| pi_number | No | ||
| pi_date | No | ||
| pi_total | No | ||
| pi_terms | No |
Implementation Reference
- src/index.ts:54-54 (registration)Registration of the 'rr_record_pi_review' tool in the TOOLS array.
{ name: 'rr_record_pi_review', description: 'Record proforma invoice details on a PO', inputSchema: { type: 'object' as const, properties: { po_id: { type: 'string' }, pi_number: { type: 'string' }, pi_date: { type: 'string' }, pi_total: { type: 'number' }, pi_terms: { type: 'string' } }, required: ['po_id'] } }, - src/index.ts:86-99 (handler)Generic handler that routes tool calls (including 'rr_record_pi_review') to the 'callApi' function.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await callApi(name, (args as Record<string, unknown>) || {}); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error: ${message}` }], isError: true, }; } - src/index.ts:57-74 (helper)The 'callApi' helper function that executes the actual API request to the backend for the tool.
async function callApi(toolName: string, input: Record<string, unknown>): Promise<unknown> { const resp = await fetch(`${BASE_URL}/api/mcp/call`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, }, body: JSON.stringify({ tool: toolName, input }), }); if (!resp.ok) { const errorBody = await resp.text(); throw new Error(`API error ${resp.status}: ${errorBody}`); } const data = await resp.json(); return data.result; }