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);
    }

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