fix(mcp): file a transit fare under the transport cost category

transit is not one of the fixed Costs categories, so typeToCostCategory
would put an uncategorised fare under other. Default to transport, the
category every rail and bus booking maps to.
This commit is contained in:
bear
2026-10-26 04:19:24 +08:00
committed by Maurice
parent 8d10bff616
commit 547f0b84b0
3 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -198,7 +198,7 @@ export class TransitMcp {
price: bookingPriceSchema.optional().describe('Fare — shown on the journey and linked in the Budget tab'),
budget_category: bookingBudgetCategorySchema
.optional()
.describe('Budget category for the fare entry (defaults to transit)'),
.describe('Budget category for the fare entry (defaults to transport)'),
},
annotations: TOOL_ANNOTATIONS_OPEN_WORLD_NON_IDEMPOTENT,
access: { group: 'reservations', mode: 'write' },
@@ -283,9 +283,11 @@ export class TransitMcp {
};
}
// The fare files the linked expense in the booking's own transaction and
// rides along in the metadata, as create_transport's price does.
// rides along in the metadata, as create_transport's price does. `transit`
// is no Costs category (typeToCostCategory would file it under other), so a
// fare defaults to the one every rail and bus booking maps to.
const linkedCost =
price != null && price > 0 ? { total_price: price, category: budget_category || 'transit' } : undefined;
price != null && price > 0 ? { total_price: price, category: budget_category || 'transport' } : undefined;
const { reservation } = await this.writes.createBooking(
String(tripId),
{