feat: add pcm_update_cyclist_ratings tool - #16
Merged
Conversation
… ratings in a new .cdb file
…tion and updating related tools
… tests for mediumMountain handling
There was a problem hiding this comment.
Pull request overview
Adds a new write-capable MCP tool, pcm_update_cyclist_ratings, to update a cyclist’s DYN_cyclist.charac_i_* ability ratings while preserving the project’s “never modify the source save” guarantee by writing edits to a new .cdb.
Changes:
- Introduces
pcm_update_cyclist_ratingswith per-field rating validation and schema-compat handling formediumMountain. - Refactors repeated
PRAGMA table_infologic intogetTableColumnNames()and adopts it in existing tools. - Extends tests/fixtures and updates documentation to reflect the additional write tool.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/tools/update-cyclist-ratings.test.ts | Adds tool-level tests for updating ratings and schema-branch behavior. |
| test/save-db.test.ts | Adds unit tests for new getTableColumnNames() helper. |
| test/fixtures/save.fixture.ts | Extends fixtures with hasMediumMountain flag for explicit schema branching in tests. |
| src/tools/update-cyclist-ratings.ts | Implements the new pcm_update_cyclist_ratings write tool. |
| src/tools/search-cyclist.ts | Replaces duplicated PRAGMA table_info logic with getTableColumnNames(). |
| src/tools/index.ts | Registers the new tool in the server tool registry. |
| src/tools/get-team-roster.ts | Replaces duplicated PRAGMA table_info logic with getTableColumnNames(). |
| src/schemas/cyclist.ts | Adds ratingColumns mapping + RatingField type to support safe rating writes. |
| src/save-db.ts | Adds getTableColumnNames() helper; existing read/write DB helpers unchanged in intent. |
| README.md | Documents the new write tool alongside pcm_update_save. |
| AGENTS.md | Updates repository guidance/docs to reflect two write tools and file purpose descriptions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
pcm_update_cyclist_ratings, a targeted write tool to edit a cyclist's ability ratings without hand-writing SQL, plus a few refactors that fell out of it.New tool
savePath,outputPath,cyclistId(find it withpcm_search_cyclist) and a partialratingsobject — only the fields provided are changed (plain, mountain, mediumMountain, downhilling, cobble, timeTrial, prologue, sprint, acceleration, endurance, resistance, recuperation, hill, baroudeur).pcm_update_save: the source.cdbis never touched — changes are serialized to a new file viawriteSaveDb, which refuses to overwrite anything.mediumMountainis rejected with an explicit error on saves that pre-date thecharac_i_medium_mountaincolumn.ratingColumnsinschemas/cyclist.ts); values and IDs are bound as SQL parameters.Refactors
getTableColumnNames(db, tableName)helper insave-db.ts— replaces thePRAGMA table_info→Set→.has()block that was duplicated acrosssearch-cyclist,get-team-rosterand the new tool.hasMediumMountainflag, so tests assert each schema branch explicitly instead of detecting the column at runtime (only the 2025 fixture has it).AGENTS.mdlayout comments now describe each file's purpose instead of listing functions, and the docs (README + AGENTS.md) reflect the two write tools.