Skip to content

fix: enforce coding standards for Zod schemas and architecture guardrails#401

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/mcp-server-coding-standards-43e9
Draft

fix: enforce coding standards for Zod schemas and architecture guardrails#401
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/mcp-server-coding-standards-43e9

Conversation

@cursor

@cursor cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Audited the codebase against docs/coding-standards.md and strengthened automated enforcement so the registry-driven MCP architecture stays compliant in CI.

Changes

Bug fixes (Zod 4 parameter descriptions)

Fixed .describe() chain order in 7 tool handlers (harness_list, harness_get, harness_search, harness_status, harness_diagnose, harness_describe, harness_schema). In Zod 4, calling .describe() before .optional() / .default() drops descriptions from the registered MCP schema — LLMs depend on these for tool selection.

Error handling

Aligned harness_schema with the standard errorResult() / toMcpError() pattern used by other handlers.

Expanded pnpm standards:check (16 tests, up from 9)

  • Singleton HTTP clientHarnessClient only instantiated in src/index.ts
  • Write tool safety — create/update/delete/execute handlers call confirmViaElicitation
  • Error handling — handlers import and use toMcpError for unexpected failures
  • Tool input schemas — Zod v4 import convention, no describe-before-chain anti-pattern, runtime check that every registered input field exposes a description

Verification

pnpm build
pnpm typecheck
pnpm standards:check  # 16 passed
pnpm test             # 2138 passed

Checklist

  • No new server.registerTool() calls
  • No console.log() in src/
  • Toolset files remain pure data
  • All Zod params expose descriptions on registered schemas
  • pnpm standards:check passes in CI
Open in Web View Automation 

cursoragent and others added 2 commits June 24, 2026 10:07
Add regression tests for harness_schema recursive definition lookup when
only a non-schema-node wrapper exists, and when a nested schema node must
win over a wrapper with the same name. Extend body-normalizer and
harness_update coverage for environment YAML updates with injectIdentifier
after unwrapKey.

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
…ails

- Fix Zod 4 .describe() chain order in 7 tool handlers so MCP clients
  receive parameter descriptions for LLM tool selection
- Align harness_schema error handling with errorResult/toMcpError pattern
- Expand standards:check with singleton client, write-tool confirmation,
  error-handling, and registered input-schema description tests

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants