diff --git a/AGENTS.md b/AGENTS.md index d92daa0..43a005d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,7 +34,7 @@ src/ tools/ index.ts # registerTools() — wires every tool onto the server list-saves.ts # pcm_list_saves - select-save.ts # pcm_select_save + validate-save.ts # pcm_validate_save get-save-schema.ts # pcm_get_save_schema get-table-schema.ts # pcm_get_table_schema get-player-info.ts # pcm_get_player_info @@ -53,7 +53,7 @@ All tools are prefixed with `pcm_` and carry `readOnlyHint: true` / `destructive | Tool | Purpose | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `pcm_list_saves` | Discover `.cdb` careers by scanning `Pro Cycling Manager /Cloud` under `%APPDATA%` (**Windows only**). | -| `pcm_select_save` | Validate a `.cdb` path and return metadata. Stateless — the path must be kept in conversation context for later tools. | +| `pcm_validate_save` | Validate a `.cdb` path and return metadata. Stateless — the path must be kept in conversation context for later tools. | | `pcm_get_save_schema` | List all tables (id + name) in a save via `DB_STRUCTURE`. | | `pcm_get_table_schema` | Inspect one table: columns (name, type, NOT NULL, PK) + row count. | | `pcm_get_player_info` | Active human player + team (joins `GAM_user` `game_i_active = 1` with `DYN_team`). | @@ -85,7 +85,7 @@ All tools are prefixed with `pcm_` and carry `readOnlyHint: true` / `destructive - **Tool naming** — all tools are prefixed with `pcm_` (e.g. `pcm_list_saves`) to avoid conflicts when used alongside other MCP servers. - **Platform:** auto-discovery is Windows-only. On macOS/Linux (Wine/Proton), - `pcm_list_saves`/`getPcmRoot` throw — pass an absolute `.cdb` path to `pcm_select_save`. + `pcm_list_saves`/`getPcmRoot` throw — pass an absolute `.cdb` path to `pcm_validate_save`. - **Logging** must go to `stderr` (`console.error`); stdout is the MCP transport. ## README maintenance diff --git a/README.md b/README.md index c202b4b..7959928 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ PCM only ships on Windows, where careers live under: %APPDATA%/Pro Cycling Manager /Cloud// ``` -Auto-discovery via `pcm_list_saves` is therefore **Windows only**. On macOS/Linux the saves live inside a Wine/Proton prefix that can't be reliably located — pass an absolute `.cdb` path directly to `pcm_select_save` instead. +Auto-discovery via `pcm_list_saves` is therefore **Windows only**. On macOS/Linux the saves live inside a Wine/Proton prefix that can't be reliably located — pass an absolute `.cdb` path directly to `pcm_validate_save` instead. ## Available tools @@ -86,7 +86,7 @@ All tools are prefixed with `pcm_`. Every tool except `pcm_update_save` is read- | Tool | Description | | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **pcm_list_saves** | Discover PCM `.cdb` career save files on this machine by scanning the `Pro Cycling Manager /Cloud` folders under `%APPDATA%` (Windows only). Returns each save's absolute path, file name, last modified date and size (newest first). | -| **pcm_select_save** | Validate that an absolute path points to an existing `.cdb` save file and return its metadata. Stateless — keep the returned path in conversation context to pass to later tools. | +| **pcm_validate_save** | Validate that an absolute path points to an existing `.cdb` save file and return its metadata. Stateless — keep the returned path in conversation context to pass to later tools. | | **pcm_get_save_schema** | List every table inside a `.cdb` save file, with its ID and name, plus the total table count. | | **pcm_get_table_schema** | Inspect a single table by name. Returns its columns (name, SQL type, NOT NULL and primary key flags) and its row count. Use `pcm_get_save_schema` first to discover available table names. | | **pcm_get_player_info** | Get the active human player and their team from a save file. Returns the player login plus team details (name, resolved division name, resolved country name, evaluation and manager). | @@ -101,7 +101,7 @@ All tools are prefixed with `pcm_`. Every tool except `pcm_update_save` is read- Tools are **stateless**: there is no "current save" held by the server. Every tool takes an absolute `savePath`, re-validates it, and re-reads the `.cdb` from disk into a fresh in-memory SQLite database (via [`cdb-converter`](https://www.npmjs.com/package/cdb-converter) + [`sql.js`](https://www.npmjs.com/package/sql.js)) for each call. The source save on disk is never mutated: read tools only ever read it, and `pcm_update_save` writes its changes to a separate output `.cdb`. A typical flow is: -1. `pcm_list_saves` (Windows) or `pcm_select_save` with an explicit path to locate a save. +1. `pcm_list_saves` (Windows) or `pcm_validate_save` with an explicit path to locate a save. 2. `pcm_search_cyclist`, `pcm_get_team_roster`, `pcm_query_save`, … to explore it. 3. `pcm_generate_startlist_xml` to produce a startlist file for a race, or `pcm_update_save` to write an edited copy of the save. diff --git a/src/saves.ts b/src/saves.ts index 6f256e9..222c6ec 100644 --- a/src/saves.ts +++ b/src/saves.ts @@ -35,7 +35,7 @@ const CLOUD_DIR = "Cloud"; * a SteamID64 or a profile name). On macOS/Linux the * saves live inside a Wine/Proton prefix that we can't reliably locate, so * auto-discovery is unsupported there — pass an absolute `.cdb` path to - * `select_save` instead. + * `pcm_validate_save` instead. * * @throws on non-Windows platforms. */ @@ -44,7 +44,7 @@ export function getPcmRoot(): string { throw new Error( "Pro Cycling Manager save auto-discovery is only supported on Windows. " + "On macOS/Linux the saves live inside a Wine/Proton prefix — " + - "pass an absolute .cdb path to select_save instead.", + "pass an absolute .cdb path to pcm_validate_save instead.", ); } return process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"); @@ -128,7 +128,7 @@ export async function listSaves( throw new Error( `No Pro Cycling Manager data found. Expected a "Pro Cycling Manager " folder under: ${root}. ` + "PCM may not be installed, or its saves live in a custom location — " + - "pass an absolute .cdb path to select_save instead.", + "pass an absolute .cdb path to pcm_validate_save instead.", ); } diff --git a/src/tools/index.ts b/src/tools/index.ts index ae3c7ef..61c6df5 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -1,6 +1,6 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { registerListSaves } from "./list-saves"; -import { registerSelectSave } from "./select-save"; +import { registerValidateSave } from "./validate-save"; import { registerGetSaveSchema } from "./get-save-schema"; import { registerGetTableSchema } from "./get-table-schema"; import { registerGetPlayerInfo } from "./get-player-info"; @@ -13,7 +13,7 @@ import { registerSearchTeam } from "./search-team"; export function registerTools(server: McpServer): void { registerListSaves(server); - registerSelectSave(server); + registerValidateSave(server); registerGetSaveSchema(server); registerGetTableSchema(server); registerGetPlayerInfo(server); diff --git a/src/tools/select-save.ts b/src/tools/validate-save.ts similarity index 92% rename from src/tools/select-save.ts rename to src/tools/validate-save.ts index 0eeb277..14e890c 100644 --- a/src/tools/select-save.ts +++ b/src/tools/validate-save.ts @@ -14,11 +14,11 @@ const outputSchema = z.object({ sizeBytes: z.number().describe("File size in bytes"), }); -export function registerSelectSave(server: McpServer): void { +export function registerValidateSave(server: McpServer): void { server.registerTool( - "pcm_select_save", + "pcm_validate_save", { - title: "Select PCM save", + title: "Validate PCM save", description: "Validate that an absolute path points to an existing Pro Cycling Manager `.cdb` save file and return its metadata. Stateless: nothing is stored — keep the returned path in conversation context to pass to later tools.", inputSchema: {