Skip to main content
Glama

fakestore_get_cart

Retrieve specific shopping cart details by ID to view items, quantities, and totals for e-commerce testing and data management.

Instructions

Get a single cart by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCart ID

Implementation Reference

  • Executes the 'fakestore_get_cart' tool by calling getCartById with the input arguments and formatting the result as a JSON text response.
    if (name === 'fakestore_get_cart') { const result = await getCartById(args as { id: number }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Defines the input schema for 'fakestore_get_cart' tool, requiring a positive integer 'id'.
    { name: 'fakestore_get_cart', description: 'Get a single cart by its ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Cart ID', }, }, required: ['id'], }, },
  • src/index.ts:40-44 (registration)
    Registers the 'fakestore_get_cart' tool (via cartTools) in the MCP server's listTools response.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...productTools, ...cartTools, ...userTools], }; });
  • Helper function that performs input validation and API call to retrieve a single cart by ID.
    export async function getCartById(args: { id: number }): Promise<Cart> { const { id } = args; validatePositiveInteger(id, 'Cart ID'); return get<Cart>(`/carts/${id}`); }

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