rr_add_po_note
Add notes to purchase orders to document changes, track progress, or provide instructions for inventory management.
Instructions
Add a note to a purchase order
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| po_id | Yes | ||
| content | Yes |
Implementation Reference
- src/index.ts:49-49 (registration)The tool `rr_add_po_note` is registered in the `TOOLS` array within `src/index.ts`.
{ name: 'rr_add_po_note', description: 'Add a note to a purchase order', inputSchema: { type: 'object' as const, properties: { po_id: { type: 'string' }, content: { type: 'string' } }, required: ['po_id', 'content'] } }, - src/index.ts:86-92 (handler)The tool handler dynamically calls `callApi` for all registered tools including `rr_add_po_note`.
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) }], }; - src/index.ts:57-74 (helper)The `callApi` helper function is responsible for executing the logic for `rr_add_po_note` by making a REST API call to the server.
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; }