Skip to main content
Glama
baskcart

W3Ship MCP Server

by baskcart

get_cart

Retrieve shopping cart details using a public key identifier to facilitate anonymous order processing and address linking.

Instructions

Retrieve a shopping cart by its Public Key ID. Uses W3SHIP_PUBLIC_KEY if no id is provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoPublic key ID (hex). Optional if W3SHIP_PUBLIC_KEY is set.

Implementation Reference

  • The get_cart tool handler in src/index.ts. It receives the cartId, calls valkeyService.getCart, and returns the cart data.
    case 'get_cart': {
        const id = (args?.id as string) || CONFIGURED_KEY;
        if (!id) {
            return { content: [{ type: 'text', text: 'Error: No cart ID. Set W3SHIP_PUBLIC_KEY or provide an id.' }], isError: true };
        }
        const cart = await valkeyService.getCart(id);
        if (!cart) {
            return { content: [{ type: 'text', text: `Error: Cart not found for ID ${id}` }], isError: true };
        }
        return { content: [{ type: 'text', text: JSON.stringify(cart, null, 2) }] };
    }
  • The actual implementation of getCart in valkeyService which interacts with the Valkey/Redis instance to retrieve the shopping cart.
    async getCart(cartId: string): Promise<ShoppingCart | null> {
        const data = await this.getClient().get(`cart:${cartId}`);
        if (!data) return null;
        return JSON.parse(data);
    }
Behavior3/5

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

No annotations provided, so description carries full burden. Adds valuable context about environment variable fallback behavior, but omits other behavioral traits like error handling when cart not found, read-only nature, or authentication requirements.

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?

Two sentences with zero waste: first establishes purpose, second covers default behavior. Front-loaded with the essential action and appropriately sized for a single-parameter retrieval tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple retrieval operation with one optional parameter. Captures the critical environment variable dependency. Could be improved by mentioning error behavior (e.g., what happens if cart doesn't exist), but sufficient given the tool's limited complexity and lack of output schema.

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 has 100% coverage and already documents the W3SHIP_PUBLIC_KEY fallback mechanism. Description repeats this information without adding semantic depth (e.g., ID format examples, validation rules) beyond what the schema provides. Baseline 3 appropriate for high schema coverage with minimal added description context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses specific verb 'Retrieve' with clear resource 'shopping cart' and identifier type 'Public Key ID'. Distinct from siblings like create_cart, delete_cart, and get_order through precise resource naming.

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?

Implies usage by documenting the W3SHIP_PUBLIC_KEY fallback mechanism, indicating when the id parameter can be omitted. However, lacks explicit guidance on when to use this versus sibling tools like create_cart or delete_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/baskcart/w3ship-mcp-server'

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