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

fakestore_get_carts

Retrieve shopping carts from the Fake Store API with options to limit results and sort them in ascending or descending order.

Instructions

Get all carts from the store. Optionally limit results and sort.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLimit the number of carts returned
sortNoSort carts (asc or desc)

Implementation Reference

  • Core handler function that fetches all carts, validates input parameters, constructs query params, and calls the API.
    export async function getAllCarts(args: { limit?: number; sort?: SortOrder }): Promise<Cart[]> {
      const { limit, sort } = args;
    
      if (limit !== undefined) {
        validateLimit(limit);
      }
      if (sort !== undefined) {
        validateSortOrder(sort);
      }
    
      const params: Record<string, unknown> = {};
      if (limit) params.limit = limit;
      if (sort) params.sort = sort;
    
      return get<Cart[]>('/carts', params);
    }
  • Tool schema definition including name, description, and input schema for validation.
    {
      name: 'fakestore_get_carts',
      description: 'Get all carts from the store. Optionally limit results and sort.',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Limit the number of carts returned',
          },
          sort: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Sort carts (asc or desc)',
          },
        },
      },
    },
  • src/index.ts:116-122 (registration)
    Registers and dispatches the fakestore_get_carts tool call to the handler function within the MCP CallToolRequest handler.
    // Cart tools
    if (name === 'fakestore_get_carts') {
      const result = await getAllCarts(args as { limit?: number; sort?: 'asc' | 'desc' });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • src/index.ts:40-44 (registration)
    Registers the tool schemas (including fakestore_get_carts from cartTools) for the ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [...productTools, ...cartTools, ...userTools],
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a read operation ('Get'), but lacks details on permissions, rate limits, pagination, or what 'all carts' entails (e.g., all in the system vs. filtered). This is inadequate for a tool with potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with zero waste: the first states the core purpose, and the second covers optional parameters. It's front-loaded and appropriately sized, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 2 parameters with full schema coverage, the description is minimally adequate but has gaps. It explains what the tool does but lacks behavioral context (e.g., safety, performance) and output details, making it incomplete for optimal agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (limit and sort). The description mentions these options ('Optionally limit results and sort') but adds no meaning beyond what the schema provides, such as default behaviors or interaction effects, meeting the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get all carts') and resource ('from the store'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'fakestore_get_cart' (singular) or 'fakestore_get_user_carts', which would require more specificity to earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'fakestore_get_cart' for a single cart or 'fakestore_get_user_carts' for user-specific carts, leaving the agent without context for choosing between them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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