Skip to content

feat: support runtime schema registration#167

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/mcp-v2-bug-resolution-b818
Draft

feat: support runtime schema registration#167
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/mcp-v2-bug-resolution-b818

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 10, 2026

Description

Adds a generated registerSchema(name, schema) hook so internal/extension MCP servers can register schemas during startup before schema tools/resources are registered. This keeps runtime schema names in shared SCHEMAS/VALID_SCHEMAS state and prevents the hook from being lost on the next schema sync.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Checklist

  • Tests pass
  • Typecheck passes

Verification:

  • pnpm test tests/resources/harness-schema.test.ts
  • pnpm typecheck
  • pnpm build
  • pnpm test
Open in Web View Automation 

cursoragent and others added 2 commits May 10, 2026 06:48
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
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.

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Important:

  • scripts/sync-schemas.js:133 / generated src/data/schemas/index.ts:42: registerSchema() accepts any object and immediately advertises it via VALID_SCHEMAS. I verified that registering {} succeeds and harness_schema(resource_type='malformed-runtime-test') then returns an empty summary instead of failing loudly. Please validate the expected definitions[name][name] root before mutating the registry, and add a regression test for malformed runtime schemas.
Open in Web View Automation 

Sent by Cursor Automation: Sunil On Demand Architecture Review

Comment thread scripts/sync-schemas.js
* Internal/extension servers should call this during startup, before
* registering schema tools/resources, so MCP clients see the new schema name.
*/
export function registerSchema(name: string, schema: Record<string, unknown>): void {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

registerSchema() currently trusts any object shape. I was able to register {} successfully, which adds the name to VALID_SCHEMAS, and then harness_schema(resource_type=...) returns an empty summary instead of a clear error. Since this repo prefers fail-loudly contracts, please validate the expected definitions[name][name] structure before mutating the registry, and add a negative test alongside the new happy-path cases.

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