Skip to main content
Glama

fakestore_delete_cart

Remove a shopping cart from the Fake Store API simulation by specifying its ID. This action clears cart data for testing and demo purposes without persisting changes.

Instructions

Delete a cart (simulation - does not persist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCart ID to delete

Implementation Reference

  • The deleteCart function that executes the core logic of the fakestore_delete_cart tool: validates the cart ID and performs a DELETE request to /carts/{id} via the del API utility.
    /** * Delete a cart (simulation) */ export async function deleteCart(args: { id: number }): Promise<Cart> { const { id } = args; validatePositiveInteger(id, 'Cart ID'); return del<Cart>(`/carts/${id}`); }
  • The input schema definition for the fakestore_delete_cart tool within the cartTools array, defining the required 'id' number parameter.
    { name: 'fakestore_delete_cart', description: 'Delete a cart (simulation - does not persist)', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Cart ID to delete', }, }, required: ['id'], }, },
  • src/index.ts:161-166 (registration)
    Tool registration in the MCP CallToolRequestHandler: checks tool name and invokes the deleteCart handler function.
    if (name === 'fakestore_delete_cart') { const result = await deleteCart(args as { id: number }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • src/index.ts:40-44 (registration)
    Registration of tool list including cartTools (which contains fakestore_delete_cart schema) in the ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...productTools, ...cartTools, ...userTools], }; });
  • src/index.ts:19-19 (registration)
    Import statement bringing in the deleteCart handler and cartTools (schema) from carts.ts.
    import { cartTools, getAllCarts, getCartById, getUserCarts, addCart, updateCart, deleteCart } from './tools/carts.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/op-enny/mcp-server-fakestore'

If you have feedback or need assistance with the MCP directory API, please join our Discord server