fakestore_delete_product
Remove a product from the Fake Store API by specifying its ID. This tool simulates deletion for testing and demo purposes without persisting changes.
Instructions
Delete a product (simulation - does not persist)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Product ID to delete |
Implementation Reference
- src/tools/products.ts:122-126 (handler)Core handler function that validates the product ID and calls the API delete endpoint to remove the product.export async function deleteProduct(args: { id: number }): Promise<Product> { const { id } = args; validatePositiveInteger(id, 'Product ID'); return del<Product>(`/products/${id}`); }
- src/tools/products.ts:250-263 (schema)Tool schema definition including name, description, and input schema requiring a numeric 'id'.{ name: 'fakestore_delete_product', description: 'Delete a product (simulation - does not persist)', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Product ID to delete', }, }, required: ['id'], }, },
- src/index.ts:109-114 (registration)Registration in the MCP call tool handler that dispatches to the deleteProduct function and formats the response.if (name === 'fakestore_delete_product') { const result = await deleteProduct(args as { id: number }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:41-42 (registration)Tool list registration for ListToolsRequestSchema, which includes the fakestore_delete_product schema from productTools.return { tools: [...productTools, ...cartTools, ...userTools],