Skip to content

Add MCP tool validation tests and README sync automation#134

Merged
agoldis merged 4 commits into
mainfrom
feat/sync-readme
May 18, 2026
Merged

Add MCP tool validation tests and README sync automation#134
agoldis merged 4 commits into
mainfrom
feat/sync-readme

Conversation

@agoldis

@agoldis agoldis commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add unit tests (server.test.ts) that validate all registered MCP tools against SEP-986 naming constraints, description quality rules, and Cursor IDE combined-name length limits
  • Add a sync-readme-tools.mjs script that regenerates the README tools table from server.ts source, with a --check mode for CI
  • Fix a tool name that exceeded the Cursor combined-length limit: currents-get-affected-test-executions-by-actioncurrents-get-affected-executions
  • Fix a description containing parentheses that broke the sync-script regex

Changes by layer

Tests (server.test.ts): new test suite that mocks the MCP SDK, captures all registerTool calls, and validates:

  • Name uniqueness, character set, length (SEP-986), and Cursor extension-currents: prefix length
  • Description presence, length, trimming, capitalization, and trailing period
  • README parity (every registered tool is listed, no stale entries)

Tooling (scripts/sync-readme-tools.mjs): parses server.ts with a regex to extract tool names/descriptions, builds a markdown table, and splices it into README.md. Supports --check for CI gating.

Server (server.ts): renamed one tool and removed parentheses from one description to pass validation.

Docs (README.md): regenerated tools table reflecting the current tool set (adds 3 affected-tests tools, removes stale entries, alphabetizes by group).

Review hints

  • Start with server.test.ts — it defines all the validation rules
  • Then check sync-readme-tools.mjs for the regex that parses server.ts
  • The server.ts and README.md changes are mechanical fixes driven by the new tests

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added MCP tools for retrieving specs, performance metrics, test signatures, results, and error exploration.
  • Documentation

    • Expanded and reorganized the README tools section to list the new tools and related actions/webhooks.
  • Chores

    • Added automation to keep the README tools table in sync and a pre-commit hook to run it.
    • Bumped release tooling dev dependencies.
  • Tests

    • Added checks to ensure the README tools table matches registered tools.

Review Change Stack

…alidation tests

- Introduced a script to automatically sync the tools table in README.md with registered tools in server.ts.
- Added a pre-commit hook to trigger the README update when server.ts changes.
- Enhanced unit tests to ensure all registered tools are accurately reflected in README.md, checking for missing or stale entries.
- Updated package.json to include new scripts for README synchronization.
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b65f0178-2101-4062-a7fe-b6f70ff1c019

📥 Commits

Reviewing files that changed from the base of the PR and between 109780f and 0177fff.

📒 Files selected for processing (1)
  • mcp-server/scripts/hooks/pre-commit
🚧 Files skipped from review as they are similar to previous changes (1)
  • mcp-server/scripts/hooks/pre-commit

📝 Walkthrough

Walkthrough

Adds a Node.js tool that regenerates the README "Tools" table from mcp-server/src/server.ts registrations, a pre-commit hook and npm scripts to run it, tests that verify README vs. registered tools, and updates the README table and two devDependency versions.

Changes

README Tools Sync System

Layer / File(s) Summary
Git hooks and npm scripts setup
mcp-server/package.json, mcp-server/scripts/hooks/pre-commit
npm scripts add a prepare hook that configures git to use custom hooks and a sync-readme script; a new pre-commit hook conditionally runs the sync script and stages README.md when server.ts changes are staged.
README tools table sync implementation
mcp-server/scripts/sync-readme-tools.mjs
Node.js script parses server.ts to extract registered tool names and multiline descriptions, normalizes descriptions to the first sentence, computes markdown table column widths, compares with the README table, and either updates the file or exits nonzero with --check.
Test validation for README consistency
mcp-server/src/server.test.ts
New test block reads README.md, parses the tools table via regex, and verifies all registered tools appear and no stale tool names remain.
Updated tools table documentation
README.md
Tools table rewritten to include additional MCP commands (test/execution retrieval, quarantine/skip/tag listings), run/spec/test performance and results retrieval tools, error explorer, and action/webhook tooling; rows reordered and descriptions updated.
Dev tooling version updates
mcp-server/package.json
Bumps @release-it/conventional-changelog from ^10.0.0^11.0.0 and release-it from ^19.0.3^20.0.1.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • currents-dev/currents-mcp#133: Validates registered tool names and descriptions in tests, complementing this PR's README/table synchronization.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding MCP tool validation tests and README sync automation. It is specific, concise, and directly reflects the core functionality introduced in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sync-readme

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mcp-server/scripts/hooks/pre-commit`:
- Around line 1-7: The pre-commit hook currently runs node
mcp-server/scripts/sync-readme-tools.mjs but doesn't stop the commit if that
command fails; modify the hook (mcp-server/scripts/hooks/pre-commit) to
fail-fast by exiting non-zero when node mcp-server/scripts/sync-readme-tools.mjs
returns a non-zero status (for example, check the command's exit code or enable
immediate exit), so that git add README.md and the commit are only reached if
sync-readme-tools.mjs succeeds.

In `@mcp-server/scripts/sync-readme-tools.mjs`:
- Around line 88-105: The code assumes the table anchor "| Tool" exists and may
slice the README incorrectly if tableStart === -1; add an explicit guard after
computing tableStart (and before using tableEnd/tableEndMarker) that checks if
tableStart === -1 and aborts with a clear error (use process.exit(1) or respect
checkOnly) and a descriptive message; update the branches that log/out on stale
state (using checkOnly) to handle this case and avoid constructing
updated/readmePath writes when the anchor is missing (references: tableStart,
tableEndMarker, tableEnd, oldTable, checkOnly, updated, readmePath).

In `@mcp-server/src/server.test.ts`:
- Around line 56-57: The README regex only captures `([\w-]+)` after the
`currents-` prefix in the readme.matchAll(...) call, but valid tool names may
include `.` and `/`; update the regex used in the readme.matchAll(...)
invocation (the pattern currently shown as `\| `(currents-[\w-]+)` `) to allow
dots and slashes (e.g. `[\w./-]+`) so the captured group returned to the
.map((m) => m[1]) includes names with `.` and `/`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a6956479-0a43-44e3-9730-7fe68ebcfda2

📥 Commits

Reviewing files that changed from the base of the PR and between fc0b650 and 5572e3e.

📒 Files selected for processing (5)
  • README.md
  • mcp-server/package.json
  • mcp-server/scripts/hooks/pre-commit
  • mcp-server/scripts/sync-readme-tools.mjs
  • mcp-server/src/server.test.ts

Comment thread mcp-server/scripts/hooks/pre-commit
Comment thread mcp-server/scripts/sync-readme-tools.mjs
Comment thread mcp-server/src/server.test.ts
agoldis added 3 commits May 18, 2026 12:37
- Introduced package.json to define development dependencies for the project, including `oxfmt` and `oxlint`.
- Added package-lock.json to lock the versions of dependencies, ensuring consistent installations across environments.
- Updated sync-readme-tools.mjs to enhance error handling for missing tools table in README.md.
- Deleted the root-level package.json and package-lock.json files as they are no longer needed.
- Updated mcp-server's package.json and package-lock.json to reflect new dependencies and version updates, including `audit` and updates to `@release-it/conventional-changelog` and `release-it`.
- Added 'set -e' to the pre-commit hook script to ensure it exits immediately if a command fails, enhancing error handling during the commit process.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mcp-server/package.json`:
- Line 34: The prepare script in package.json runs git config core.hooksPath
unconditionally and fails when not in a git worktree; change the "prepare"
script to first check for git and that the current repo is a worktree (e.g.,
test for git binary and that git rev-parse --is-inside-work-tree succeeds)
before running git config core.hooksPath mcp-server/scripts/hooks so installs in
CI/artifacts/non-git contexts do not exit with code 128; update the package.json
"prepare" entry accordingly to perform the guard and only run the hook setup
when those checks pass.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 355103a4-d09e-4177-a309-17f21cf2ae8a

📥 Commits

Reviewing files that changed from the base of the PR and between e6fddba and 109780f.

⛔ Files ignored due to path filters (1)
  • mcp-server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • mcp-server/package.json

Comment thread mcp-server/package.json
@agoldis agoldis merged commit 424e606 into main May 18, 2026
5 checks passed
@agoldis agoldis deleted the feat/sync-readme branch May 18, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant