Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp): accept equivalent schema dialect fragments

Alfredo Lopez8568d2b5a81f
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 7847c178f..eae0e8444 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index d0c0c6a19..0d423966a 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.320",
+ "version": "0.1.321",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/core/adapters/toolRegistryAdapter.ts b/mcp-host/src/core/adapters/toolRegistryAdapter.ts
index 7dd65b335..8a27e397d 100644
--- a/mcp-host/src/core/adapters/toolRegistryAdapter.ts
+++ b/mcp-host/src/core/adapters/toolRegistryAdapter.ts
@@ -21,10 +21,13 @@ function selectedSchemaValidator(schema: Record<string, unknown>): ValidateFunct
if (cached?.serialized === serialized) return cached.validate
let validate: ValidateFunction | null = null
try {
+ // An empty fragment denotes the same JSON Schema meta-schema URI.
+ const dialect =
+ typeof schema.$schema === 'string' ? schema.$schema.replace(/#$/, '') : undefined
const Constructor =
- schema.$schema === 'https://json-schema.org/draft/2020-12/schema'
+ dialect === 'https://json-schema.org/draft/2020-12/schema'
? Ajv2020
- : schema.$schema === 'https://json-schema.org/draft/2019-09/schema'
+ : dialect === 'https://json-schema.org/draft/2019-09/schema'
? Ajv2019
: Ajv
// Isolate each schema's $id namespace. Synchronous compile has no remote
diff --git a/mcp-host/src/core/orchestration/__tests__/approvedToolsLifecycle.integration.test.ts b/mcp-host/src/core/orchestration/__tests__/approvedToolsLifecycle.integration.test.ts
index 92f77e581..eb4ffa9ee 100644
--- a/mcp-host/src/core/orchestration/__tests__/approvedToolsLifecycle.integration.test.ts
+++ b/mcp-host/src/core/orchestration/__tests__/approvedToolsLifecycle.integration.test.ts
@@ -349,6 +349,30 @@ describe('approved catalog across presentation and lifecycle', () => {
}
)
+ it.each([
+ 'https://json-schema.org/draft/2019-09/schema',
+ 'https://json-schema.org/draft/2019-09/schema#',
+ 'https://json-schema.org/draft/2020-12/schema',
+ 'https://json-schema.org/draft/2020-12/schema#',
+ ])('accepts a supported dialect including its equivalent empty fragment: %s', async dialect => {
+ const { manager, registry, config } = await setup()
+ remote.catalogs.get('alpha')![0].inputSchema = {
+ $schema: dialect,
+ type: 'object',
+ properties: { recordId: { type: 'string' } },
+ required: ['recordId'],
+ }
+ await manager.replaceServer(serverInfo('alpha'))
+ registry.listDefinitions()
+ const result = await executeToolCalls(
+ [bridgeCall('alpha__record__read_000', 'dialect-call', { recordId: 'record-1' })],
+ config,
+ 0
+ )
+ expect(result.toolResults[0].is_error).toBe(false)
+ expect(remote.calls).toHaveBeenCalledTimes(1)
+ })
+
it('a captured adapter rechecks an in-place changed schema immediately before execution', async () => {
const { manager, registry } = await setup()
const target = 'alpha__record__read_000'