Skip to main content
Glama

Link to buy on cp.pt

link_compra
Read-onlyIdempotent

Generates a cp.pt purchase link for a selected train journey, letting users complete ticket selection, passenger details, and payment on cp.pt without reserving seats or handling payment data.

Instructions

Returns a cp.pt link that opens the search results for a journey, so the user can pick the train, enter passenger details and pay on cp.pt. Pass option_id from horarios to also say which train to select, or from/to/date. This does not reserve seats, create a sale or take any personal or payment data; the user completes the purchase on cp.pt.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "link_compra"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoDestination station name or code (when no option_id)
dateNoTravel date YYYY-MM-DD, default today
fromNoOrigin station name or code (when no option_id)
langNocp.pt page languagept
option_idNoOption id from horarios, copied exactly, e.g. '2026-11-30_94-30007_94-2006_c2_p1_out521'
passengersNoAdults, default 1
return_dateNo
travel_classNoDefault 2

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint/idempotentHint/destructiveHint=false, but the description adds materially: 'This does not reserve seats, create a sale or take any personal or payment data' — it preempts the most likely agent misconception about a booking-related tool. That is genuine behavioral context beyond the structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with what is returned, then the input modes, then the safety disclaimer. Every clause earns its place and nothing is repeated from the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter, low-risk link generator with no output schema, the description covers what is returned (a cp.pt URL) and what side effects do not occur, which is the essential information. Minor gaps — behavior when option_id is malformed or stale, and any link expiry — are not covered, but they are not critical for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 88%, so the baseline is 3 and the schema already documents option_id, passengers, lang and travel_class. The description adds the conditional relationship the schema only hints at via 'when no option_id': the option_id path versus the from/to/date path, which is the decision an agent actually has to make.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Returns a cp.pt link that opens the search results for a journey') and immediately names the downstream outcome (user picks train, enters details, pays on cp.pt). It also references the sibling 'horarios' as the source of option_id, so an agent can separate this link-builder from the schedule-search tools without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives two concrete invocation paths: 'Pass option_id from horarios to also say which train to select, or from/to/date', which tells the agent which input mode to use depending on what it already has. It also states the boundary of responsibility (the user completes the purchase on cp.pt). It stops short of an explicit when-not-to-use statement, so it is clear context rather than a full routing rule.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.