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

fakestore_get_products

Retrieve product listings from a mock e-commerce store with options to limit results and sort by price for testing or demonstration purposes.

Instructions

Get all products from the store. Optionally limit results and sort by price.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLimit the number of products returned
sortNoSort products by price (asc or desc)

Implementation Reference

  • Core handler function that fetches all products with optional limit and sort parameters using the FakeStore API.
    export async function getAllProducts(args: { limit?: number; sort?: SortOrder }): Promise<Product[]> {
      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<Product[]>('/products', params);
    }
  • Tool schema definition including name, description, and input schema for validation.
    {
      name: 'fakestore_get_products',
      description: 'Get all products from the store. Optionally limit results and sort by price.',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Limit the number of products returned',
          },
          sort: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Sort products by price (asc or desc)',
          },
        },
      },
    },
  • src/index.ts:54-59 (registration)
    MCP server dispatch registration that executes the tool handler and formats the response.
    if (name === 'fakestore_get_products') {
      const result = await getAllProducts(args as { limit?: number; sort?: 'asc' | 'desc' });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • src/index.ts:40-44 (registration)
    Registration of the list tools handler that advertises the fakestore_get_products tool.
    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 the full burden of behavioral disclosure. It mentions optional limiting and sorting, but fails to address critical aspects such as whether this is a read-only operation (implied by 'Get' but not explicit), potential rate limits, error conditions, or the format of returned data (e.g., list structure). This leaves significant gaps in understanding the tool's behavior.

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 extremely concise, consisting of only two sentences that directly state the tool's purpose and optional features. Every word serves a purpose, with no redundant or unnecessary information, making it easy to parse and understand quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for a retrieval tool. It does not explain the return format (e.g., array of product objects), potential pagination, error handling, or how it differs from sibling tools. While the purpose is clear, the absence of behavioral and contextual details makes it insufficient for fully informed tool selection and invocation.

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?

The schema description coverage is 100%, with clear descriptions for both parameters ('limit' and 'sort'). The description adds minimal value by mentioning 'optionally limit results and sort by price', which aligns with but does not significantly expand upon the schema. Since the schema is well-documented, a baseline score of 3 is appropriate, as the description does not compensate for any gaps but also does not detract.

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 products') and resource ('from the store'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'fakestore_get_product' (singular) or 'fakestore_get_products_by_category', which offer more specific retrieval options, leaving room for improvement in distinguishing use cases.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it does not mention using 'fakestore_get_product' for a single product or 'fakestore_get_products_by_category' for filtered results, nor does it specify prerequisites or exclusions, leaving the agent to infer usage from context alone.

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