diff --git a/server/src/nest/transit/transit.mcp.ts b/server/src/nest/transit/transit.mcp.ts index f102be81c..ce4adc027 100644 --- a/server/src/nest/transit/transit.mcp.ts +++ b/server/src/nest/transit/transit.mcp.ts @@ -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), { diff --git a/server/tests/unit/mcp/tools-transit.test.ts b/server/tests/unit/mcp/tools-transit.test.ts index 78fba5acb..86c6c03b5 100644 --- a/server/tests/unit/mcp/tools-transit.test.ts +++ b/server/tests/unit/mcp/tools-transit.test.ts @@ -273,7 +273,7 @@ describe('MCP transit tools', () => { }), ) as { reservation: { id: number; metadata: string } }; const item = await findRow(orm, BudgetItems, { reservation: result.reservation.id }); - expect(item).toMatchObject({ name: 'Namba → Umeda', category: 'transit', total_price: 240 }); + expect(item).toMatchObject({ name: 'Namba → Umeda', category: 'transport', total_price: 240 }); expect(JSON.parse(result.reservation.metadata).price).toBe('240'); expect(broadcastMock.mock.calls.some((c) => c[1] === 'budget:created')).toBe(true); expect(broadcastMock.mock.calls.some((c) => c[1] === 'reservation:created')).toBe(true); diff --git a/wiki/MCP-Tools-and-Resources.md b/wiki/MCP-Tools-and-Resources.md index 788aadbf2..398165e46 100644 --- a/wiki/MCP-Tools-and-Resources.md +++ b/wiki/MCP-Tools-and-Resources.md @@ -134,7 +134,7 @@ Transit search is powered by the configured transit provider (Transitous by defa |---|---|---| | `search_transit_stops` | `geo:read` | Search real public-transit stops and stations, optionally biased around coordinates. | | `search_transit_routes` | `geo:read` | Search scheduled routes between two coordinates with time, mode, and transfer filters. Also returns `provider` (`transitous` or `google`, the backend that answered) and `dropped`, the number of provider itineraries that failed validation and are absent from the results. | -| `create_transit_journey` | `reservations:write` | Save a selected route as a first-class automated transit journey on a trip day. Pass `provider` from `search_transit_routes` to preserve the actual source, including fallback results. Older callers that omit it retain the configured-provider behavior. `price` records the fare as an expense linked to the journey (`budget_category`, `transit` by default). | +| `create_transit_journey` | `reservations:write` | Save a selected route as a first-class automated transit journey on a trip day. Pass `provider` from `search_transit_routes` to preserve the actual source, including fallback results. Older callers that omit it retain the configured-provider behavior. `price` records the fare as an expense linked to the journey (`budget_category`, `transport` by default). | ### Reservations