Skip to main content

Crate transitous_core

Crate transitous_core 

Source
Expand description

Core of the transitous CLI and MCP server: configuration, the usage rules of the Transitous API, stop resolution and the status of connections.

Transitous is run by volunteers. Transitous keeps to its usage rules (https://transitous.org/api/): every request names a contact in the User-Agent, answers are cached, requests are counted and limited, and nothing is retried.

Re-exports§

pub use config::Config;
pub use service::DeparturesQuery;
pub use service::StopsQuery;
pub use service::Transitous;
pub use service::TripQuery;
pub use status::Status;

Modules§

agent
The User-Agent. Transitous asks every client to name a contact in it (https://transitous.org/api/), so there is no request without one.
cache
A cache of responses on disk, shared by every process on the machine, so that repeated calls do not reach Transitous. Stop searches keep for 15 minutes, connections, departures and trips for a minute, because their realtime data changes.
config
The configuration: the file, overridden by environment variables.
dirs
Where transitous keeps its files. On Linux and macOS the configuration and the state follow the XDG base directories: ~/.config/transitous and ~/.local/state/transitous, or below $XDG_CONFIG_HOME and $XDG_STATE_HOME. On Windows they are the usual ones below %APPDATA% and %LOCALAPPDATA%.
model
The output: the same types for JSON, YAML and the structured content of the MCP tools. Times are RFC 3339 with the offset of the stop’s time zone, like 2026-11-26T21:22:00+01:00. Delays are whole minutes, late positive, early negative.
resolve
From what the caller typed to a stop ID: an ID is used as it is, a name only if it names one stop. A wrong stop gives wrong connections that look right, so a doubtful name is an error with the candidates, never a guess.
service
The operations of the CLI and the MCP server, with the usage rules applied: a contact in every request, the cache first, then the usage counter, then one request, never a retry.
status
The status of a connection: whether the caller can still take it as planned. Pure functions of the itinerary, the current time and the delay threshold; docs/status.md explains the rules.
usage
The usage counter: the requests of the last 24 hours, in a file shared by every process on the machine, so the CLI and the MCP server keep to the limits together.

Enums§

Error