Skip to main content
Glama

doordash_modify_cart

Change item quantities or remove items from a DoorDash cart to update orders before checkout.

Instructions

Modify cart: change item quantity or remove items.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cart_idYesCart ID
item_idYesItem ID from doordash_cart
actionYesAction to perform
quantityNoNew quantity (for update_quantity)
store_idNoStore ID (auto-detected if not specified)
external_user_idNoExternal user ID for group order guest session

Implementation Reference

  • Registration of the 'doordash_modify_cart' tool, including its description and input schema.
    server.registerTool(
      "doordash_modify_cart",
      {
        description: "Modify cart: change item quantity or remove items.",
        inputSchema: {
          cart_id: z.string().describe("Cart ID"),
          item_id: z.string().describe("Item ID from doordash_cart"),
          action: z
            .enum(["update_quantity", "remove"])
            .describe("Action to perform"),
          quantity: z
            .number()
            .optional()
            .describe("New quantity (for update_quantity)"),
          store_id: z
            .string()
            .optional()
            .describe("Store ID (auto-detected if not specified)"),
          external_user_id: z
            .string()
            .optional()
            .describe("External user ID for group order guest session"),
        },
      },
  • The handler function implementation for 'doordash_modify_cart', which modifies the cart item quantity or removes items.
    ({ cart_id, item_id, action, quantity, store_id, external_user_id }) =>
      wrap(async () => {
        const guest = external_user_id
          ? api.guests.getSession(external_user_id)
          : undefined;
        const cartApi = guest?.cart ?? api.cart;
    
        if (action === "remove") {
          await cartApi.removeItem(cart_id, item_id);
          const carts = await api.cart.listCarts();
          const remaining =
            carts.find((c) => c.id === cart_id)?.items.length ?? 0;
          return ok(`Item removed. ${remaining} items remaining in cart.`);
        }
    
        if (action === "update_quantity") {
          if (!quantity || quantity < 1)
            return err("Quantity must be at least 1.");
    
          const carts = await api.cart.listCarts();
          const targetCart = carts.find((c) => c.id === cart_id);
          const targetItem = targetCart?.items.find((i) => i.id === item_id);
          if (!targetItem) return err("Item not found in cart.");
    
          const sid = store_id ?? targetCart?.storeId ?? "";
    
          // Remove then re-add (updateCartItemV2 is broken)
          await api.cart.removeItem(cart_id, item_id);
          try {
            const result = await api.cart.addToCart({
              storeId: sid,
              itemId: targetItem.menuItemId,
              itemName: targetItem.name,
              quantity,
              nestedOptions: targetItem.nestedOptions
                ? JSON.stringify(targetItem.nestedOptions)
                : "[]",
              unitPrice: targetItem.price,
              cartId: cart_id,
              specialInstructions: targetItem.specialInstructions,
            });
            return ok(
              `Updated **${targetItem.name}** to ${quantity}x. Subtotal: $${(result.subtotal / 100).toFixed(2)}. Cart ID: ${result.cartId}`,
            );
          } catch {
            // Cart may have been deleted when last item removed — retry without cartId
            const result = await api.cart.addToCart({
              storeId: sid,
              itemId: targetItem.menuItemId,
              itemName: targetItem.name,
              quantity,
              nestedOptions: targetItem.nestedOptions
                ? JSON.stringify(targetItem.nestedOptions)
                : "[]",
              unitPrice: targetItem.price,
              cartId: "",
              specialInstructions: targetItem.specialInstructions,
            });
            return ok(
              `Updated **${targetItem.name}** to ${quantity}x. Subtotal: $${(result.subtotal / 100).toFixed(2)}. Cart ID: ${result.cartId}`,
            );
          }
        }
    
        return err(`Unknown action: ${action}`);
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 of behavioral disclosure. It adequately discloses the mutation behavior (modifying quantities, removing items) but omits other behavioral traits such as side effects (price recalculation), idempotency, or the group order context implied by the external_user_id parameter.

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

Conciseness4/5

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

The description is extremely concise with zero redundant words. However, given the tool's complexity (6 parameters, mutation behavior, group order support) and lack of annotations, it verges on being overly terse rather than appropriately informative.

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?

Given the well-documented schema covering all parameters, the description meets minimum viability. However, for a mutation tool with no output schema and no annotations, it has clear gaps—particularly regarding behavioral details, error conditions, and the group order functionality supported by the external_user_id parameter.

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, establishing a baseline score of 3. The description maps generally to the action enum values ('change quantity' = update_quantity, 'remove' = remove) but does not add semantic meaning beyond the schema, such as explaining that quantity is conditional on action or detailing the group order use case.

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 tool modifies carts by changing item quantity or removing items, using specific verbs and resources. It implicitly distinguishes from siblings like doordash_add_to_cart (adding new items) and doordash_delete_cart (deleting the entire cart) by specifying item-level operations, though it could explicitly contrast with these alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the specific actions mentioned ('change item quantity or remove'), suggesting when to use this tool versus adding items. However, it lacks explicit guidance on when to use this versus doordash_delete_cart or prerequisites like requiring an existing cart_id from doordash_cart.

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/ashah360/doordash-mcp'

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