@theoremjs/web 0.3.5-next.902.g334d23a → 0.3.5-next.906.g6f050f4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/server/mcp-handler.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/web",
|
|
3
|
-
"version": "0.3.5-next.
|
|
3
|
+
"version": "0.3.5-next.906.g6f050f4",
|
|
4
4
|
"description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"zod": "^4.6.5",
|
|
28
|
-
"@theoremjs/agents": "^0.3.5-next.
|
|
28
|
+
"@theoremjs/agents": "^0.3.5-next.906.g6f050f4"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/server/mcp-handler.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
15
|
import { invokeTool, labelText, registerProfile, } from '@theoremjs/agents';
|
|
16
|
-
import { caughtStatus, clientError } from '@theoremjs/agents/host';
|
|
16
|
+
import { caughtStatus, clientError, inputSchemaForModel, markedFieldsIn, } from '@theoremjs/agents/host';
|
|
17
17
|
import { hostInterface } from "../client/host-transport.js";
|
|
18
18
|
import { defineHostProfile, hostTool } from "./handler.js";
|
|
19
19
|
import { boundedRequestJson, requestByteLimit } from "./request-body.js";
|
|
@@ -202,7 +202,7 @@ export function createTheoremMcpHandler(options) {
|
|
|
202
202
|
const listed = () => hostInterface(host, hostTool).tools.map((tool) => ({
|
|
203
203
|
name: tool.name,
|
|
204
204
|
description: tool.description,
|
|
205
|
-
inputSchema: tool.inputSchema,
|
|
205
|
+
inputSchema: inputSchemaForModel(tool.inputSchema),
|
|
206
206
|
annotations: {
|
|
207
207
|
readOnlyHint: tool.access === 'read-only',
|
|
208
208
|
...(tool.access === 'destructive' ? { destructiveHint: true } : {}),
|
|
@@ -213,6 +213,11 @@ export function createTheoremMcpHandler(options) {
|
|
|
213
213
|
if (typeof name !== 'string' || !listed().some((tool) => tool.name === name))
|
|
214
214
|
// labels-exempt: protocol diagnostic for the MCP client, not end-user copy
|
|
215
215
|
throw new RpcError(200, INVALID_PARAMS, `Unknown tool: ${String(name)}`);
|
|
216
|
+
const inputSchema = hostTool(name)?.inputSchema;
|
|
217
|
+
const hostFields = inputSchema ? markedFieldsIn(inputSchema, params.arguments) : [];
|
|
218
|
+
if (hostFields.length > 0)
|
|
219
|
+
// labels-exempt: protocol diagnostic for the MCP client, not end-user copy
|
|
220
|
+
throw new RpcError(200, INVALID_PARAMS, `Not inputs of ${name}: ${hostFields.join(', ')}`);
|
|
216
221
|
const events = [];
|
|
217
222
|
for await (const event of invokeTool({
|
|
218
223
|
profile: host.id,
|