PostOrdersIdTransferAccept
Accept a transfer request to move an order to a customer's account, completing the transfer process initiated by either the customer or admin.
Instructions
Accept an order to be transfered to a customer's account, which was specified when the transfer request was created. The transfer is requested previously either by the customer using the Request Order Transfer Store API route, or by the admin using the Request Order Transfer Admin API route.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| fields | No |
Implementation Reference
- src/services/medusa-store.ts:83-127 (handler)The core handler logic for the 'PostOrdersIdTransferAccept' tool. This generic handler is used for all tools generated from the store OpenAPI spec. It constructs query parameters and body from input, then calls the Medusa JS SDK's client.fetch method on the appropriate API path.handler: async ( input: InferToolHandlerInput<any, ZodTypeAny> ): Promise<any> => { const query = new URLSearchParams(input); const body = Object.entries(input).reduce( (acc, [key, value]) => { if ( parameters.find( (p) => p.name === key && p.in === "body" ) ) { acc[key] = value; } return acc; }, {} as Record<string, any> ); if (method === "get") { console.error( `Fetching ${refPath} with GET ${query.toString()}` ); const response = await this.sdk.client.fetch(refPath, { method: method, headers: { "Content-Type": "application/json", "Accept": "application/json", "Authorization": `Bearer ${process.env.PUBLISHABLE_KEY}` }, query: query }); return response; } else { const response = await this.sdk.client.fetch(refPath, { method: method, headers: { "Content-Type": "application/json", "Accept": "application/json", "Authorization": `Bearer ${process.env.PUBLISHABLE_KEY}` }, body: JSON.stringify(body) }); return response; } } };
- src/services/medusa-store.ts:54-82 (schema)The input schema for the tool, dynamically generated from the OpenAPI specification parameters (excluding headers), using Zod for validation based on parameter types.inputSchema: { ...parameters .filter((p) => p.in != "header") .reduce((acc, param) => { switch (param.schema.type) { case "string": acc[param.name] = z.string().optional(); break; case "number": acc[param.name] = z.number().optional(); break; case "boolean": acc[param.name] = z.boolean().optional(); break; case "array": acc[param.name] = z .array(z.string()) .optional(); break; case "object": acc[param.name] = z.object({}).optional(); break; default: acc[param.name] = z.string().optional(); } return acc; }, {} as any) },
- src/index.ts:35-42 (registration)Registration of all tools from medusaStoreService.defineTools() (including 'PostOrdersIdTransferAccept') into the MCP server using server.tool().tools.forEach((tool) => { server.tool( tool.name, tool.description, tool.inputSchema, tool.handler ); });
- src/index.ts:15-17 (registration)Collection of tools list where medusaStoreService.defineTools() adds the 'PostOrdersIdTransferAccept' tool....medusaStoreService.defineTools(), ...medusaAdminService.defineTools() ];
- src/services/medusa-store.ts:131-137 (helper)The defineTools method that iterates over OpenAPI paths and creates tool definitions using wrapPath, including the one for operationId 'PostOrdersIdTransferAccept'.defineTools(store = storeJson): any[] { const paths = Object.entries(store.paths) as [string, SdkRequestType][]; const tools = paths.map(([path, refFunction]) => this.wrapPath(path, refFunction) ); return tools; }