Acme Corp/

Tools

/inventory.check

inventory.check

Codev1.4.2

Query warehouse stock levels and availability in real-time

Run
Schema
Code
Calls
Settings
src/tools/inventory-check.ts
1// MCP tool — registered via server.registerTool()
2export const inventoryCheck = {
3 name: "inventory.check",
4 description: "Query warehouse stock",
5 inputSchema: {
6 sku: z.string().describe("SKU code"),
7 warehouse: z.string().optional(),
8 },
9 handler: async ({ sku, warehouse }) => {
10 const response = await fetch(
11 `https://api.warehouse.io/v2/stock?sku=${sku}`,
12 );
13 const data = await response.json();
14 return { content: [{ type: "text",
15 text: JSON.stringify({ available: data.qty > 0,
16 quantity: data.qty, location: data.warehouse_name }) } ];
17 },
18};
Test inputs
SKU-7842-BLK
us-east-1
Run test
200 OK
18ms · 247 B
{
"available": true,
"quantity": 247,
"location": "Newark DC",
"lastRestock": "2h ago"
}