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

fakestore_update_product

Modify product details like title, price, description, image, or category in the Fake Store API simulation for testing and development purposes.

Instructions

Update an existing product (simulation - does not persist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesProduct ID to update
titleNoNew product title
priceNoNew product price
descriptionNoNew product description
imageNoNew product image URL
categoryNoNew product category

Implementation Reference

  • The core handler function implementing the fakestore_update_product tool logic. Validates inputs, constructs update data, and makes a PUT request to the FakeStore API.
    export async function updateProduct(args: {
      id: number;
      title?: string;
      price?: number;
      description?: string;
      image?: string;
      category?: string;
    }): Promise<Product> {
      const { id, title, price, description, image, category } = args;
      validatePositiveInteger(id, 'Product ID');
    
      const updateData: Record<string, unknown> = {};
      if (title !== undefined) updateData.title = title;
      if (price !== undefined) updateData.price = price;
      if (description !== undefined) updateData.description = description;
      if (image !== undefined) {
        validateUrl(image, 'Image URL');
        updateData.image = image;
      }
      if (category !== undefined) updateData.category = category;
    
      return put<Product>(`/products/${id}`, updateData);
    }
  • The tool definition including name, description, and input schema for fakestore_update_product, part of the productTools array used for tool listing.
    {
      name: 'fakestore_update_product',
      description: 'Update an existing product (simulation - does not persist)',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
            description: 'Product ID to update',
          },
          title: {
            type: 'string',
            description: 'New product title',
          },
          price: {
            type: 'number',
            description: 'New product price',
          },
          description: {
            type: 'string',
            description: 'New product description',
          },
          image: {
            type: 'string',
            description: 'New product image URL',
          },
          category: {
            type: 'string',
            description: 'New product category',
          },
        },
        required: ['id'],
      },
    },
  • src/index.ts:95-107 (registration)
    Registration and dispatch logic in the main MCP server handler that maps the tool name to the updateProduct function execution.
    if (name === 'fakestore_update_product') {
      const result = await updateProduct(args as {
        id: number;
        title?: string;
        price?: number;
        description?: string;
        image?: string;
        category?: string;
      });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • src/index.ts:42-42 (registration)
    Tool listing handler that includes productTools (containing fakestore_update_product schema) in the list of available tools.
    tools: [...productTools, ...cartTools, ...userTools],
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the critical behavioral trait that this is a simulation that 'does not persist', which is essential context for a mutation operation. However, it doesn't mention error conditions, response format, or other behavioral aspects like whether partial updates are allowed.

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?

Extremely concise with just 7 words that convey the core action and crucial behavioral constraint. Every word earns its place - 'Update an existing product' establishes purpose, and '(simulation - does not persist)' provides essential context without redundancy.

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 mutation tool with no annotations and no output schema, the description provides the minimum viable information. The simulation disclosure is critical, but more context about what 'does not persist' means practically would be helpful. Given 6 parameters and mutation nature, additional behavioral context would improve completeness.

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 already documents all 6 parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema descriptions. This meets the baseline expectation when schema coverage is high.

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 verb ('Update') and resource ('an existing product'), making the purpose unambiguous. It distinguishes from siblings like 'fakestore_add_product' by specifying 'existing' rather than creating new. The simulation disclaimer doesn't detract from purpose clarity.

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 like 'fakestore_update_cart' or 'fakestore_update_user'. The description mentions it's a simulation but doesn't explain when this simulation behavior matters or what the practical implications are for usage decisions.

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