ot_sell
Sell surplus supplies at a trading post or fort. Accept a loss on price to get cash and lighten your wagon load.
Instructions
Sell surplus supplies at a trading post or fort. You'll take a loss — traders know you're desperate — but cash in hand beats dead weight in the wagon. Only available where trading is possible. Ammo isn't worth selling. Sell prices: food=$1/day (buy $2), medicine=$4/dose (buy $6), parts=$6 (buy $10), oxen=$12 (buy $20). You must keep at least 1 ox.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | Yes | What to sell | |
| quantity | Yes | How much to sell |
Implementation Reference
- src/games/oregontrail.ts:978-1012 (handler)The ot_sell tool handler — sells surplus supplies at trading posts/forts. Validates game state, checks trade availability, enforces minimum 1 ox constraint, calculates sell price (at a loss vs buy price), updates supplies and money, logs the transaction, and returns the updated game state.
server.tool( "ot_sell", "Sell surplus supplies at a trading post or fort. You'll take a loss — traders know you're desperate — but cash in hand beats dead weight in the wagon. Only available where trading is possible. Ammo isn't worth selling. Sell prices: food=$1/day (buy $2), medicine=$4/dose (buy $6), parts=$6 (buy $10), oxen=$12 (buy $20). You must keep at least 1 ox.", { item: z.enum(["food", "medicine", "parts", "oxen"]).describe("What to sell"), quantity: z.number().int().min(1).describe("How much to sell"), }, async ({ item, quantity }) => { if (!otGame) return { content: [{ type: "text", text: "No journey in progress." }], isError: true }; const stop = otGame.trailStops[otGame.currentStopIndex]; if (!stop.canTrade) return { content: [{ type: "text", text: `No trading available here. Reach a fort or trading post.\n\n${renderState(otGame)}` }], isError: true }; const sellPrices: Record<string, number> = { food: 1, medicine: 4, parts: 6, oxen: 12 }; const buyPrices: Record<string, number> = { food: 2, medicine: 6, parts: 10, oxen: 20 }; const current = (otGame.supplies as unknown as Record<string, number>)[item] as number; if (item === "oxen" && otGame.supplies.oxen - quantity < 1) { return { content: [{ type: "text", text: `You need at least 1 ox to keep moving. Can't sell that many.\n\n${renderState(otGame)}` }], isError: true }; } if (current < quantity) { return { content: [{ type: "text", text: `You only have ${current} ${item} to sell.\n\n${renderState(otGame)}` }], isError: true }; } const earned = sellPrices[item] * quantity; const loss = (buyPrices[item] - sellPrices[item]) * quantity; otGame.supplies.money += earned; (otGame.supplies as unknown as Record<string, number>)[item] -= quantity; log(otGame, `Sold ${quantity} ${item} for $${earned}.`); return { content: [{ type: "text", text: `Sold ${quantity} ${item} for $${earned}. (Cost $${buyPrices[item] * quantity} to rebuy — a $${loss} loss. Needs must.)\n\n${renderState(otGame)}` }], }; } ); - src/games/oregontrail.ts:981-984 (schema)Input schema for ot_sell — validates 'item' (food/medicine/parts/oxen) and 'quantity' (positive integer).
{ item: z.enum(["food", "medicine", "parts", "oxen"]).describe("What to sell"), quantity: z.number().int().min(1).describe("How much to sell"), }, - src/games/oregontrail.ts:978-985 (registration)The server.tool() call that registers the 'ot_sell' tool with the MCP server, including its description and Zod schema.
server.tool( "ot_sell", "Sell surplus supplies at a trading post or fort. You'll take a loss — traders know you're desperate — but cash in hand beats dead weight in the wagon. Only available where trading is possible. Ammo isn't worth selling. Sell prices: food=$1/day (buy $2), medicine=$4/dose (buy $6), parts=$6 (buy $10), oxen=$12 (buy $20). You must keep at least 1 ox.", { item: z.enum(["food", "medicine", "parts", "oxen"]).describe("What to sell"), quantity: z.number().int().min(1).describe("How much to sell"), }, async ({ item, quantity }) => {