Skip to main content
Glama
baskcart

W3Ship MCP Server

by baskcart

claim_promo

Claim free promotional items from listings by choosing shipping or pickup options. Requires a registered W3Ship identity and wallet address for verification.

Instructions

Claim a FREE promotional listing. Items are $0. For shipping promos you pay shipping only; for pickup promos it is completely free. One claim per wallet. Must have a registered W3Ship/Dah.mx identity (address required for shipping, wallet-only for pickup).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listingIdYesThe promotional listing ID to claim
publicKeyNoYour public key / wallet address for identity verification. Uses W3SHIP_PUBLIC_KEY if not provided.
fulfillmentChoiceNoHow to receive the item: "ship" (mailed to your address — may have shipping cost) or "pickup" (free, collect at pickup location). Defaults based on listing configuration.
pickupLocationIdNoID of the pickup location (required when multiple pickup locations exist and fulfillmentChoice is "pickup")

Implementation Reference

  • The handler implementation for the 'claim_promo' MCP tool, which performs an identity-verified promotional claim by calling the W3Ship API.
    case 'claim_promo': {
        const { listingId: claimListingId, publicKey: claimPK, fulfillmentChoice: claimFulfillment, pickupLocationId: claimPickupId } = args as any;
        const claimKey = claimPK || CONFIGURED_KEY;
    
        if (!claimKey) {
            return {
                content: [{ type: 'text', text: 'Error: Public key required to claim. Set W3SHIP_PUBLIC_KEY or provide publicKey.' }],
                isError: true,
            };
        }
    
        try {
            const claimRes = await fetch(`${W3SHIP_API}/api/listing/claim`, {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({
                    listingId: claimListingId,
                    publicKey: claimKey,
                    ...(claimFulfillment ? { fulfillmentChoice: claimFulfillment } : {}),
                    ...(claimPickupId ? { pickupLocationId: claimPickupId } : {}),
                }),
            });
            const claimData = await claimRes.json() as any;
    
            if (!claimRes.ok) {
                return {
                    content: [{
                        type: 'text',
                        text: JSON.stringify({
                            claimed: false,
                            error: claimData.error || 'Claim failed',
                            alreadyClaimed: claimData.alreadyClaimed || false,
                            ...(claimData.registerUrl ? { registerUrl: claimData.registerUrl } : {}),
                            ...(claimData.pickupLocations ? { availablePickupLocations: claimData.pickupLocations } : {}),
                        }, null, 2)
                    }],
                    isError: true,
                };
            }
    
            // Build response based on fulfillment type
            const isPickup = claimData.fulfillment === 'pickup';
            return {
                content: [{
                    type: 'text',
                    text: JSON.stringify({
                        claimed: true,
                        claimId: claimData.claimId,
                        fulfillment: claimData.fulfillment || 'ship',
                        item: claimData.listing?.title,
                        ...(isPickup ? {
                            pickupLocation: claimData.pickupLocation,
                            instructions: claimData.instructions,
                            cost: 'FREE',
                        } : {
                            shippingCost: claimData.listing?.shippingCost
                                ? `${claimData.listing.shippingCost} ${claimData.listing.currency}`
                                : 'FREE',
                        }),
                        remaining: claimData.listing?.remaining,
                        message: claimData.message,
                        nextStep: isPickup
                            ? `Show your claim ID "${claimData.claimId}" at ${claimData.pickupLocation?.name || 'the pickup location'} to collect your item.`
                            : `Add listing "${claimListingId}" to your cart and create an order. ${claimData.listing?.shippingCost ? `You'll pay ${claimData.listing.shippingCost} ${claimData.listing.currency} for shipping.` : ''}`,
                    }, null, 2)
                }]
            };
        } catch (e: any) {
            return { content: [{ type: 'text', text: `Error claiming promo: ${e.message}` }], isError: true };
        }
    }
  • src/index.ts:354-366 (registration)
    The registration of the 'claim_promo' tool in the ListToolsRequestSchema handler.
        name: 'claim_promo',
        description: 'Claim a FREE promotional listing. Items are $0. For shipping promos you pay shipping only; for pickup promos it is completely free. One claim per wallet. Must have a registered W3Ship/Dah.mx identity (address required for shipping, wallet-only for pickup).',
        inputSchema: {
            type: 'object',
            properties: {
                listingId: { type: 'string', description: 'The promotional listing ID to claim' },
                publicKey: { type: 'string', description: 'Your public key / wallet address for identity verification. Uses W3SHIP_PUBLIC_KEY if not provided.' },
                fulfillmentChoice: { type: 'string', description: 'How to receive the item: "ship" (mailed to your address — may have shipping cost) or "pickup" (free, collect at pickup location). Defaults based on listing configuration.' },
                pickupLocationId: { type: 'string', description: 'ID of the pickup location (required when multiple pickup locations exist and fulfillmentChoice is "pickup")' },
            },
            required: ['listingId'],
        },
    },
Behavior4/5

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

With no annotations provided, the description carries full disclosure burden and succeeds in explaining cost structures (free items vs shipping costs), identity verification requirements, and claim limits. It omits explicit mutation confirmation or idempotency details.

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?

Three dense sentences efficiently cover purpose, pricing structure, and prerequisites without repetition. Every clause adds unique information (cost breakdown by fulfillment method, wallet limits, identity requirements).

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?

Given 100% schema coverage and no output schema, the description adequately covers the tool's complexity, including conditional logic for fulfillment methods. It could explicitly mention the pickupLocationId requirement for multi-location scenarios, though the schema handles this.

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

Parameters4/5

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

While schema coverage is 100% (baseline 3), the description adds crucial business context: it explains that 'promotional' means $0, clarifies the cost implications of 'ship' vs 'pickup' choices, and explains identity requirements that bridge publicKey and fulfillmentChoice parameters.

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?

The description opens with a specific verb ('Claim') and resource ('FREE promotional listing'), clearly distinguishing this from sibling purchase tools like create_order or confirm_payment by emphasizing the $0 cost and promotional nature.

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?

It provides clear prerequisites ('Must have a registered W3Ship/Dah.mx identity') and constraints ('One claim per wallet') that establish when the tool is applicable, though it doesn't explicitly name sibling alternatives to avoid.

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