[
    {
        "name": "get_balance",
        "description": "Get the current account balance in USD (balance_cents is an integer number of cents). Requires API key scope `balance:read`.",
        "input_schema": {
            "type": "object",
            "properties": {}
        }
    },
    {
        "name": "get_shipping_rates",
        "description": "Get shipping offers (carrier, service, price in cents, delivery days) for a route and parcel, cheapest first. Each offer has a rate_id valid for 15 minutes and only for the same route and parcel. Free and safe to call. Show the options and prices to the user before buying. Requires API key scope `rates:read`.",
        "input_schema": {
            "type": "object",
            "properties": {
                "from": {
                    "type": "object",
                    "description": "Origin",
                    "properties": {
                        "country": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code, for example US"
                        },
                        "postal_code": {
                            "type": "string",
                            "description": "Postal code"
                        },
                        "city": {
                            "type": "string",
                            "description": "City (optional)"
                        },
                        "state": {
                            "type": "string",
                            "description": "State or region (optional)"
                        },
                        "line1": {
                            "type": "string",
                            "description": "Street address (optional)"
                        }
                    },
                    "required": [
                        "country",
                        "postal_code"
                    ]
                },
                "to": {
                    "type": "object",
                    "description": "Destination",
                    "properties": {
                        "country": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code, for example US"
                        },
                        "postal_code": {
                            "type": "string",
                            "description": "Postal code"
                        },
                        "city": {
                            "type": "string",
                            "description": "City (optional)"
                        },
                        "state": {
                            "type": "string",
                            "description": "State or region (optional)"
                        },
                        "line1": {
                            "type": "string",
                            "description": "Street address (optional)"
                        }
                    },
                    "required": [
                        "country",
                        "postal_code"
                    ]
                },
                "parcel": {
                    "type": "object",
                    "description": "Parcel size and weight",
                    "properties": {
                        "weight_g": {
                            "type": "integer",
                            "description": "Weight in grams"
                        },
                        "length_mm": {
                            "type": "integer",
                            "description": "Length in millimetres"
                        },
                        "width_mm": {
                            "type": "integer",
                            "description": "Width in millimetres"
                        },
                        "height_mm": {
                            "type": "integer",
                            "description": "Height in millimetres"
                        }
                    },
                    "required": [
                        "weight_g",
                        "length_mm",
                        "width_mm",
                        "height_mm"
                    ]
                },
                "declared_value_cents": {
                    "type": "integer",
                    "description": "Declared value in US cents (optional)"
                }
            },
            "required": [
                "from",
                "to",
                "parcel"
            ]
        }
    },
    {
        "name": "create_shipment",
        "description": "Buy a shipping label for a rate from get_shipping_rates. This spends money from the account balance. Before calling: show the user the carrier, service and exact price (price_cents) and get an explicit yes. The idempotency key is built automatically from the arguments, so repeating the same call never buys a second label. Fails for test keys. Requires API key scope `labels:create`. SPENDS MONEY: live key only. REQUIRES USER CONFIRMATION: describe the action and its cost to the user, and only after an explicit yes call again with confirm=true. Without confirm=true nothing is executed.",
        "input_schema": {
            "type": "object",
            "properties": {
                "rate_id": {
                    "type": "string",
                    "description": "rate_id from get_shipping_rates"
                },
                "from": {
                    "type": "object",
                    "description": "Sender",
                    "properties": {
                        "name": {
                            "type": "string",
                            "description": "Full name"
                        },
                        "company": {
                            "type": "string",
                            "description": "Company (optional)"
                        },
                        "line1": {
                            "type": "string",
                            "description": "Street address"
                        },
                        "line2": {
                            "type": "string",
                            "description": "Address line 2 (optional)"
                        },
                        "city": {
                            "type": "string",
                            "description": "City"
                        },
                        "state": {
                            "type": "string",
                            "description": "State or region"
                        },
                        "postal_code": {
                            "type": "string",
                            "description": "Postal code"
                        },
                        "country": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "phone": {
                            "type": "string",
                            "description": "Phone in international format"
                        },
                        "email": {
                            "type": "string",
                            "description": "Email (optional)"
                        }
                    },
                    "required": [
                        "name",
                        "line1",
                        "city",
                        "postal_code",
                        "country"
                    ]
                },
                "to": {
                    "type": "object",
                    "description": "Recipient",
                    "properties": {
                        "name": {
                            "type": "string",
                            "description": "Full name"
                        },
                        "company": {
                            "type": "string",
                            "description": "Company (optional)"
                        },
                        "line1": {
                            "type": "string",
                            "description": "Street address"
                        },
                        "line2": {
                            "type": "string",
                            "description": "Address line 2 (optional)"
                        },
                        "city": {
                            "type": "string",
                            "description": "City"
                        },
                        "state": {
                            "type": "string",
                            "description": "State or region"
                        },
                        "postal_code": {
                            "type": "string",
                            "description": "Postal code"
                        },
                        "country": {
                            "type": "string",
                            "description": "ISO 3166-1 alpha-2 country code"
                        },
                        "phone": {
                            "type": "string",
                            "description": "Phone in international format"
                        },
                        "email": {
                            "type": "string",
                            "description": "Email (optional)"
                        }
                    },
                    "required": [
                        "name",
                        "line1",
                        "city",
                        "postal_code",
                        "country"
                    ]
                },
                "parcel": {
                    "type": "object",
                    "description": "Parcel size and weight",
                    "properties": {
                        "weight_g": {
                            "type": "integer",
                            "description": "Weight in grams"
                        },
                        "length_mm": {
                            "type": "integer",
                            "description": "Length in millimetres"
                        },
                        "width_mm": {
                            "type": "integer",
                            "description": "Width in millimetres"
                        },
                        "height_mm": {
                            "type": "integer",
                            "description": "Height in millimetres"
                        }
                    },
                    "required": [
                        "weight_g",
                        "length_mm",
                        "width_mm",
                        "height_mm"
                    ]
                },
                "items": {
                    "type": "array",
                    "description": "Contents, required for international shipments",
                    "items": {
                        "type": "object",
                        "properties": {
                            "description": {
                                "type": "string",
                                "description": "What it is"
                            },
                            "quantity": {
                                "type": "integer",
                                "description": "Number of units"
                            },
                            "unit_value_cents": {
                                "type": "integer",
                                "description": "Price of one unit in US cents"
                            },
                            "origin_country": {
                                "type": "string",
                                "description": "Country of origin, ISO alpha-2"
                            },
                            "hs_code": {
                                "type": "string",
                                "description": "HS code (optional)"
                            }
                        },
                        "required": [
                            "description",
                            "quantity",
                            "unit_value_cents"
                        ]
                    }
                },
                "declared_value_cents": {
                    "type": "integer",
                    "description": "Declared value in US cents (defaults to the sum of the items)"
                },
                "confirm": {
                    "type": "boolean",
                    "description": "Set true only after the user explicitly confirmed this exact action."
                }
            },
            "required": [
                "rate_id",
                "from",
                "to",
                "parcel"
            ]
        }
    },
    {
        "name": "list_shipments",
        "description": "List shipments of the account, newest first. Requires API key scope `labels:read`.",
        "input_schema": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "string",
                    "description": "Filter, for example label_ready, in_transit, delivered, cancelled"
                },
                "limit": {
                    "type": "integer",
                    "description": "1 to 100, default 20"
                },
                "offset": {
                    "type": "integer",
                    "description": "Offset, default 0"
                }
            }
        }
    },
    {
        "name": "get_shipment",
        "description": "Get one shipment by id or tracking number: status, carrier, price, addresses, whether the label is available. Requires API key scope `labels:read`.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                }
            },
            "required": [
                "id"
            ]
        }
    },
    {
        "name": "cancel_shipment",
        "description": "Cancel a shipment; the money is returned to the balance when the carrier allows it. Ask the user to confirm first. Repeating is safe. Requires API key scope `labels:cancel`. REQUIRES USER CONFIRMATION: describe the action and its cost to the user, and only after an explicit yes call again with confirm=true. Without confirm=true nothing is executed.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                },
                "reason": {
                    "type": "string",
                    "description": "Reason, up to 255 characters (optional)"
                },
                "confirm": {
                    "type": "boolean",
                    "description": "Set true only after the user explicitly confirmed this exact action."
                }
            },
            "required": [
                "id"
            ]
        }
    },
    {
        "name": "get_tracking",
        "description": "Get tracking events of a shipment, newest first. Requires API key scope `tracking:read`.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                }
            },
            "required": [
                "id"
            ]
        }
    },
    {
        "name": "get_pickup_slots",
        "description": "List dates and time windows for a courier pickup of a shipment, and the pickup fee in cents. Requires API key scope `labels:read`.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                }
            },
            "required": [
                "id"
            ]
        }
    },
    {
        "name": "schedule_pickup",
        "description": "Order a courier pickup for a shipment using a slot id from get_pickup_slots. May charge a fee from the balance: show the fee to the user and get an explicit yes first. Fails for test keys. Requires API key scope `labels:create`. SPENDS MONEY: live key only. REQUIRES USER CONFIRMATION: describe the action and its cost to the user, and only after an explicit yes call again with confirm=true. Without confirm=true nothing is executed.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                },
                "slot_id": {
                    "type": "string",
                    "description": "Window id from get_pickup_slots"
                },
                "confirm": {
                    "type": "boolean",
                    "description": "Set true only after the user explicitly confirmed this exact action."
                }
            },
            "required": [
                "id",
                "slot_id"
            ]
        }
    },
    {
        "name": "cancel_pickup",
        "description": "Cancel the courier pickup of a shipment and return the pickup fee. The label itself stays. Ask the user to confirm first. Requires API key scope `labels:cancel`. REQUIRES USER CONFIRMATION: describe the action and its cost to the user, and only after an explicit yes call again with confirm=true. Without confirm=true nothing is executed.",
        "input_schema": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string",
                    "description": "Shipment id or tracking number"
                },
                "confirm": {
                    "type": "boolean",
                    "description": "Set true only after the user explicitly confirmed this exact action."
                }
            },
            "required": [
                "id"
            ]
        }
    }
]