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

fakestore_get_user_carts

Retrieve all shopping carts for a specific user from the Fake Store API to manage e-commerce data for testing or learning purposes.

Instructions

Get all carts belonging to a specific user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesUser ID

Implementation Reference

  • Core handler function that validates the userId and fetches the user's carts from the FakeStore API endpoint `/carts/user/${userId}`.
    export async function getUserCarts(args: { userId: number }): Promise<Cart[]> {
      const { userId } = args;
      validatePositiveInteger(userId, 'User ID');
      return get<Cart[]>(`/carts/user/${userId}`);
    }
  • MCP server dispatch handler that calls the getUserCarts function and formats the response as MCP content.
    if (name === 'fakestore_get_user_carts') {
      const result = await getUserCarts(args as { userId: number });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Tool schema definition including name, description, and inputSchema for validation.
    {
      name: 'fakestore_get_user_carts',
      description: 'Get all carts belonging to a specific user',
      inputSchema: {
        type: 'object',
        properties: {
          userId: {
            type: 'number',
            description: 'User ID',
          },
        },
        required: ['userId'],
      },
  • src/index.ts:40-44 (registration)
    Registration of all tools including cartTools (which contains fakestore_get_user_carts) in the MCP server's listTools handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [...productTools, ...cartTools, ...userTools],
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read-only operation, the description doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what happens if the user ID doesn't exist. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that communicates the core purpose without unnecessary words. It's front-loaded with the main action and resource, making it immediately scannable. Every word earns its place with no redundancy or fluff.

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?

For a simple read operation with 1 parameter and 100% schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it doesn't address key contextual elements like return format (e.g., array of cart objects), error handling, or authentication requirements. The description meets basic needs but leaves the agent to assume or discover important details.

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%, with the single parameter 'userId' clearly documented as a number representing 'User ID'. The description adds no additional parameter semantics beyond what the schema provides (e.g., format examples, valid ranges, or relationship to other tools). The baseline score of 3 reflects adequate but minimal value addition.

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 target resource ('belonging to a specific user'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'fakestore_get_carts' (which presumably gets all carts without user filtering) and 'fakestore_get_cart' (which gets a single cart). However, it doesn't specify the exact scope (e.g., whether it returns active carts only or all historical carts).

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 like 'fakestore_get_carts' or 'fakestore_get_cart'. It doesn't mention prerequisites, error conditions, or typical use cases. The agent must infer usage from the tool name and description alone without explicit context.

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