Skip to main content
Glama
op-enny
by op-enny

fakestore_delete_cart

Remove a shopping cart from the Fake Store API MCP Server by specifying its ID. This tool simulates cart deletion for e-commerce testing and development purposes.

Instructions

Delete a cart (simulation - does not persist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCart ID to delete

Implementation Reference

  • The core handler function that validates the input cart ID and performs the deletion by calling the del API utility on `/carts/${id}`.
    export async function deleteCart(args: { id: number }): Promise<Cart> { const { id } = args; validatePositiveInteger(id, 'Cart ID'); return del<Cart>(`/carts/${id}`); }
  • The input schema and metadata definition for the fakestore_delete_cart tool within the cartTools array.
    { 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:40-44 (registration)
    The tool listing handler that registers the fakestore_delete_cart tool by including it in the cartTools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...productTools, ...cartTools, ...userTools], }; });
  • src/index.ts:161-166 (registration)
    The execution dispatch in the CallToolRequest handler that routes calls to fakestore_delete_cart to the deleteCart function.
    if (name === 'fakestore_delete_cart') { const result = await deleteCart(args as { id: number }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • The del utility function used by the deleteCart handler to make the HTTP DELETE request to the FakeStore API.
    export async function del<T>(endpoint: string): Promise<T> { try { const response = await api.delete<T>(endpoint); return response.data; } catch (error) { throw handleApiError(error); } }

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