feat: support runtime schema registration#167
Conversation
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
|
|
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
There was a problem hiding this comment.
Important:
scripts/sync-schemas.js:133/ generatedsrc/data/schemas/index.ts:42:registerSchema()accepts any object and immediately advertises it viaVALID_SCHEMAS. I verified that registering{}succeeds andharness_schema(resource_type='malformed-runtime-test')then returns an empty summary instead of failing loudly. Please validate the expecteddefinitions[name][name]root before mutating the registry, and add a regression test for malformed runtime schemas.
Sent by Cursor Automation: Sunil On Demand Architecture Review
| * 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 { |
There was a problem hiding this comment.
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.


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 sharedSCHEMAS/VALID_SCHEMASstate and prevents the hook from being lost on the next schema sync.Type of Change
Checklist
Verification:
pnpm test tests/resources/harness-schema.test.tspnpm typecheckpnpm buildpnpm test