Skip to main content
Glama

fakestore_update_product

Update product details including title, price, description, image, and category in a simulated e-commerce environment for testing and development purposes.

Instructions

Update an existing product (simulation - does not persist)

Input Schema

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

Implementation Reference

  • The core handler function that validates input, constructs the update data, and performs the PUT request to the FakeStore API to update the product.
    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); }
  • src/index.ts:95-107 (registration)
    The dispatch logic in the main tool call 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) }], }; }
  • The tool schema definition including name, description, and input schema, included in the productTools array 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'], }, },

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