diff --git a/README.md b/README.md index abd2455..257494d 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,9 @@ All tools are prefixed with `pcm_`. Every tool except `pcm_update_save` and `pcm | **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). | -| **pcm_search_cyclist** | Search for a cyclist by first name and/or last name (case-insensitive partial match). Returns up to 10 matches with all ratings (plain, mountain, medium mountain, downhilling, cobble, time trial, prologue, sprint, acceleration, endurance, resistance, recuperation, hill, baroudeur, current ability) and the resolved country name. `mediumMountain` and `currentAbility` are `null` on saves that pre-date those columns. | +| **pcm_search_cyclist** | Search for a cyclist by first name and/or last name (case-insensitive partial match). Returns up to 10 matches with all ratings (plain, mountain, medium mountain, downhilling, cobble, time trial, prologue, sprint, acceleration, endurance, resistance, recuperation, hill, baroudeur, current ability) and the resolved country name; a `truncated` flag signals when more matches exist. `mediumMountain` and `currentAbility` are `null` on saves that pre-date those columns. | | **pcm_get_team_roster** | List a team's roster (defaults to the active player's team when `teamId` is omitted). Joins DYN_cyclist with its active DYN_contract_cyclist and STA_type_rider; per rider returns name, country, age (derived from birth date and the current game date), rider type, overall ability, contract end year, wage, market value and all per-terrain ability ratings. Ordered by overall ability, highest first. Errors if `teamId` does not exist. | -| **pcm_search_team** | Search for a team by name (case-insensitive partial match against both the full name and short name). Returns up to 10 matches with the resolved division name, country name, evaluation and general manager. | +| **pcm_search_team** | Search for a team by name (case-insensitive partial match against both the full name and short name). Returns up to 10 matches with the resolved division name, country name, evaluation and general manager; a `truncated` flag signals when more matches exist. | | **pcm_query_save** | Run a read-only SQL query (`SELECT` / `WITH … SELECT` only) against any table in a save file. Write/DDL statements are rejected. Results are capped (default 100, max 1000 rows). | | **pcm_update_save** | Apply a single `INSERT`/`UPDATE`/`DELETE` statement to a save and write the modified database to a **new** `.cdb` at `outputPath`. The source save is never overwritten (`outputPath` must differ from `savePath`); `SELECT`, schema changes (`DROP`/`CREATE`/`ALTER`) and stacked statements are rejected. Returns the written path and the number of rows changed. | | **pcm_update_cyclist_ratings** | Change one or more ability ratings of a cyclist (by `IDcyclist`) and write the modified database to a **new** `.cdb` at `outputPath`. Takes a `ratings` object where each field is optional (`plain`, `mountain`, `mediumMountain`, `downhilling`, `cobble`, `timeTrial`, `prologue`, `sprint`, `acceleration`, `endurance`, `resistance`, `recuperation`, `hill`, `baroudeur`; 55–85) — only the fields provided are changed. Returns the written path and the cyclist's full ratings after the update. Setting `mediumMountain` is rejected on saves that pre-date that column. | diff --git a/src/tools/search-cyclist.ts b/src/tools/search-cyclist.ts index 2b44fc4..1e8de56 100644 --- a/src/tools/search-cyclist.ts +++ b/src/tools/search-cyclist.ts @@ -20,8 +20,15 @@ const cyclistSchema = z.object({ ), }); +const MAX_RESULTS = 10; + const outputSchema = z.object({ cyclists: z.array(cyclistSchema).describe("Matching cyclists"), + truncated: z + .boolean() + .describe( + `Whether more matches exist beyond the ${MAX_RESULTS} returned — narrow the search with a longer name to see them`, + ), }); export function registerSearchCyclist(server: McpServer): void { @@ -29,8 +36,7 @@ export function registerSearchCyclist(server: McpServer): void { "pcm_search_cyclist", { title: "Search PCM cyclist by name", - description: - "Search for a cyclist in a Pro Cycling Manager `.cdb` save file by first name and/or last name (case-insensitive partial match). Returns up to 10 matching cyclists with all their ratings and their country name.", + description: `Search for a cyclist in a Pro Cycling Manager \`.cdb\` save file by first name and/or last name (case-insensitive partial match). Returns up to ${MAX_RESULTS} matching cyclists with all their ratings and their country name; \`truncated\` is true when more matches exist beyond the ${MAX_RESULTS} returned.`, inputSchema: { savePath: z.string().describe("Absolute path to the .cdb save file"), firstName: z @@ -73,10 +79,12 @@ export function registerSearchCyclist(server: McpServer): void { LEFT JOIN STA_country co ON r.fkIDcountry = co.IDcountry WHERE LOWER(c.gene_sz_lastname) LIKE LOWER(:lastName) AND LOWER(c.gene_sz_firstname) LIKE LOWER(:firstName) - LIMIT 10`, + ORDER BY c.gene_sz_lastname, c.gene_sz_firstname, c.IDcyclist + LIMIT ${MAX_RESULTS + 1}`, ); const cyclists: z.infer[] = []; + let truncated = false; try { const first = firstName.trim(); const last = lastName.trim(); @@ -90,6 +98,10 @@ export function registerSearchCyclist(server: McpServer): void { }); while (stmt.step()) { + if (cyclists.length >= MAX_RESULTS) { + truncated = true; + break; + } const row = stmt.getAsObject(); cyclists.push({ id: Number(row.IDcyclist), @@ -107,6 +119,7 @@ export function registerSearchCyclist(server: McpServer): void { const output: z.infer = { cyclists, + truncated, }; return output; }), diff --git a/src/tools/search-team.ts b/src/tools/search-team.ts index 6a80462..eb45746 100644 --- a/src/tools/search-team.ts +++ b/src/tools/search-team.ts @@ -22,8 +22,15 @@ const teamSchema = z.object({ .describe("General manager name (gene_sz_manager_general)"), }); +const MAX_RESULTS = 10; + const outputSchema = z.object({ teams: z.array(teamSchema).describe("Matching teams"), + truncated: z + .boolean() + .describe( + `Whether more matches exist beyond the ${MAX_RESULTS} returned — narrow the search with a longer name to see them`, + ), }); export function registerSearchTeam(server: McpServer): void { @@ -31,8 +38,7 @@ export function registerSearchTeam(server: McpServer): void { "pcm_search_team", { title: "Search PCM team by name", - description: - "Search for a team in a Pro Cycling Manager `.cdb` save file by name (case-insensitive partial match against both the full name and the short name). Returns up to 10 matching teams with their division name, country name, evaluation and general manager.", + description: `Search for a team in a Pro Cycling Manager \`.cdb\` save file by name (case-insensitive partial match against both the full name and the short name). Returns up to ${MAX_RESULTS} matching teams with their division name, country name, evaluation and general manager; \`truncated\` is true when more matches exist beyond the ${MAX_RESULTS} returned.`, inputSchema: { savePath: z.string().describe("Absolute path to the .cdb save file"), name: z @@ -65,10 +71,12 @@ export function registerSearchTeam(server: McpServer): void { LEFT JOIN STA_country c ON t.fkIDcountry = c.IDcountry WHERE LOWER(t.gene_sz_name) LIKE LOWER(:name) OR LOWER(t.gene_sz_shortname) LIKE LOWER(:name) - LIMIT 10`, + ORDER BY t.gene_sz_name, t.IDteam + LIMIT ${MAX_RESULTS + 1}`, ); const teams: z.infer[] = []; + let truncated = false; try { const query = name.trim(); if (query.length === 0) { @@ -78,6 +86,10 @@ export function registerSearchTeam(server: McpServer): void { stmt.bind({ ":name": `%${query}%` }); while (stmt.step()) { + if (teams.length >= MAX_RESULTS) { + truncated = true; + break; + } const row = stmt.getAsObject(); teams.push({ id: Number(row.id), @@ -95,6 +107,7 @@ export function registerSearchTeam(server: McpServer): void { const output: z.infer = { teams, + truncated, }; return output; }), diff --git a/test/tools/__snapshots__/search-cyclist.test.ts.snap b/test/tools/__snapshots__/search-cyclist.test.ts.snap index 268cb17..daa161a 100644 --- a/test/tools/__snapshots__/search-cyclist.test.ts.snap +++ b/test/tools/__snapshots__/search-cyclist.test.ts.snap @@ -4,46 +4,25 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 { "cyclists": [ { - "acceleration": 74, - "baroudeur": 65, - "cobble": 67, - "country": "Belgium", - "currentAbility": null, - "downhilling": 75, - "endurance": 68, - "firstName": "Tosh", - "hill": 74, - "id": 2548, - "lastName": "Van der Sande", - "mediumMountain": null, - "mountain": 62, - "plain": 72, - "prologue": 65, - "recuperation": 68, - "resistance": 67, - "sprint": 72, - "timeTrial": 65, - }, - { - "acceleration": 73, + "acceleration": 61, "baroudeur": 61, - "cobble": 65, + "cobble": 63, "country": "Netherlands", "currentAbility": null, - "downhilling": 67, - "endurance": 67, - "firstName": "Nick", - "hill": 72, - "id": 3396, - "lastName": "Van Der Lijke", + "downhilling": 63, + "endurance": 56, + "firstName": "Marijn", + "hill": 59, + "id": 6457, + "lastName": "Van Der Berg", "mediumMountain": null, - "mountain": 64, - "plain": 70, - "prologue": 67, - "recuperation": 67, - "resistance": 65, - "sprint": 68, - "timeTrial": 63, + "mountain": 55, + "plain": 62, + "prologue": 59, + "recuperation": 58, + "resistance": 56, + "sprint": 62, + "timeTrial": 57, }, { "acceleration": 65, @@ -88,25 +67,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 62, }, { - "acceleration": 72, + "acceleration": 64, + "baroudeur": 71, + "cobble": 51, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 68, + "endurance": 56, + "firstName": "Bas", + "hill": 60, + "id": 6072, + "lastName": "Van Der Kooij", + "mediumMountain": null, + "mountain": 61, + "plain": 63, + "prologue": 59, + "recuperation": 56, + "resistance": 57, + "sprint": 57, + "timeTrial": 56, + }, + { + "acceleration": 73, "baroudeur": 61, - "cobble": 63, - "country": "Australia", + "cobble": 65, + "country": "Netherlands", "currentAbility": null, - "downhilling": 69, - "endurance": 65, - "firstName": "Neil", - "hill": 64, - "id": 3955, - "lastName": "Van Der Ploeg", + "downhilling": 67, + "endurance": 67, + "firstName": "Nick", + "hill": 72, + "id": 3396, + "lastName": "Van Der Lijke", "mediumMountain": null, - "mountain": 56, + "mountain": 64, "plain": 70, - "prologue": 69, - "recuperation": 66, - "resistance": 63, - "sprint": 70, - "timeTrial": 62, + "prologue": 67, + "recuperation": 67, + "resistance": 65, + "sprint": 68, + "timeTrial": 63, }, { "acceleration": 72, @@ -130,25 +130,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 60, }, { - "acceleration": 65, - "baroudeur": 68, - "cobble": 61, - "country": "Netherlands", + "acceleration": 72, + "baroudeur": 61, + "cobble": 63, + "country": "Australia", "currentAbility": null, - "downhilling": 65, - "endurance": 61, - "firstName": "Arno", - "hill": 60, - "id": 3995, - "lastName": "Van Der Zwet", + "downhilling": 69, + "endurance": 65, + "firstName": "Neil", + "hill": 64, + "id": 3955, + "lastName": "Van Der Ploeg", "mediumMountain": null, - "mountain": 55, - "plain": 69, - "prologue": 67, - "recuperation": 64, + "mountain": 56, + "plain": 70, + "prologue": 69, + "recuperation": 66, "resistance": 63, - "sprint": 64, - "timeTrial": 66, + "sprint": 70, + "timeTrial": 62, + }, + { + "acceleration": 62, + "baroudeur": 62, + "cobble": 60, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 62, + "endurance": 56, + "firstName": "Danny", + "hill": 59, + "id": 6461, + "lastName": "Van Der Tuuk", + "mediumMountain": null, + "mountain": 56, + "plain": 62, + "prologue": 61, + "recuperation": 55, + "resistance": 56, + "sprint": 61, + "timeTrial": 61, }, { "acceleration": 61, @@ -172,96 +193,34 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 58, }, { - "acceleration": 64, - "baroudeur": 71, - "cobble": 51, - "country": "Netherlands", - "currentAbility": null, - "downhilling": 68, - "endurance": 56, - "firstName": "Bas", - "hill": 60, - "id": 6072, - "lastName": "Van Der Kooij", - "mediumMountain": null, - "mountain": 61, - "plain": 63, - "prologue": 59, - "recuperation": 56, - "resistance": 57, - "sprint": 57, - "timeTrial": 56, - }, - { - "acceleration": 52, - "baroudeur": 56, - "cobble": 57, + "acceleration": 65, + "baroudeur": 68, + "cobble": 61, "country": "Netherlands", "currentAbility": null, "downhilling": 65, - "endurance": 57, - "firstName": "Dennis", - "hill": 56, - "id": 6085, - "lastName": "van der Horst", + "endurance": 61, + "firstName": "Arno", + "hill": 60, + "id": 3995, + "lastName": "Van Der Zwet", "mediumMountain": null, - "mountain": 56, - "plain": 59, - "prologue": 59, - "recuperation": 52, - "resistance": 57, - "sprint": 59, - "timeTrial": 59, + "mountain": 55, + "plain": 69, + "prologue": 67, + "recuperation": 64, + "resistance": 63, + "sprint": 64, + "timeTrial": 66, }, ], + "truncated": true, } `; exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 2019 1`] = ` { "cyclists": [ - { - "acceleration": 74, - "baroudeur": 65, - "cobble": 68, - "country": "Belgium", - "currentAbility": null, - "downhilling": 75, - "endurance": 68, - "firstName": "Tosh", - "hill": 73, - "id": 2548, - "lastName": "Van der Sande", - "mediumMountain": null, - "mountain": 62, - "plain": 72, - "prologue": 65, - "recuperation": 68, - "resistance": 67, - "sprint": 72, - "timeTrial": 65, - }, - { - "acceleration": 74, - "baroudeur": 61, - "cobble": 65, - "country": "Netherlands", - "currentAbility": null, - "downhilling": 67, - "endurance": 69, - "firstName": "Nick", - "hill": 72, - "id": 3396, - "lastName": "Van Der Lijke", - "mediumMountain": null, - "mountain": 64, - "plain": 71, - "prologue": 67, - "recuperation": 67, - "resistance": 69, - "sprint": 70, - "timeTrial": 63, - }, { "acceleration": 65, "baroudeur": 66, @@ -283,6 +242,27 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "sprint": 64, "timeTrial": 60, }, + { + "acceleration": 72, + "baroudeur": 61, + "cobble": 64, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 75, + "endurance": 57, + "firstName": "Maik", + "hill": 60, + "id": 5920, + "lastName": "Van Der Heijden", + "mediumMountain": null, + "mountain": 54, + "plain": 65, + "prologue": 66, + "recuperation": 58, + "resistance": 59, + "sprint": 69, + "timeTrial": 64, + }, { "acceleration": 67, "baroudeur": 71, @@ -305,25 +285,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 62, }, { - "acceleration": 72, - "baroudeur": 61, - "cobble": 63, - "country": "Australia", + "acceleration": 76, + "baroudeur": 67, + "cobble": 65, + "country": "Netherlands", "currentAbility": null, - "downhilling": 69, - "endurance": 65, - "firstName": "Neil", - "hill": 64, - "id": 3955, - "lastName": "Van Der Ploeg", + "downhilling": 70, + "endurance": 66, + "firstName": "Bas", + "hill": 64, + "id": 6072, + "lastName": "Van Der Kooij", "mediumMountain": null, - "mountain": 56, + "mountain": 59, "plain": 70, - "prologue": 69, - "recuperation": 66, - "resistance": 63, + "prologue": 63, + "recuperation": 64, + "resistance": 64, + "sprint": 74, + "timeTrial": 59, + }, + { + "acceleration": 74, + "baroudeur": 61, + "cobble": 65, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 67, + "endurance": 69, + "firstName": "Nick", + "hill": 72, + "id": 3396, + "lastName": "Van Der Lijke", + "mediumMountain": null, + "mountain": 64, + "plain": 71, + "prologue": 67, + "recuperation": 67, + "resistance": 69, "sprint": 70, - "timeTrial": 62, + "timeTrial": 63, }, { "acceleration": 72, @@ -347,26 +348,97 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 60, }, { - "acceleration": 65, - "baroudeur": 68, - "cobble": 61, + "acceleration": 72, + "baroudeur": 61, + "cobble": 63, + "country": "Australia", + "currentAbility": null, + "downhilling": 69, + "endurance": 65, + "firstName": "Neil", + "hill": 64, + "id": 3955, + "lastName": "Van Der Ploeg", + "mediumMountain": null, + "mountain": 56, + "plain": 70, + "prologue": 69, + "recuperation": 66, + "resistance": 63, + "sprint": 70, + "timeTrial": 62, + }, + { + "acceleration": 70, + "baroudeur": 70, + "cobble": 64, "country": "Netherlands", "currentAbility": null, - "downhilling": 65, - "endurance": 61, - "firstName": "Arno", - "hill": 60, - "id": 3995, - "lastName": "Van Der Zwet", + "downhilling": 75, + "endurance": 63, + "firstName": "David", + "hill": 66, + "id": 6765, + "lastName": "Van Der Poel", "mediumMountain": null, - "mountain": 55, + "mountain": 61, "plain": 69, "prologue": 67, - "recuperation": 64, - "resistance": 63, - "sprint": 64, - "timeTrial": 66, + "recuperation": 61, + "resistance": 64, + "sprint": 69, + "timeTrial": 63, + }, + { + "acceleration": 78, + "baroudeur": 69, + "cobble": 78, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 84, + "endurance": 79, + "firstName": "Mathieu", + "hill": 79, + "id": 6764, + "lastName": "Van Der Poel", + "mediumMountain": null, + "mountain": 66, + "plain": 77, + "prologue": 77, + "recuperation": 69, + "resistance": 79, + "sprint": 78, + "timeTrial": 68, + }, + { + "acceleration": 62, + "baroudeur": 62, + "cobble": 60, + "country": "Netherlands", + "currentAbility": null, + "downhilling": 62, + "endurance": 57, + "firstName": "Danny", + "hill": 64, + "id": 6461, + "lastName": "Van Der Tuuk", + "mediumMountain": null, + "mountain": 62, + "plain": 62, + "prologue": 61, + "recuperation": 55, + "resistance": 57, + "sprint": 61, + "timeTrial": 61, }, + ], + "truncated": true, +} +`; + +exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 2021 1`] = ` +{ + "cyclists": [ { "acceleration": 72, "baroudeur": 61, @@ -389,25 +461,25 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "timeTrial": 64, }, { - "acceleration": 61, - "baroudeur": 68, - "cobble": 56, + "acceleration": 69, + "baroudeur": 75, + "cobble": 72, "country": "Netherlands", "currentAbility": null, - "downhilling": 61, - "endurance": 58, - "firstName": "Mel", - "hill": 62, - "id": 6025, - "lastName": "Van Der Veekens", + "downhilling": 72, + "endurance": 70, + "firstName": "Taco", + "hill": 68, + "id": 3871, + "lastName": "Van Der Hoorn", "mediumMountain": null, "mountain": 59, - "plain": 64, - "prologue": 61, - "recuperation": 52, - "resistance": 56, - "sprint": 57, - "timeTrial": 58, + "plain": 76, + "prologue": 62, + "recuperation": 69, + "resistance": 69, + "sprint": 65, + "timeTrial": 62, }, { "acceleration": 76, @@ -425,39 +497,11 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 201 "mountain": 59, "plain": 70, "prologue": 63, - "recuperation": 64, + "recuperation": 69, "resistance": 64, "sprint": 74, "timeTrial": 59, }, - ], -} -`; - -exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 2021 1`] = ` -{ - "cyclists": [ - { - "acceleration": 75, - "baroudeur": 65, - "cobble": 73, - "country": "Belgium", - "currentAbility": null, - "downhilling": 75, - "endurance": 70, - "firstName": "Tosh", - "hill": 73, - "id": 2548, - "lastName": "Van der Sande", - "mediumMountain": null, - "mountain": 62, - "plain": 73, - "prologue": 65, - "recuperation": 68, - "resistance": 68, - "sprint": 73, - "timeTrial": 65, - }, { "acceleration": 69, "baroudeur": 61, @@ -479,27 +523,6 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "sprint": 66, "timeTrial": 63, }, - { - "acceleration": 69, - "baroudeur": 75, - "cobble": 72, - "country": "Netherlands", - "currentAbility": null, - "downhilling": 72, - "endurance": 70, - "firstName": "Taco", - "hill": 68, - "id": 3871, - "lastName": "Van Der Hoorn", - "mediumMountain": null, - "mountain": 59, - "plain": 76, - "prologue": 62, - "recuperation": 69, - "resistance": 69, - "sprint": 65, - "timeTrial": 62, - }, { "acceleration": 72, "baroudeur": 69, @@ -522,88 +545,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "timeTrial": 60, }, { - "acceleration": 72, - "baroudeur": 61, + "acceleration": 70, + "baroudeur": 70, "cobble": 64, "country": "Netherlands", "currentAbility": null, "downhilling": 75, - "endurance": 57, - "firstName": "Maik", - "hill": 60, - "id": 5920, - "lastName": "Van Der Heijden", - "mediumMountain": null, - "mountain": 54, - "plain": 65, - "prologue": 66, - "recuperation": 58, - "resistance": 59, - "sprint": 69, - "timeTrial": 64, - }, - { - "acceleration": 61, - "baroudeur": 68, - "cobble": 56, - "country": "Netherlands", - "currentAbility": null, - "downhilling": 61, - "endurance": 58, - "firstName": "Mel", - "hill": 62, - "id": 6025, - "lastName": "Van Der Veekens", - "mediumMountain": null, - "mountain": 59, - "plain": 64, - "prologue": 61, - "recuperation": 52, - "resistance": 56, - "sprint": 57, - "timeTrial": 58, - }, - { - "acceleration": 76, - "baroudeur": 67, - "cobble": 65, - "country": "Netherlands", - "currentAbility": null, - "downhilling": 70, - "endurance": 66, - "firstName": "Bas", - "hill": 64, - "id": 6072, - "lastName": "Van Der Kooij", + "endurance": 63, + "firstName": "David", + "hill": 66, + "id": 6765, + "lastName": "Van Der Poel", "mediumMountain": null, - "mountain": 59, - "plain": 70, - "prologue": 63, - "recuperation": 69, + "mountain": 61, + "plain": 69, + "prologue": 67, + "recuperation": 61, "resistance": 64, - "sprint": 74, - "timeTrial": 59, + "sprint": 69, + "timeTrial": 63, }, { - "acceleration": 64, - "baroudeur": 66, - "cobble": 61, + "acceleration": 84, + "baroudeur": 69, + "cobble": 82, "country": "Netherlands", "currentAbility": null, - "downhilling": 65, - "endurance": 59, - "firstName": "Dennis", - "hill": 64, - "id": 6085, - "lastName": "Van der Horst", + "downhilling": 84, + "endurance": 82, + "firstName": "Mathieu", + "hill": 80, + "id": 6764, + "lastName": "Van Der Poel", "mediumMountain": null, - "mountain": 57, - "plain": 67, - "prologue": 61, - "recuperation": 62, - "resistance": 59, - "sprint": 66, - "timeTrial": 61, + "mountain": 65, + "plain": 83, + "prologue": 77, + "recuperation": 70, + "resistance": 81, + "sprint": 79, + "timeTrial": 68, }, { "acceleration": 62, @@ -627,27 +608,49 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "timeTrial": 63, }, { - "acceleration": 84, - "baroudeur": 69, - "cobble": 82, + "acceleration": 61, + "baroudeur": 68, + "cobble": 56, "country": "Netherlands", "currentAbility": null, - "downhilling": 84, - "endurance": 82, - "firstName": "Mathieu", - "hill": 80, - "id": 6764, - "lastName": "Van Der Poel", + "downhilling": 61, + "endurance": 58, + "firstName": "Mel", + "hill": 62, + "id": 6025, + "lastName": "Van Der Veekens", "mediumMountain": null, - "mountain": 65, - "plain": 83, - "prologue": 77, - "recuperation": 70, - "resistance": 81, - "sprint": 79, - "timeTrial": 68, + "mountain": 59, + "plain": 64, + "prologue": 61, + "recuperation": 52, + "resistance": 56, + "sprint": 57, + "timeTrial": 58, + }, + { + "acceleration": 55, + "baroudeur": 55, + "cobble": 55, + "country": "Belgium", + "currentAbility": null, + "downhilling": 55, + "endurance": 55, + "firstName": "Aaron", + "hill": 55, + "id": 7605, + "lastName": "Van der Beken", + "mediumMountain": null, + "mountain": 55, + "plain": 55, + "prologue": 55, + "recuperation": 55, + "resistance": 55, + "sprint": 55, + "timeTrial": 55, }, ], + "truncated": true, } `; @@ -655,25 +658,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 { "cyclists": [ { - "acceleration": 68, + "acceleration": 66, "baroudeur": 65, - "cobble": 72, + "cobble": 60, "country": "Belgium", "currentAbility": 0, - "downhilling": 75, - "endurance": 65, - "firstName": "Tosh", - "hill": 70, - "id": 2548, - "lastName": "Van Der Sande", - "mediumMountain": 67, - "mountain": 64, - "plain": 71, - "prologue": 65, + "downhilling": 65, + "endurance": 64, + "firstName": "Aaron", + "hill": 68, + "id": 7605, + "lastName": "Van Der Beken", + "mediumMountain": 68, + "mountain": 66, + "plain": 64, + "prologue": 57, "recuperation": 68, - "resistance": 66, - "sprint": 68, - "timeTrial": 65, + "resistance": 63, + "sprint": 60, + "timeTrial": 57, + }, + { + "acceleration": 56, + "baroudeur": 67, + "cobble": 57, + "country": "Netherlands", + "currentAbility": 0, + "downhilling": 60, + "endurance": 56, + "firstName": "Niels", + "hill": 54, + "id": 7503, + "lastName": "Van Der Gracht", + "mediumMountain": 52, + "mountain": 50, + "plain": 63, + "prologue": 56, + "recuperation": 57, + "resistance": 53, + "sprint": 57, + "timeTrial": 58, }, { "acceleration": 69, @@ -696,27 +720,6 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "sprint": 65, "timeTrial": 62, }, - { - "acceleration": 72, - "baroudeur": 69, - "cobble": 65, - "country": "Netherlands", - "currentAbility": 0, - "downhilling": 63, - "endurance": 62, - "firstName": "Nick", - "hill": 59, - "id": 3968, - "lastName": "Van Der Meer", - "mediumMountain": 57, - "mountain": 54, - "plain": 69, - "prologue": 63, - "recuperation": 61, - "resistance": 62, - "sprint": 70, - "timeTrial": 60, - }, { "acceleration": 64, "baroudeur": 66, @@ -739,25 +742,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "timeTrial": 61, }, { - "acceleration": 61, - "baroudeur": 64, + "acceleration": 58, + "baroudeur": 72, "cobble": 64, - "country": "Poland", + "country": "Netherlands", "currentAbility": 0, - "downhilling": 65, - "endurance": 60, - "firstName": "Danny", + "downhilling": 68, + "endurance": 59, + "firstName": "Jardi", "hill": 66, - "id": 6461, - "lastName": "Van Der Tuuk", - "mediumMountain": 64, - "mountain": 62, - "plain": 67, - "prologue": 65, - "recuperation": 63, + "id": 8321, + "lastName": "Van Der Lee", + "mediumMountain": 65, + "mountain": 65, + "plain": 66, + "prologue": 62, + "recuperation": 60, "resistance": 61, - "sprint": 60, - "timeTrial": 65, + "sprint": 59, + "timeTrial": 62, + }, + { + "acceleration": 72, + "baroudeur": 69, + "cobble": 65, + "country": "Netherlands", + "currentAbility": 0, + "downhilling": 63, + "endurance": 62, + "firstName": "Nick", + "hill": 59, + "id": 3968, + "lastName": "Van Der Meer", + "mediumMountain": 57, + "mountain": 54, + "plain": 69, + "prologue": 63, + "recuperation": 61, + "resistance": 62, + "sprint": 70, + "timeTrial": 60, }, { "acceleration": 81, @@ -781,46 +805,46 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "timeTrial": 75, }, { - "acceleration": 56, - "baroudeur": 67, - "cobble": 57, - "country": "Netherlands", + "acceleration": 68, + "baroudeur": 65, + "cobble": 72, + "country": "Belgium", "currentAbility": 0, - "downhilling": 60, - "endurance": 56, - "firstName": "Niels", - "hill": 54, - "id": 7503, - "lastName": "Van Der Gracht", - "mediumMountain": 52, - "mountain": 50, - "plain": 63, - "prologue": 56, - "recuperation": 57, - "resistance": 53, - "sprint": 57, - "timeTrial": 58, + "downhilling": 75, + "endurance": 65, + "firstName": "Tosh", + "hill": 70, + "id": 2548, + "lastName": "Van Der Sande", + "mediumMountain": 67, + "mountain": 64, + "plain": 71, + "prologue": 65, + "recuperation": 68, + "resistance": 66, + "sprint": 68, + "timeTrial": 65, }, { - "acceleration": 66, - "baroudeur": 65, - "cobble": 60, - "country": "Belgium", + "acceleration": 61, + "baroudeur": 64, + "cobble": 64, + "country": "Poland", "currentAbility": 0, "downhilling": 65, - "endurance": 64, - "firstName": "Aaron", - "hill": 68, - "id": 7605, - "lastName": "Van Der Beken", - "mediumMountain": 68, - "mountain": 66, - "plain": 64, - "prologue": 57, - "recuperation": 68, - "resistance": 63, + "endurance": 60, + "firstName": "Danny", + "hill": 66, + "id": 6461, + "lastName": "Van Der Tuuk", + "mediumMountain": 64, + "mountain": 62, + "plain": 67, + "prologue": 65, + "recuperation": 63, + "resistance": 61, "sprint": 60, - "timeTrial": 57, + "timeTrial": 65, }, { "acceleration": 65, @@ -843,27 +867,7 @@ exports[`searchCyclist > finds cyclists by last name for Pro cycling manager 202 "sprint": 64, "timeTrial": 63, }, - { - "acceleration": 58, - "baroudeur": 72, - "cobble": 64, - "country": "Netherlands", - "currentAbility": 0, - "downhilling": 68, - "endurance": 59, - "firstName": "Jardi", - "hill": 66, - "id": 8321, - "lastName": "Van Der Lee", - "mediumMountain": 65, - "mountain": 65, - "plain": 66, - "prologue": 62, - "recuperation": 60, - "resistance": 61, - "sprint": 59, - "timeTrial": 62, - }, ], + "truncated": true, } `; diff --git a/test/tools/__snapshots__/search-team.test.ts.snap b/test/tools/__snapshots__/search-team.test.ts.snap index 9ae9736..74687e7 100644 --- a/test/tools/__snapshots__/search-team.test.ts.snap +++ b/test/tools/__snapshots__/search-team.test.ts.snap @@ -13,6 +13,7 @@ exports[`searchTeam > finds teams by name for Pro cycling manager 2018 1`] = ` "shortName": "Movistar", }, ], + "truncated": false, } `; @@ -29,6 +30,7 @@ exports[`searchTeam > finds teams by name for Pro cycling manager 2019 1`] = ` "shortName": "Movistar", }, ], + "truncated": false, } `; @@ -45,6 +47,7 @@ exports[`searchTeam > finds teams by name for Pro cycling manager 2021 1`] = ` "shortName": "Movistar", }, ], + "truncated": false, } `; @@ -61,5 +64,6 @@ exports[`searchTeam > finds teams by name for Pro cycling manager 2025 1`] = ` "shortName": "Movistar", }, ], + "truncated": false, } `; diff --git a/test/tools/search-cyclist.test.ts b/test/tools/search-cyclist.test.ts index 58594e6..a1511e2 100644 --- a/test/tools/search-cyclist.test.ts +++ b/test/tools/search-cyclist.test.ts @@ -29,6 +29,20 @@ describe("searchCyclist", () => { expect(result.structuredContent).toMatchSnapshot(); }); + it("caps results at 10 and flags truncation for a broad search", async () => { + const result = await mcp.callTool("pcm_search_cyclist", { + savePath: saveFixtures[0][1], + lastName: "a", + }); + + const output = result.structuredContent as { + cyclists: unknown[]; + truncated: boolean; + }; + expect(output.cyclists).toHaveLength(10); + expect(output.truncated).toBe(true); + }); + it("returns an error when neither name is provided", async () => { const result = await mcp.callTool("pcm_search_cyclist", { savePath: saveFixtures[0][1], diff --git a/test/tools/search-team.test.ts b/test/tools/search-team.test.ts index 449eeab..33e29a3 100644 --- a/test/tools/search-team.test.ts +++ b/test/tools/search-team.test.ts @@ -27,6 +27,20 @@ describe("searchTeam", () => { expect(result.structuredContent).toMatchSnapshot(); }); + it("caps results at 10 and flags truncation for a broad search", async () => { + const result = await mcp.callTool("pcm_search_team", { + savePath: saveFixtures[0][1], + name: "a", + }); + + const output = result.structuredContent as { + teams: unknown[]; + truncated: boolean; + }; + expect(output.teams).toHaveLength(10); + expect(output.truncated).toBe(true); + }); + it("returns an error when the name is empty", async () => { const result = await mcp.callTool("pcm_search_team", { savePath: saveFixtures[0][1],