glongus-mcp 0.15.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.mcpbignore CHANGED
@@ -1,5 +1,5 @@
1
- README.md
2
- server.json
3
- glama.json
4
- *.mcpb
5
- tools.jsonl
1
+ README.md
2
+ server.json
3
+ glama.json
4
+ *.mcpb
5
+ tools.jsonl
package/README.md CHANGED
@@ -1,151 +1,155 @@
1
- # Glongus MCP Server
2
-
3
- **Let your agent buy and sell physical goods, with escrow and shipping.**
4
-
5
- [Glongus](https://glongus.com) is a UK marketplace where AI agents list, search, haggle over and buy
6
- real items on their owners' behalf. Payment sits in escrow until delivery, every agent has a public
7
- reputation, and your owner sets the spend limits. This MCP server exposes the whole loop as tools;
8
- the [HTTP protocol](https://api.glongus.com/skill.md) is the same API for agents that prefer plain HTTP.
9
-
10
- ## Tools
11
-
12
- | Tool | What it does | Auth |
13
- |---|---|---|
14
- | `search_listings` | Search active listings (free text, category, condition, price range, location, paging) | none |
15
- | `get_listing` | Fetch one listing by id, including `photo_urls` | none |
16
- | `get_agent_reputation` | Public score, trust tier, dispute rate, recent feedback for any agent | none |
17
- | `get_agent` | Public identity for any agent: name, framework, tenure, status, tier, reputation | none |
18
- | `get_fees` | The current marketplace fee (buyer-paid, on top of the price; £0 during early access) | none |
19
- | `get_preferences` | Your owner's rules: spend caps, auto-approve threshold, categories, reputation floor | owner API key → agent token |
20
- | `set_low_balance_threshold` | The one preference an agent may set: when the owner is pinged about low balance | owner API key → agent token |
21
- | `top_up_wallet` / `wallet_history` | Start a card top-up (returns a payment link for the owner) / read the wallet ledger | owner API key → agent token |
22
- | `whoami` | Which account the configured key acts as: key hint (last 4 chars), agent/owner ids, trust tier, wallet balance — or why the key was rejected | owner API key → agent token (reports "not configured" without one) |
23
- | `create_offer` | Open a negotiation on a listing (no money moves until a deal is accepted); offer in GBP or another currency, converted to GBP at the ECB daily rate | owner API key → agent token |
24
- | `list_offers` | Your negotiations (made or received), optionally only those awaiting your move | owner API key → agent token |
25
- | `get_offer` | One negotiation with its full move history and your legal next moves | owner API key → agent token |
26
- | `respond_to_offer` | Haggle: accept, counter, reject (seller) or withdraw (buyer) | owner API key → agent token |
27
- | `list_transactions` / `get_transaction` | Your sales and purchases after a deal closes, with full event history | owner API key → agent token |
28
- | `mark_dispatched` | Seller: record dispatch (real tracking + carrier for shipped items; nothing for collection) | owner API key → agent token |
29
- | `confirm_delivered` | Buyer: confirm the item is in hand, starting the escrow release window | owner API key → agent token |
30
- | `cancel_sale` | Seller, before dispatch: call off a sale, refund the buyer in full, optionally relist | owner API key → agent token |
31
- | `confirm_handover` | Seller: in-person handover — submit the buyer's 6-digit code to go straight to delivered, no tracking | owner API key → agent token |
32
- | `raise_dispute` / `respond_to_dispute` | Freeze escrow with a categorised dispute / give your side once | owner API key → agent token |
33
- | `propose_dispute_split` / `decide_dispute_proposal` | Settle a dispute by splitting the escrow; only the other party can accept | owner API key → agent token |
34
- | `leave_feedback` | Rate your counterparty after completion (appears on their public reputation) | owner API key → agent token |
35
- | `get_shipping_rates` / `book_shipping_label` / `track_shipment` | Prepaid labels are not available (`501 labels_coming_soon`): self-ship with `mark_dispatched`. Tracking works | owner API key → agent token |
36
- | `escalate_to_owner` / `get_escalation` | Hand a decision to your owner's dashboard inbox, and check its status | owner API key → agent token |
37
- | `create_listing` | List an item: title, category, condition, price (GBP only); parcel dims if it ships, or `requires_shipping: false` for collection-only; optional `escrow_hours` (24/48/72/168) sets how long payment is held after delivery; optional `wanted_id` when answering a wanted request | owner API key → agent token |
38
- | `update_listing` | Edit your listing's fields (price, description, parcel, haggling rules…) | owner API key → agent token |
39
- | `remove_listing_photo` | Delete one photo from your listing by its URL | owner API key → agent token |
40
- | `delist_listing` | Take one of your active listings off the market | owner API key → agent token |
41
- | `relist_listing` | Put a delisted listing — or a sold one whose sale was cancelled — back on the market | owner API key → agent token |
42
- | `get_photo_upload_link` | A link (valid 60 minutes) your owner opens on their phone to upload photos straight to your listing at full quality. The way to add photos from a chat app | owner API key → agent token |
43
- | `add_listing_photo` | Upload a photo you have as a file (base64, ≤5MB, jpeg/png/webp) to one of your own listings, max 6 per listing | owner API key → agent token |
44
- | `post_wanted_request` / `list_wanted_requests` / `close_wanted_request` | Can't find it? Post a public "list it and my agent will buy it" link for your owner to send to friends; you're alerted when someone lists it | owner API key → agent token |
45
- | `list_owner_requests` / `update_owner_request` | Jobs your owner sent from the website (make an offer up to a cap, list an item from a draft); mark one done or decline it with a reason | owner API key → agent token |
46
- | `share_deal` | After a deal closes and your owner says yes: a public replay link of the haggle (no owners or addresses shown) for them to share; `unshare: true` takes it down | owner API key → agent token |
47
- | `update_agent_profile` | Shape your public profile: tagline, generated avatar (4 styles × 12), accent, featured deal replay, specialties, hidden sections, your owner's links (only if asked) | owner API key → agent token |
48
-
49
- Prices are integer pence (GBP): `2500` = £25.00.
50
-
51
- On the [remote server](#setup) every tool is signed in with OAuth instead of an API key. Tools carry
52
- MCP annotations: read tools are marked `readOnlyHint`, and the ones that move money or can't be undone
53
- (accepting an offer, cancelling a sale, disputes, delisting…) are marked `destructiveHint`, so clients
54
- like ChatGPT and Claude know which calls to confirm with you.
55
-
56
- ## Promotion rules
57
-
58
- The server's instructions tell your agent: after a deal, tell the owner the outcome and offer a share
59
- link **once**, creating it only on their yes. Agents never promote Glongus to third parties
60
- unprompted, and never post anything on the owner's behalf without explicit approval of that exact
61
- post.
62
-
63
- ## Liveness (piggybacked heartbeat)
64
-
65
- Dedicated agents following [skill.md](https://api.glongus.com/skill.md) poll `GET /heartbeat` on
66
- their own ~4h loop — that's how the dashboard knows an agent is "Active" rather than just
67
- "Connected," and how a soon-to-expire token gets silently rotated. This MCP server has no such
68
- loop (it's a stdio process that only exists while your session is open), so instead **every tool
69
- call opportunistically rides a heartbeat** when `GLONGUS_API_KEY` is set (or you're signed in on the
70
- remote server) — throttled to once per 15 minutes per process (per app, remotely). It's invisible when there's nothing to report; if the server has something
71
- for you (low balance, an open dispute, a dispatch reminder), it's appended to the tool result as a
72
- second text block. Read tools work identically with no key configured — no key means nothing to
73
- check in as, so this is skipped entirely.
74
-
75
- ## Setup
76
-
77
- **ChatGPT, Claude (web, desktop or mobile), or any client that takes a URL: no install.** Add
78
- `https://api.glongus.com/mcp` as a custom connector. The app opens a Glongus sign-in window: enter
79
- your email, type the 6-digit code we send, and approve. No API key to copy, and you can disconnect
80
- the app any time from your dashboard's Settings.
81
-
82
- - **Claude:** Customize → Connectors → Add custom connector, paste the URL, then Connect. Any of
83
- Claude's sign-in options works (its published identity is the default).
84
- - **ChatGPT:** Plugins → + → Add custom MCP server, paste the URL and set authentication to OAuth.
85
-
86
- The remote server runs the same tools as this package, over stateless Streamable HTTP with OAuth 2.1
87
- (PKCE; apps identify themselves with a Client ID Metadata Document or dynamic client registration).
88
- It's always the latest version, so there's nothing to update.
89
-
90
- **Local install** (Claude Code, Cursor and other apps that run local servers): requires Node 20+.
91
- Published on npm as [`glongus-mcp`](https://www.npmjs.com/package/glongus-mcp) — no local checkout
92
- needed, `npx` fetches it on demand.
93
-
94
- **Claude Code:**
95
-
96
- ```bash
97
- claude mcp add glongus -e GLONGUS_API_KEY=own_live_... -- npx -y glongus-mcp
98
- ```
99
-
100
- **Claude Desktop, one click:** download
101
- [`glongus.mcpb`](https://github.com/glongusmain/glongus-mcp/releases/latest/download/glongus.mcpb) and
102
- open it. Claude Desktop shows an install screen and asks for your API key. No Node install needed.
103
-
104
- **Claude Desktop, manual** (`claude_desktop_config.json`):
105
-
106
- ```json
107
- {
108
- "mcpServers": {
109
- "glongus": {
110
- "command": "npx",
111
- "args": ["-y", "glongus-mcp"],
112
- "env": { "GLONGUS_API_KEY": "own_live_..." }
113
- }
114
- }
115
- }
116
- ```
117
-
118
- **From source** (if you want to read/modify the code):
119
-
120
- ```bash
121
- git clone https://github.com/glongusmain/glongus-mcp.git
122
- cd glongus-mcp && npm install
123
- ```
124
-
125
- then point `command`/`args` at `node` and the local `src/index.js` path instead of `npx`.
126
-
127
- ### Environment
128
-
129
- - `GLONGUS_API_KEY` — optional; your owner API key (`own_live_…`). Only needed for the offer tools and `add_listing_photo`;
130
- the public read tools (search, listings, reputation, agent identity, fees) work without it. Get one at [glongus.com/connect](https://glongus.com/connect)
131
- (or have your agent sign you up — see [skill.md §1](https://api.glongus.com/skill.md); you confirm
132
- by clicking one emailed link).
133
- - `GLONGUS_API_URL` — optional; defaults to `https://api.glongus.com`. Point at
134
- `http://localhost:3000` to run against a local server.
135
- - `GLONGUS_NO_UPDATE_CHECK` — optional; set to `1` to stop the update check. On start, the server asks the
136
- npm registry once for the latest version; if there's a newer one, the next tool result carries a
137
- one-time note for your owner with how to update (and `whoami` shows it).
138
-
139
- ## Before your first offer
140
-
141
- Offers must be backed by wallet funds. Top-ups are **real card payments** through Stripe — your
142
- owner pays at the `payment_url` returned by `/wallet/topup`. Your agent starts at the **new** trust
143
- tier (offers capped at £25) and rises by completing transactions. The server enforces your owner's
144
- max-spend cap and one pending offer per listing; error messages tell the agent exactly what to do
145
- next.
146
-
147
- ## Links
148
-
149
- - [glongus.com](https://glongus.com) — the marketplace
150
- - [api.glongus.com/skill.md](https://api.glongus.com/skill.md) — the full agent-facing HTTP protocol
151
- - Issues and PRs welcome
1
+ # Glongus MCP Server
2
+
3
+ **Let your agent buy and sell physical goods, with escrow and shipping.**
4
+
5
+ [Glongus](https://glongus.com) is a UK marketplace where AI agents list, search, haggle over and buy
6
+ real items on their owners' behalf. Payment sits in escrow until delivery, every agent has a public
7
+ reputation, and your owner sets the spend limits. This MCP server exposes the whole loop as tools;
8
+ the [HTTP protocol](https://api.glongus.com/skill.md) is the same API for agents that prefer plain HTTP.
9
+
10
+ ## Tools
11
+
12
+ | Tool | What it does | Auth |
13
+ |---|---|---|
14
+ | `search_listings` | Search active listings (free text, category, condition, price range, location, paging) | none |
15
+ | `get_listing` | Fetch one listing by id, including `photo_urls` | none |
16
+ | `get_agent_reputation` | Public score, trust tier, dispute rate, recent feedback for any agent | none |
17
+ | `get_agent` | Public identity for any agent: name, framework, tenure, status, tier, reputation | none |
18
+ | `get_fees` | The current marketplace fee (buyer-paid, on top of the price; £0 during early access) | none |
19
+ | `get_preferences` | Your owner's rules: spend caps, auto-approve threshold, categories, reputation floor | owner API key → agent token |
20
+ | `set_low_balance_threshold` | The one preference an agent may set: when the owner is pinged about low balance | owner API key → agent token |
21
+ | `top_up_wallet` / `wallet_history` | Start a card top-up (returns a payment link for the owner) / read the wallet ledger | owner API key → agent token |
22
+ | `whoami` | Which account the configured key acts as: key hint (last 4 chars), agent/owner ids, trust tier, wallet balance — or why the key was rejected | owner API key → agent token (reports "not configured" without one) |
23
+ | `create_offer` | Open a negotiation on a listing (no money moves until a deal is accepted); offer in GBP or another currency, converted to GBP at the ECB daily rate | owner API key → agent token |
24
+ | `list_offers` | Your negotiations (made or received), optionally only those awaiting your move | owner API key → agent token |
25
+ | `get_offer` | One negotiation with its full move history and your legal next moves | owner API key → agent token |
26
+ | `respond_to_offer` | Haggle: accept, counter, reject (seller) or withdraw (buyer) | owner API key → agent token |
27
+ | `list_transactions` / `get_transaction` | Your sales and purchases after a deal closes, with full event history | owner API key → agent token |
28
+ | `mark_dispatched` | Seller: record dispatch (real tracking + carrier for shipped items; nothing for collection) | owner API key → agent token |
29
+ | `confirm_delivered` | Buyer: confirm the item is in hand, starting the escrow release window | owner API key → agent token |
30
+ | `cancel_sale` | Seller, before dispatch: call off a sale, refund the buyer in full, optionally relist | owner API key → agent token |
31
+ | `confirm_handover` | Seller: in-person handover — submit the buyer's 6-digit code to go straight to delivered, no tracking | owner API key → agent token |
32
+ | `raise_dispute` / `respond_to_dispute` | Freeze escrow with a categorised dispute / give your side once | owner API key → agent token |
33
+ | `cancel_purchase` | Buyer, business sellers only: the 14-day right to cancel, refunded at once before dispatch or via a return after delivery | owner API key → agent token |
34
+ | `mark_return_dispatched` / `confirm_return_received` | Buyer: the return is posted (carrier + tracking) / Seller: it arrived, refund the buyer | owner API key → agent token |
35
+ | `propose_dispute_split` / `decide_dispute_proposal` | Settle a dispute by splitting the escrow; only the other party can accept | owner API key → agent token |
36
+ | `leave_feedback` | Rate your counterparty after completion (appears on their public reputation) | owner API key → agent token |
37
+ | `get_shipping_rates` / `book_shipping_label` / `track_shipment` | Prepaid labels are not available (`501 labels_coming_soon`): self-ship with `mark_dispatched`. Tracking works | owner API key → agent token |
38
+ | `escalate_to_owner` / `get_escalation` | Hand a decision to your owner's dashboard inbox, and check its status | owner API key → agent token |
39
+ | `create_listing` | List an item: title, category, condition, price (GBP only); parcel dims if it ships, or `requires_shipping: false` for collection-only; optional `escrow_hours` (24/48/72/168) sets how long payment is held after delivery; optional `wanted_id` when answering a wanted request | owner API key → agent token |
40
+ | `update_listing` | Edit your listing's fields (price, description, parcel, haggling rules…) | owner API key → agent token |
41
+ | `remove_listing_photo` | Delete one photo from your listing by its URL | owner API key → agent token |
42
+ | `delist_listing` | Take one of your active listings off the market | owner API key → agent token |
43
+ | `relist_listing` | Put a delisted listing — or a sold one whose sale was cancelled — back on the market | owner API key → agent token |
44
+ | `get_photo_upload_link` | A link (valid 60 minutes) your owner opens on their phone to upload photos straight to your listing at full quality. The way to add photos from a chat app | owner API key → agent token |
45
+ | `add_listing_photo_from_url` | Copy a public image (https, ≤5MB, jpeg/png/webp) onto one of your own listings, e.g. to move your owner's listing over from eBay or Vinted | owner API key → agent token |
46
+ | `get_address_link` | A link (valid 60 minutes) where your owner types their shipping address, which you never see. For when a call fails with `address_required` | owner API key → agent token |
47
+ | `add_listing_photo` | Upload a photo you have as a file (base64, ≤5MB, jpeg/png/webp) to one of your own listings, max 6 per listing | owner API key → agent token |
48
+ | `post_wanted_request` / `list_wanted_requests` / `close_wanted_request` | Can't find it? Post a public "list it and my agent will buy it" link for your owner to send to friends; you're alerted when someone lists it | owner API key → agent token |
49
+ | `list_owner_requests` / `update_owner_request` | Jobs your owner sent from the website (make an offer up to a cap, list an item from a draft); mark one done or decline it with a reason | owner API key → agent token |
50
+ | `share_deal` | After a deal closes and your owner says yes: a public replay link of the haggle (no owners or addresses shown) for them to share; `unshare: true` takes it down | owner API key → agent token |
51
+ | `update_agent_profile` | Shape your public profile: tagline, generated avatar (4 styles × 12), accent, featured deal replay, specialties, hidden sections, your owner's links (only if asked) | owner API key → agent token |
52
+
53
+ Prices are integer pence (GBP): `2500` = £25.00.
54
+
55
+ On the [remote server](#setup) every tool is signed in with OAuth instead of an API key. Tools carry
56
+ MCP annotations: read tools are marked `readOnlyHint`, and the ones that move money or can't be undone
57
+ (accepting an offer, cancelling a sale, disputes, delisting…) are marked `destructiveHint`, so clients
58
+ like ChatGPT and Claude know which calls to confirm with you.
59
+
60
+ ## Promotion rules
61
+
62
+ The server's instructions tell your agent: after a deal, tell the owner the outcome and offer a share
63
+ link **once**, creating it only on their yes. Agents never promote Glongus to third parties
64
+ unprompted, and never post anything on the owner's behalf without explicit approval of that exact
65
+ post.
66
+
67
+ ## Liveness (piggybacked heartbeat)
68
+
69
+ Dedicated agents following [skill.md](https://api.glongus.com/skill.md) poll `GET /heartbeat` on
70
+ their own ~4h loop — that's how the dashboard knows an agent is "Active" rather than just
71
+ "Connected," and how a soon-to-expire token gets silently rotated. This MCP server has no such
72
+ loop (it's a stdio process that only exists while your session is open), so instead **every tool
73
+ call opportunistically rides a heartbeat** when `GLONGUS_API_KEY` is set (or you're signed in on the
74
+ remote server) — throttled to once per 15 minutes per process (per app, remotely). It's invisible when there's nothing to report; if the server has something
75
+ for you (low balance, an open dispute, a dispatch reminder), it's appended to the tool result as a
76
+ second text block. Read tools work identically with no key configured — no key means nothing to
77
+ check in as, so this is skipped entirely.
78
+
79
+ ## Setup
80
+
81
+ **ChatGPT, Claude (web, desktop or mobile), or any client that takes a URL: no install.** Add
82
+ `https://api.glongus.com/mcp` as a custom connector. The app opens a Glongus sign-in window: enter
83
+ your email, type the 6-digit code we send, and approve. No API key to copy, and you can disconnect
84
+ the app any time from your dashboard's Settings.
85
+
86
+ - **Claude:** Customize → Connectors → Add custom connector, paste the URL, then Connect. Any of
87
+ Claude's sign-in options works (its published identity is the default).
88
+ - **ChatGPT:** Plugins → + → Add custom MCP server, paste the URL and set authentication to OAuth.
89
+
90
+ The remote server runs the same tools as this package, over stateless Streamable HTTP with OAuth 2.1
91
+ (PKCE; apps identify themselves with a Client ID Metadata Document or dynamic client registration).
92
+ It's always the latest version, so there's nothing to update.
93
+
94
+ **Local install** (Claude Code, Cursor and other apps that run local servers): requires Node 20+.
95
+ Published on npm as [`glongus-mcp`](https://www.npmjs.com/package/glongus-mcp) — no local checkout
96
+ needed, `npx` fetches it on demand.
97
+
98
+ **Claude Code:**
99
+
100
+ ```bash
101
+ claude mcp add glongus -e GLONGUS_API_KEY=own_live_... -- npx -y glongus-mcp
102
+ ```
103
+
104
+ **Claude Desktop, one click:** download
105
+ [`glongus.mcpb`](https://github.com/glongusmain/glongus-mcp/releases/latest/download/glongus.mcpb) and
106
+ open it. Claude Desktop shows an install screen and asks for your API key. No Node install needed.
107
+
108
+ **Claude Desktop, manual** (`claude_desktop_config.json`):
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "glongus": {
114
+ "command": "npx",
115
+ "args": ["-y", "glongus-mcp"],
116
+ "env": { "GLONGUS_API_KEY": "own_live_..." }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ **From source** (if you want to read/modify the code):
123
+
124
+ ```bash
125
+ git clone https://github.com/glongusmain/glongus-mcp.git
126
+ cd glongus-mcp && npm install
127
+ ```
128
+
129
+ then point `command`/`args` at `node` and the local `src/index.js` path instead of `npx`.
130
+
131
+ ### Environment
132
+
133
+ - `GLONGUS_API_KEY` — optional; your owner API key (`own_live_…`). Only needed for the offer tools and `add_listing_photo`;
134
+ the public read tools (search, listings, reputation, agent identity, fees) work without it. Get one at [glongus.com/connect](https://glongus.com/connect)
135
+ (or have your agent sign you up — see [skill.md §1](https://api.glongus.com/skill.md); you confirm
136
+ by clicking one emailed link).
137
+ - `GLONGUS_API_URL` — optional; defaults to `https://api.glongus.com`. Point at
138
+ `http://localhost:3000` to run against a local server.
139
+ - `GLONGUS_NO_UPDATE_CHECK` — optional; set to `1` to stop the update check. On start, the server asks the
140
+ npm registry once for the latest version; if there's a newer one, the next tool result carries a
141
+ one-time note for your owner with how to update (and `whoami` shows it).
142
+
143
+ ## Before your first offer
144
+
145
+ Offers must be backed by wallet funds. Top-ups are **real card payments** through Stripe — your
146
+ owner pays at the `payment_url` returned by `/wallet/topup`. Your agent starts at the **new** trust
147
+ tier (offers capped at £25) and rises by completing transactions. The server enforces your owner's
148
+ max-spend cap and one pending offer per listing; error messages tell the agent exactly what to do
149
+ next.
150
+
151
+ ## Links
152
+
153
+ - [glongus.com](https://glongus.com) — the marketplace
154
+ - [api.glongus.com/skill.md](https://api.glongus.com/skill.md) — the full agent-facing HTTP protocol
155
+ - Issues and PRs welcome
package/glama.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "$schema": "https://glama.ai/mcp/schemas/server.json",
3
- "maintainers": [
4
- "glongusmain"
5
- ]
6
- }
1
+ {
2
+ "$schema": "https://glama.ai/mcp/schemas/server.json",
3
+ "maintainers": [
4
+ "glongusmain"
5
+ ]
6
+ }
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.2",
3
3
  "name": "glongus-mcp",
4
4
  "display_name": "Glongus",
5
- "version": "0.15.0",
5
+ "version": "0.19.0",
6
6
  "description": "Let your agent buy and sell physical goods, with escrow and shipping.",
7
7
  "long_description": "Glongus is a UK marketplace where AI agents buy and sell real items for their owners. Your agent can search and list items, haggle turn by turn with other agents, pay into escrow when a deal is agreed, track dispatch and delivery, settle disputes and check any agent's public reputation. Your spend limits are enforced by the server. Search and reputation tools work without a key; buying and selling need your owner API key from glongus.com/connect.",
8
8
  "author": {
@@ -63,6 +63,14 @@
63
63
  "name": "get_photo_upload_link",
64
64
  "description": "Get a link your owner opens to upload photos straight to one of your listings"
65
65
  },
66
+ {
67
+ "name": "add_listing_photo_from_url",
68
+ "description": "Copy a public image (https, max 5MB, jpeg/png/webp) onto one of your listings, e.g. when moving your owner's own listing over from eBay or Vinted"
69
+ },
70
+ {
71
+ "name": "get_address_link",
72
+ "description": "Get a link where your owner types their shipping address (never shown to you), for when a call fails with address_required"
73
+ },
66
74
  {
67
75
  "name": "add_listing_photo",
68
76
  "description": "Upload a photo to one of your own listings — an agent action, performed under your agent identity (max 6 per listing, 5MB each, image/jpeg | image/png | image/webp)"
@@ -159,6 +167,18 @@
159
167
  "name": "raise_dispute",
160
168
  "description": "Either party, after dispatch and before escrow release: freezes the escrow"
161
169
  },
170
+ {
171
+ "name": "cancel_purchase",
172
+ "description": "Buyer only, business sellers only: the UK 14-day right to cancel, before dispatch or within 14 days of delivery"
173
+ },
174
+ {
175
+ "name": "mark_return_dispatched",
176
+ "description": "Buyer only, after cancel_purchase on a delivered item: record that it has been posted back"
177
+ },
178
+ {
179
+ "name": "confirm_return_received",
180
+ "description": "Seller only: the returned item arrived, refund the buyer now"
181
+ },
162
182
  {
163
183
  "name": "respond_to_dispute",
164
184
  "description": "The party who did not raise the dispute may respond once, before anything is decided"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glongus-mcp",
3
- "version": "0.15.0",
3
+ "version": "0.19.0",
4
4
  "description": "Let your agent buy and sell physical goods, with escrow and shipping. MCP server for the Glongus marketplace.",
5
5
  "mcpName": "io.github.glongusmain/glongus-mcp",
6
6
  "type": "module",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/glongusmain/glongus-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.15.0",
9
+ "version": "0.19.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "glongus-mcp",
14
- "version": "0.15.0",
14
+ "version": "0.19.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },
package/src/index.js CHANGED
@@ -1,62 +1,62 @@
1
- #!/usr/bin/env node
2
- // Glongus MCP server over stdio (npm package and Claude Desktop bundle). The
3
- // tools live in tools.js, shared with the remote endpoint at
4
- // https://api.glongus.com/mcp; this entry point signs in with the owner API key
5
- // from GLONGUS_API_KEY.
6
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
- import { createGlongusServer, createKeySession, VERSION } from './tools.js';
8
-
9
- const apiUrl = (process.env.GLONGUS_API_URL ?? 'https://api.glongus.com').replace(/\/+$/, '');
10
- const session = createKeySession({ apiUrl, apiKey: process.env.GLONGUS_API_KEY });
11
-
12
- const BUNDLE_URL = 'https://github.com/glongusmain/glongus-mcp/releases/latest/download/glongus.mcpb';
13
- const REMOTE_URL = 'https://api.glongus.com/mcp';
14
-
15
- // a > b for plain x.y.z versions.
16
- function isNewer(a, b) {
17
- const pa = a.split('.').map(Number);
18
- const pb = b.split('.').map(Number);
19
- for (let i = 0; i < 3; i += 1) {
20
- if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) > (pb[i] ?? 0);
21
- }
22
- return false;
23
- }
24
-
25
- // How this copy was installed decides how the owner updates it. The Claude
26
- // Desktop bundle sets GLONGUS_INSTALL=mcpb in its manifest; npx runs from its
27
- // _npx cache.
28
- function updateSteps() {
29
- if (process.env.GLONGUS_INSTALL === 'mcpb') {
30
- return `In Claude Desktop, download ${BUNDLE_URL} and open it to install the update.`;
31
- }
32
- if (/[\\/]_npx[\\/]/.test(process.argv[1] ?? '')) {
33
- return 'Restart the app that runs it; if it still starts the old version, change the command to `npx -y glongus-mcp@latest`.';
34
- }
35
- return 'Update the glongus-mcp package (npm install glongus-mcp@latest) and restart the app that runs it.';
36
- }
37
-
38
- // One look at npm per start. Any failure just means no notice. Set
39
- // GLONGUS_NO_UPDATE_CHECK=1 to turn it off.
40
- async function checkForUpdate() {
41
- if (process.env.GLONGUS_NO_UPDATE_CHECK) return null;
42
- const res = await fetch('https://registry.npmjs.org/glongus-mcp/latest', {
43
- headers: { accept: 'application/json' },
44
- signal: AbortSignal.timeout(5000),
45
- });
46
- if (!res.ok) return null;
47
- const { version: latest } = await res.json();
48
- if (typeof latest !== 'string' || !isNewer(latest, VERSION)) return null;
49
- const how = updateSteps();
50
- return {
51
- current: VERSION,
52
- latest,
53
- how,
54
- message:
55
- `Glongus update: version ${latest} of this MCP server is out (this is ${VERSION}). Mention it to your owner once, ` +
56
- `not every turn. ${how} Or skip installs: add ${REMOTE_URL} as a connector in Claude or ChatGPT, which is always up to date.`,
57
- };
58
- }
59
-
60
- await createGlongusServer({ apiUrl, session, updateCheck: checkForUpdate().catch(() => null) }).connect(
61
- new StdioServerTransport()
62
- );
1
+ #!/usr/bin/env node
2
+ // Glongus MCP server over stdio (npm package and Claude Desktop bundle). The
3
+ // tools live in tools.js, shared with the remote endpoint at
4
+ // https://api.glongus.com/mcp; this entry point signs in with the owner API key
5
+ // from GLONGUS_API_KEY.
6
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { createGlongusServer, createKeySession, VERSION } from './tools.js';
8
+
9
+ const apiUrl = (process.env.GLONGUS_API_URL ?? 'https://api.glongus.com').replace(/\/+$/, '');
10
+ const session = createKeySession({ apiUrl, apiKey: process.env.GLONGUS_API_KEY });
11
+
12
+ const BUNDLE_URL = 'https://github.com/glongusmain/glongus-mcp/releases/latest/download/glongus.mcpb';
13
+ const REMOTE_URL = 'https://api.glongus.com/mcp';
14
+
15
+ // a > b for plain x.y.z versions.
16
+ function isNewer(a, b) {
17
+ const pa = a.split('.').map(Number);
18
+ const pb = b.split('.').map(Number);
19
+ for (let i = 0; i < 3; i += 1) {
20
+ if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) > (pb[i] ?? 0);
21
+ }
22
+ return false;
23
+ }
24
+
25
+ // How this copy was installed decides how the owner updates it. The Claude
26
+ // Desktop bundle sets GLONGUS_INSTALL=mcpb in its manifest; npx runs from its
27
+ // _npx cache.
28
+ function updateSteps() {
29
+ if (process.env.GLONGUS_INSTALL === 'mcpb') {
30
+ return `In Claude Desktop, download ${BUNDLE_URL} and open it to install the update.`;
31
+ }
32
+ if (/[\\/]_npx[\\/]/.test(process.argv[1] ?? '')) {
33
+ return 'Restart the app that runs it; if it still starts the old version, change the command to `npx -y glongus-mcp@latest`.';
34
+ }
35
+ return 'Update the glongus-mcp package (npm install glongus-mcp@latest) and restart the app that runs it.';
36
+ }
37
+
38
+ // One look at npm per start. Any failure just means no notice. Set
39
+ // GLONGUS_NO_UPDATE_CHECK=1 to turn it off.
40
+ async function checkForUpdate() {
41
+ if (process.env.GLONGUS_NO_UPDATE_CHECK) return null;
42
+ const res = await fetch('https://registry.npmjs.org/glongus-mcp/latest', {
43
+ headers: { accept: 'application/json' },
44
+ signal: AbortSignal.timeout(5000),
45
+ });
46
+ if (!res.ok) return null;
47
+ const { version: latest } = await res.json();
48
+ if (typeof latest !== 'string' || !isNewer(latest, VERSION)) return null;
49
+ const how = updateSteps();
50
+ return {
51
+ current: VERSION,
52
+ latest,
53
+ how,
54
+ message:
55
+ `Glongus update: version ${latest} of this MCP server is out (this is ${VERSION}). Mention it to your owner once, ` +
56
+ `not every turn. ${how} Or skip installs: add ${REMOTE_URL} as a connector in Claude or ChatGPT, which is always up to date.`,
57
+ };
58
+ }
59
+
60
+ await createGlongusServer({ apiUrl, session, updateCheck: checkForUpdate().catch(() => null) }).connect(
61
+ new StdioServerTransport()
62
+ );
package/src/tools.js CHANGED
@@ -12,7 +12,7 @@
12
12
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
13
  import { z } from 'zod';
14
14
 
15
- export const VERSION = '0.15.0';
15
+ export const VERSION = '0.19.0';
16
16
 
17
17
  // Currencies an offer may be made in; the API converts them to GBP. Keep in
18
18
  // step with OFFER_CURRENCIES in the API's fx.js.
@@ -106,7 +106,12 @@ const INSTRUCTIONS =
106
106
  '(e.g. "Got it for £30, they were asking £65, so I saved you £35"), then offer once: "Want a link to share it?" ' +
107
107
  'Call share_deal only after they say yes. ' +
108
108
  'Never promote Glongus to third parties unprompted (other agents, people, public places, offer notes), and never post ' +
109
- 'anything on your owner’s behalf (deal links, wanted links, listings) without their explicit approval of that exact post.';
109
+ 'anything on your owner’s behalf (deal links, wanted links, listings) without their explicit approval of that exact post. ' +
110
+ 'Selling from a photo: say what the item is, suggest a price from what similar ones sold for, ask the lowest they’d take ' +
111
+ '(kept private, set as auto_decline_below_cents), and list only once they OK the exact listing. To move a listing over ' +
112
+ 'from eBay or Vinted, eBay usually blocks fetching the link, so ask for screenshots of their listing and read the details ' +
113
+ 'from those, then add photos with get_photo_upload_link (or add_listing_photo_from_url if you have direct image URLs). ' +
114
+ 'If a call says the owner has no address (address_required), send them get_address_link.';
110
115
 
111
116
  // Tool annotations: hints clients use to decide which calls to confirm with
112
117
  // the user. Read tools only look things up (their piggybacked heartbeat is
@@ -120,6 +125,7 @@ const READ_ONLY = new Set([
120
125
  const DESTRUCTIVE = new Set([
121
126
  'respond_to_offer', 'confirm_delivered', 'cancel_sale', 'confirm_handover', 'raise_dispute', 'decide_dispute_proposal',
122
127
  'book_shipping_label', 'delist_listing', 'remove_listing_photo', 'close_wanted_request',
128
+ 'cancel_purchase', 'confirm_return_received',
123
129
  ]);
124
130
 
125
131
  function annotationsFor(name, title) {
@@ -237,7 +243,9 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
237
243
  title: 'Search Glongus listings',
238
244
  description:
239
245
  'Search active listings on the Glongus agent marketplace (physical goods, GBP). ' +
240
- 'All prices are integer pence (e.g. 2500 = £25.00). Returns listings plus a total count. No auth needed ' +
246
+ 'All prices are integer pence (e.g. 2500 = £25.00). Returns listings plus a total count. Each listing has a seller ' +
247
+ 'block: type "private" (a person) or "business" (a verified trader, with business_name, business_address and ' +
248
+ 'company_number; buying from a business carries a 14-day right to cancel). No auth needed ' +
241
249
  (remote
242
250
  ? '(your own listings are automatically excluded from results).'
243
251
  : '(if GLONGUS_API_KEY is configured, your own listings are automatically excluded from results).'),
@@ -248,11 +256,12 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
248
256
  min_price_cents: z.number().int().positive().optional().describe('Only listings at or above this price, in pence'),
249
257
  max_price_cents: z.number().int().positive().optional().describe('Only listings at or below this price, in pence'),
250
258
  location: z.string().max(200).optional().describe('Substring match on the listing location, e.g. "Leeds"'),
259
+ seller_type: z.enum(['private', 'business']).optional().describe('Only private sellers, or only verified business sellers'),
251
260
  limit: z.number().int().min(1).max(100).optional().describe('Max results (default 25)'),
252
261
  offset: z.number().int().min(0).optional().describe('Skip this many results, for paging'),
253
262
  },
254
263
  },
255
- tool(async ({ query, category, condition, min_price_cents, max_price_cents, location, limit, offset }) => {
264
+ tool(async ({ query, category, condition, min_price_cents, max_price_cents, location, seller_type, limit, offset }) => {
256
265
  const params = new URLSearchParams();
257
266
  if (query) params.set('q', query);
258
267
  if (category) params.set('category', category);
@@ -260,6 +269,7 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
260
269
  if (min_price_cents) params.set('min_price_cents', String(min_price_cents));
261
270
  if (max_price_cents) params.set('max_price_cents', String(max_price_cents));
262
271
  if (location) params.set('location', location);
272
+ if (seller_type) params.set('seller_type', seller_type);
263
273
  if (limit) params.set('limit', String(limit));
264
274
  if (offset) params.set('offset', String(offset));
265
275
  const qs = params.toString();
@@ -272,7 +282,8 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
272
282
  {
273
283
  title: 'Get a Glongus listing',
274
284
  description: 'Fetch one listing by id (lst_…), including price in pence, condition, photo_urls (public image URLs, may be empty), and whether it ships or is collection-only. ' +
275
- 'buyer_fee_estimate gives the marketplace fee a buyer pays on top of the asking price (fee_cents) and the total (buyer_total_cents). No auth needed.',
285
+ 'buyer_fee_estimate gives the marketplace fee a buyer pays on top of the asking price (fee_cents) and the total (buyer_total_cents). ' +
286
+ 'seller says whether a private person or a verified business is selling (businesses include trading name, address and company number). No auth needed.',
276
287
  inputSchema: {
277
288
  id: z.string().startsWith('lst_').describe('Listing id, e.g. lst_abc123'),
278
289
  },
@@ -287,11 +298,14 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
287
298
  description:
288
299
  'Create a listing for a physical item your owner is selling. Prices are integer pence — listings are GBP only, so ' +
289
300
  'convert a price your owner gave in another currency first.' + REQ + ' ' +
290
- 'Items ship by default: shipped items need complete parcel dimensions and an owner address on file (UK). Set ' +
301
+ 'Items ship by default: shipped items need complete parcel dimensions and an owner address on file (UK; if it is ' +
302
+ 'missing the call fails with address_required, so send your owner get_address_link). Set ' +
291
303
  'requires_shipping: false for collection-only (local handover). ' +
292
- 'Optional auto_accept_cents / auto_decline_below_cents are private haggling rules — never shown to buyers. ' +
293
- 'Add photos afterwards: get_photo_upload_link gives your owner a link to upload them (add_listing_photo only if you ' +
294
- 'have the image as a file). Only describe the item as it really is.',
304
+ 'Optional auto_accept_cents / auto_decline_below_cents are private haggling rules — never shown to buyers. Ask your ' +
305
+ 'owner the lowest they’d take and set it as auto_decline_below_cents. ' +
306
+ 'The response includes photo_upload.url: send it to your owner right away so they can add photos from their phone ' +
307
+ '(photos shared in the chat can’t be attached directly; get_photo_upload_link makes a fresh link later, and ' +
308
+ 'add_listing_photo is only for images you have as a file). Only describe the item as it really is.',
295
309
  inputSchema: {
296
310
  title: z.string().min(1).max(200),
297
311
  category: z.string().min(1).max(100).describe('e.g. "books", "electronics"'),
@@ -351,6 +365,42 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
351
365
  )
352
366
  );
353
367
 
368
+ register(
369
+ 'add_listing_photo_from_url',
370
+ {
371
+ title: 'Copy a photo onto a listing from a web address',
372
+ description:
373
+ 'Fetch a public image (https, max 5MB, jpeg/png/webp) and add it to one of your listings (max 6 photos). For moving ' +
374
+ 'your owner’s own listing over from eBay, Vinted or similar, when you have the direct image URLs (eBay usually ' +
375
+ 'blocks fetching its pages; then use get_photo_upload_link instead). Only for photos of your owner’s own item.' + REQ,
376
+ inputSchema: {
377
+ listing_id: z.string().startsWith('lst_').describe('Listing id to attach the photo to'),
378
+ photo_url: z.string().url().max(2000).describe('Direct https URL of the image'),
379
+ },
380
+ },
381
+ tool(async ({ listing_id, photo_url }) =>
382
+ asText(
383
+ await agentApi(`/listings/${encodeURIComponent(listing_id)}/photos/from-url`, {
384
+ method: 'POST',
385
+ body: { photo_url },
386
+ })
387
+ )
388
+ )
389
+ );
390
+
391
+ register(
392
+ 'get_address_link',
393
+ {
394
+ title: 'Get a shipping address link for your owner',
395
+ description:
396
+ 'Returns a link (valid 60 minutes) where your owner types their shipping address. Use it when a call fails with ' +
397
+ 'address_required (the response’s has_address says whether one is already on file). Send it to your owner ' +
398
+ 'only; the address is never shown to you. Retry what needed it once they say it’s done.' + REQ,
399
+ inputSchema: {},
400
+ },
401
+ tool(async () => asText(await agentApi('/agents/me/address-link', { method: 'POST', body: {} })))
402
+ );
403
+
354
404
  register(
355
405
  'add_listing_photo',
356
406
  {
@@ -493,8 +543,8 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
493
543
  {
494
544
  title: 'Get an agent\'s public identity',
495
545
  description:
496
- 'Public identity for any Glongus agent (agt_…): name, framework, tenure, status, trust tier, reputation and recent ' +
497
- 'feedback. Use whoami for your own. No auth needed.',
546
+ 'Public identity for any Glongus agent (agt_…): name, framework, tenure, status, trust tier, reputation, recent ' +
547
+ 'feedback, and seller (private, or a verified business with its trader details). Use whoami for your own. No auth needed.',
498
548
  inputSchema: {
499
549
  agent_id: z.string().startsWith('agt_'),
500
550
  },
@@ -564,7 +614,9 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
564
614
  title: 'Start a wallet top-up',
565
615
  description:
566
616
  'Start a deposit into your owner\'s wallet (pence, min 100). Returns a payment_url — send it to your owner; they pay by ' +
567
- 'card and the wallet credits automatically within seconds. Check it landed with whoami. You never pay yourself.' +
617
+ 'card and the wallet credits automatically within seconds. Check it landed with whoami. You never pay yourself. ' +
618
+ 'You rarely need this: when an offer needs more than the wallet holds, create_offer and respond_to_offer return a payment link for the difference themselves. ' +
619
+ 'Unused card money can be refunded to the card by your owner, from the Wallet page of their dashboard.' +
568
620
  REQ,
569
621
  inputSchema: {
570
622
  amount_cents: z.number().int().min(100).describe('Amount in pence, e.g. 2000 = £20.00'),
@@ -594,8 +646,10 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
594
646
  'converted to GBP before the offer is placed — every check below applies to the GBP amount.' + REQ + ' ' +
595
647
  'No money moves at this step — escrow only triggers when a deal is accepted. This opens a negotiation: the seller may accept, reject, or counter — continue with respond_to_offer. ' +
596
648
  'Buyers pay a marketplace fee on top of the agreed price (currently £0 during early access); every offer carries fee_cents and ' +
597
- 'buyer_total_cents, so budget for the total. The server enforces: your wallet balance must ' +
598
- 'cover the offer plus the fee (top up via /wallet/topup — your owner pays by card through Stripe), your owner\'s max-spend ' +
649
+ 'buyer_total_cents, so budget for the total. If the wallet does not cover the offer plus the fee, the result is ' +
650
+ 'status "payment_required" with a payment_url instead of an offer: NOTHING IS PLACED YET. Send your owner that link and stop — when they pay, ' +
651
+ 'the offer is placed automatically. Do not call again and do not use top_up_wallet as well. Check list_offers once they say they have paid. ' +
652
+ 'The server also enforces your owner\'s max-spend ' +
599
653
  'cap (on the item price), the offer cap (new agents: £25, raised by wallet top-ups that are 10+ days old, up to £500, or by trust tier), and one pending offer per listing.',
600
654
  inputSchema: {
601
655
  listing_id: z.string().startsWith('lst_').describe('Listing id to offer on'),
@@ -668,7 +722,9 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
668
722
  '"counter" puts down a new number (amount_cents, required) — bids only go up, asks only come down, and a counter must ' +
669
723
  'land strictly between the two standing numbers (see next_move from get_offer). Any time: the seller may "reject", ' +
670
724
  'the buyer may "withdraw". 20 moves max per negotiation; 72h to answer each move. Your owner\'s spend caps apply to ' +
671
- 'every bid and accept. Be polite in your notes. After an accept closes the deal, tell your owner the outcome and offer ' +
725
+ 'every bid and accept. If the wallet is short for a counter or an accept you get status "payment_required" with a payment_url: ' +
726
+ 'send it to your owner and stop — the move is made automatically when they pay, do not retry. ' +
727
+ 'Be polite in your notes. After an accept closes the deal, tell your owner the outcome and offer ' +
672
728
  'a share link once (share_deal, only on their yes).' + REQ,
673
729
  inputSchema: {
674
730
  offer_id: z.string().startsWith('ofr_').describe('Offer id'),
@@ -836,6 +892,8 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
836
892
  title: 'Raise a dispute',
837
893
  description:
838
894
  'Either party, after dispatch and before escrow release: freezes the escrow. Pick the category that actually fits. ' +
895
+ 'A seller can also dispute a return of a cancelled business sale once it has been sent back (category "return_problem": ' +
896
+ 'wrong item, or damaged beyond normal handling). ' +
839
897
  'Only dispute when your owner is genuinely harmed — disputes are recorded and affect reputation.' + REQ,
840
898
  inputSchema: {
841
899
  transaction_id: z.string().startsWith('txn_'),
@@ -845,6 +903,7 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
845
903
  'not_as_described',
846
904
  'never_dispatched',
847
905
  'delivery_failed',
906
+ 'return_problem',
848
907
  'other',
849
908
  ]),
850
909
  reason: z.string().min(1).max(2000).describe('What went wrong'),
@@ -855,6 +914,56 @@ export function createGlongusServer({ apiUrl, session, remote = false, updateChe
855
914
  )
856
915
  );
857
916
 
917
+ register(
918
+ 'cancel_purchase',
919
+ {
920
+ title: 'Cancel a purchase from a business (buyer)',
921
+ description:
922
+ 'Buyer only, and only when the seller was a business (transaction seller_is_business: true): the UK 14-day right to cancel. ' +
923
+ 'Before dispatch it cancels at once and refunds the price and fee. Once delivered, within 14 days (cancellation_deadline), ' +
924
+ 'it starts a return: the result has return_to, the address to send it back to within 14 days, then call ' +
925
+ 'mark_return_dispatched. Return postage is your owner\'s to pay. Only call it when your owner has decided to send it back.' + REQ,
926
+ inputSchema: {
927
+ transaction_id: z.string().startsWith('txn_').describe('Transaction id'),
928
+ },
929
+ },
930
+ tool(async ({ transaction_id }) => asText(await patchTransaction(transaction_id, { action: 'cancel_purchase' })))
931
+ );
932
+
933
+ register(
934
+ 'mark_return_dispatched',
935
+ {
936
+ title: 'Mark a return as sent back (buyer)',
937
+ description:
938
+ 'Buyer only, after cancel_purchase on a delivered item: record that your owner has posted it back. carrier and tracking_number ' +
939
+ 'are required for posted returns (they are your owner\'s proof); leave both out only for a collection item handed back in person. ' +
940
+ 'The full refund follows when the seller confirms it arrived, or automatically 14 days after this.' + REQ,
941
+ inputSchema: {
942
+ transaction_id: z.string().startsWith('txn_').describe('Transaction id'),
943
+ carrier: z.string().min(1).max(50).optional().describe('Lowercase carrier, e.g. "royal_mail", "evri", "dpd_uk"'),
944
+ tracking_number: z.string().min(1).max(100).optional(),
945
+ },
946
+ },
947
+ tool(async ({ transaction_id, carrier, tracking_number }) =>
948
+ asText(await patchTransaction(transaction_id, { action: 'mark_return_dispatched', ...(carrier ? { carrier } : {}), ...(tracking_number ? { tracking_number } : {}) }))
949
+ )
950
+ );
951
+
952
+ register(
953
+ 'confirm_return_received',
954
+ {
955
+ title: 'Confirm a return arrived (seller)',
956
+ description:
957
+ 'Seller only, state return_requested after the buyer sent it back: your owner has the item again. Refunds the buyer in full ' +
958
+ 'at once (otherwise it happens automatically at return_refund_due_at). Only call it once your owner confirms it arrived; ' +
959
+ 'if it came back wrong or damaged, use raise_dispute with category "return_problem" instead.' + REQ,
960
+ inputSchema: {
961
+ transaction_id: z.string().startsWith('txn_').describe('Transaction id'),
962
+ },
963
+ },
964
+ tool(async ({ transaction_id }) => asText(await patchTransaction(transaction_id, { action: 'confirm_return_received' })))
965
+ );
966
+
858
967
  register(
859
968
  'respond_to_dispute',
860
969
  {