Skip to main content
Glama
baskcart

W3Ship MCP Server

by baskcart

create_cart

Create a TMF663 shopping cart for anonymous ordering, linking public key identity to physical address without requiring personal information.

Instructions

Create a new TMF663 shopping cart. If W3SHIP_PUBLIC_KEY is configured, it is used automatically — no id required. Otherwise provide an SLH-DSA or ECDSA public key (hex).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoPublic key (hex). Optional if W3SHIP_PUBLIC_KEY env var is set.
customerNo

Implementation Reference

  • The handler implementation for the 'create_cart' tool in src/index.ts. It validates the provided public key (or uses the configured one) and saves a new cart to the valkeyService.
    case 'create_cart': {
        const id = (args?.id as string) || CONFIGURED_KEY;
        if (!id) {
            return {
                content: [{ type: 'text', text: 'Error: No public key provided. Either set W3SHIP_PUBLIC_KEY in your MCP config, provide an id parameter, or call generate_demo_key first.' }],
                isError: true,
            };
        }
        const keyType = getKeyType(id);
        if (!keyType) {
            return {
                content: [{ type: 'text', text: 'Error: Invalid public key. Must be SLH-DSA (64 bytes hex) or ECDSA (33/65 bytes hex).' }],
                isError: true,
            };
        }
        const cart = { id, keyType, customer: args?.customer as any, cartItem: [] };
        await valkeyService.saveCart(cart as any);
        return { content: [{ type: 'text', text: `Cart created successfully (${keyType}): ${id}` }] };
    }
  • src/index.ts:64-80 (registration)
    Tool registration for 'create_cart' within the ListToolsRequestSchema handler in src/index.ts.
    {
        name: 'create_cart',
        description: 'Create a new TMF663 shopping cart. If W3SHIP_PUBLIC_KEY is configured, it is used automatically — no id required. Otherwise provide an SLH-DSA or ECDSA public key (hex).',
        inputSchema: {
            type: 'object',
            properties: {
                id: { type: 'string', description: 'Public key (hex). Optional if W3SHIP_PUBLIC_KEY env var is set.' },
                customer: {
                    type: 'object',
                    properties: {
                        id: { type: 'string' },
                        name: { type: 'string' },
                    },
                },
            },
        },
    },
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses authentication behavior (env var vs SLH-DSA/ECDSA hex keys) well, but lacks disclosure on return values, idempotency, side effects, or cart persistence behavior.

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. Front-loaded with purpose (TMF663 cart creation), followed immediately by configuration logic. Every word earns its place.

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?

Moderate complexity tool with no output schema. Description adequately covers the non-trivial authentication flow but fails to document the customer parameter structure or hint at return value expectations.

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 coverage is 50%. Description adds value for 'id' parameter (key algorithm types SLH-DSA/ECDSA, conditional requirement logic) beyond schema. However, completely omits documentation for the 'customer' object and its sub-fields (id, name).

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?

Description uses specific verb 'Create' with resource 'TMF663 shopping cart'. The TMF663 reference distinguishes it from generic carts, and clearly differentiates from siblings like get_cart (retrieval) and delete_cart (deletion).

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

Usage Guidelines4/5

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

Provides explicit conditional logic for when the 'id' parameter is required versus when W3SHIP_PUBLIC_KEY environment variable suffices. Could improve by distinguishing from sibling create_order or create_listing tools.

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