Skip to main content
Glama
bizino

BOS MCP Server

by bizino

bos_cart_update_item

Adjust the quantity of an item in a cart. Specify the item ID and the new quantity to update.

Instructions

Update cart item quantity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idYes
quantityYes

Implementation Reference

  • Handler function that extracts item_id from args and sends a PUT request to /mcp/cart/items/{item_id} with the remaining data (quantity).
    handler: async (args, client) => {
      const { item_id, ...data } = args;
      return client.put(`/mcp/cart/items/${item_id}`, data);
    },
  • Input schema requiring item_id (string) and quantity (number).
    schema: { item_id: { type: 'string' }, quantity: { type: 'number' } },
  • src/index.ts:55-76 (registration)
    Tool registration loop: all tools (including bos_cart_update_item via cartTools) are registered with the McpServer, converting the simple schema to Zod and invoking the handler.
    for (const tool of allTools) {
      const zodSchema = toZodSchema(tool.schema);
    
      server.tool(
        tool.name,
        tool.description,
        zodSchema.shape,
        async (args: any) => {
          try {
            const result = await tool.handler(args, client);
            return {
              content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
            };
          } catch (error: any) {
            return {
              content: [{ type: 'text' as const, text: JSON.stringify({ error: error.message || 'Unknown error' }) }],
              isError: true,
            };
          }
        }
      );
    }
  • Helper function that converts the simple schema format (used in tool definitions like bos_cart_update_item) to Zod schemas for MCP SDK validation.
    export function toZodSchema(schema: Record<string, any>): z.ZodObject<any> {
      const shape: Record<string, z.ZodTypeAny> = {};
    
      for (const [key, def] of Object.entries(schema)) {
        let field: z.ZodTypeAny;
    
        switch (def.type) {
          case 'number':
            field = z.number();
            break;
          case 'boolean':
            field = z.boolean();
            break;
          case 'array':
            field = z.array(z.any());
            break;
          case 'object':
            field = z.record(z.any());
            break;
          case 'string':
          default:
            if (def.enum) {
              field = z.enum(def.enum);
            } else {
              field = z.string();
            }
            break;
        }
    
        if (def.description) {
          field = field.describe(def.description);
        }
    
        if (def.optional) {
          field = field.optional();
        }
    
        shape[key] = field;
      }
    
      return z.object(shape);
    }
  • The cartTools array definition containing bos_cart_update_item as one of 7 cart tools. This array is exported and later spread into allTools in src/index.ts.
    export const cartTools: McpTool[] = [
      {
        name: 'bos_cart_get',
        description: 'Get current user cart',
        schema: {},
        handler: async (_, client) => client.get('/mcp/cart'),
      },
      {
        name: 'bos_cart_add_item',
        description: 'Add item to cart',
        schema: {
          product_id: { type: 'string' },
          quantity: { type: 'number' },
          variant_id: { type: 'string', optional: true },
          notes: { type: 'string', optional: true },
        },
        handler: async (args, client) => client.post('/mcp/cart/items', args),
      },
      {
        name: 'bos_cart_update_item',
        description: 'Update cart item quantity',
        schema: { item_id: { type: 'string' }, quantity: { type: 'number' } },
        handler: async (args, client) => {
          const { item_id, ...data } = args;
          return client.put(`/mcp/cart/items/${item_id}`, data);
        },
      },
      {
        name: 'bos_cart_remove_item',
        description: 'Remove item from cart',
        schema: { item_id: { type: 'string' } },
        handler: async (args, client) => client.delete(`/mcp/cart/items/${args.item_id}`),
      },
      {
        name: 'bos_cart_clear',
        description: 'Clear all items from cart',
        schema: {},
        handler: async (_, client) => client.delete('/mcp/cart'),
      },
      {
        name: 'bos_cart_apply_voucher',
        description: 'Apply voucher code to cart',
        schema: { voucher_code: { type: 'string' } },
        handler: async (args, client) => client.post('/mcp/cart/apply-voucher', args),
      },
      {
        name: 'bos_cart_remove_voucher',
        description: 'Remove voucher from cart',
        schema: {},
        handler: async (_, client) => client.delete('/mcp/cart/voucher'),
      },
    ];
Behavior2/5

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

With no annotations, the description must disclose behavioral traits, but it only states what the tool does. Missing critical details: whether the operation is destructive, authentication requirements, validation rules, or side effects on other cart state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence, making it concise. However, it is too sparse; it could be slightly longer to include essential context without being verbose. It is front-loaded but lacks structure.

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 tool's low complexity (2 parameters) and lack of output schema or annotations, the description is incomplete. It omits prerequisites, expected behavior for invalid inputs, and effects on the cart. A slightly more detailed description would suffice but is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description only mentions 'quantity' in the purpose, but does not explain what 'item_id' represents (e.g., cart item ID vs product ID) or acceptable quantity ranges. The schema itself provides no descriptions, so the description adds minimal value.

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 'update' and the specific resource 'cart item quantity'. It effectively distinguishes from siblings like bos_cart_add_item and bos_cart_remove_item, though it adds little beyond the tool name.

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 such as bos_cart_add_item for adding new items or bos_cart_clear for clearing the cart. The description lacks any contextual usage hints.

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/bizino/bos-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server