rr_add_po_note
Add notes to purchase orders for tracking changes, documenting decisions, or providing context within ReplenishRadar's inventory management system.
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)Tool registration: 'rr_add_po_note' is defined in the TOOLS array with name, description, and inputSchema specifying po_id and content as required parameters
{ 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-100 (handler)Request handler for CallToolRequestSchema that dispatches all tool calls including rr_add_po_note. Extracts tool name and arguments, calls the API, and returns the result
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)callApi function that implements the actual tool execution by making POST requests to https://api.replenishradar.com/api/mcp/call with the tool name and input parameters
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; }