approve_order
Approve an order by providing its ID. This updates the order status to approved.
Instructions
Approve an order
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the order |
Implementation Reference
- src/tools/orders.ts:163-179 (registration)Registers the 'approve_order' tool on the McpServer. The schema requires an 'id' (positive integer). The handler calls the API endpoint /orders/{id}/approve and logs the response.
server.registerTool( "approve_order", { description: "Approve an order", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the order") }, }, async ({ id }) => { try { const record = await apiPut<EduframeRecord>(`/orders/${id}/approve`, {}); void logResponse("approve_order", { id }, record); return formatShow(record, "order"); } catch (error) { return formatError(error); } }, ); - src/tools/orders.ts:170-178 (handler)Handler function for 'approve_order'. Makes an apiPut call to /orders/{id}/approve, logs the response, and returns a formatted show result.
async ({ id }) => { try { const record = await apiPut<EduframeRecord>(`/orders/${id}/approve`, {}); void logResponse("approve_order", { id }, record); return formatShow(record, "order"); } catch (error) { return formatError(error); } }, - src/tools/orders.ts:165-168 (schema)Input schema for 'approve_order': requires a single 'id' field of type number (positive integer).
{ description: "Approve an order", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the order") }, - src/tools/index.ts:35-35 (registration)Import of registerOrderTools from './orders', which registers the approve_order tool.
import { registerOrderTools } from "./orders"; - script/generate-tools.ts:201-201 (helper)Shows that the operationId 'approve_order_by_id' is transformed into the tool name 'approve_order' by stripping '_by_id' suffix.
* "approve_order_by_id" → "approve_order" (action)