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

fakestore_add_product

Add a new product to the Fake Store API for e-commerce demos and testing by providing title, price, description, image URL, and category.

Instructions

Add a new product to the store (simulation - does not persist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesProduct title
priceYesProduct price
descriptionYesProduct description
imageYesProduct image URL
categoryYesProduct category

Implementation Reference

  • The `addProduct` function that executes the tool logic: validates input parameters and posts a new product to the FakeStore API.
    export async function addProduct(args: {
      title: string;
      price: number;
      description: string;
      image: string;
      category: string;
    }): Promise<Product> {
      const { title, price, description, image, category } = args;
    
      if (!title || typeof title !== 'string') {
        throw new Error('Title must be a non-empty string');
      }
      if (typeof price !== 'number' || price <= 0) {
        throw new Error('Price must be a positive number');
      }
      if (!description || typeof description !== 'string') {
        throw new Error('Description must be a non-empty string');
      }
      validateUrl(image, 'Image URL');
      if (!category || typeof category !== 'string') {
        throw new Error('Category must be a non-empty string');
      }
    
      return post<Product>('/products', {
        title,
        price,
        description,
        image,
        category,
      });
    }
  • The input schema definition for the 'fakestore_add_product' tool, specifying required properties and types.
    {
      name: 'fakestore_add_product',
      description: 'Add a new product to the store (simulation - does not persist)',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'Product title',
          },
          price: {
            type: 'number',
            description: 'Product price',
          },
          description: {
            type: 'string',
            description: 'Product description',
          },
          image: {
            type: 'string',
            description: 'Product image URL',
          },
          category: {
            type: 'string',
            description: 'Product category',
          },
        },
        required: ['title', 'price', 'description', 'image', 'category'],
      },
    },
  • src/index.ts:82-93 (registration)
    Dispatch logic in the main tool handler that matches the tool name and invokes the `addProduct` handler function.
    if (name === 'fakestore_add_product') {
      const result = await addProduct(args as {
        title: string;
        price: number;
        description: string;
        image: string;
        category: string;
      });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior4/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 effectively reveals that this is a simulation tool ('does not persist'), which is crucial context about its non-destructive, temporary nature. However, it lacks details on response format, error handling, or any rate limits, leaving some behavioral aspects unspecified.

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—just 10 words in a single sentence—with zero wasted language. It's front-loaded with the core purpose and efficiently includes the critical simulation disclaimer, making it easy for an agent 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?

For a tool with no annotations and no output schema, the description provides basic but incomplete context. It covers the simulation aspect well but omits details about what the tool returns, error conditions, or how it interacts with sibling tools. Given the complexity of a write operation, more completeness would be beneficial.

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 input schema has 100% description coverage, clearly documenting all 5 required parameters. The tool description adds no additional parameter information beyond what's in the schema, so it meets the baseline for adequate but not exceptional parameter semantics.

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 ('Add a new product') and the resource ('to the store'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'fakestore_update_product' in terms of when to use one versus the other, which prevents a perfect score.

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_update_product' for modifying existing products. It mentions the simulation aspect but doesn't clarify practical usage scenarios or prerequisites, leaving the agent with minimal context for decision-making.

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