onto-mcp 0.4.1 → 0.4.3
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/dist/mcp/server.js +16 -29
- package/package.json +1 -1
package/dist/mcp/server.js
CHANGED
|
@@ -326,37 +326,17 @@ const RECONSTRUCT_SESSION_INPUT_SCHEMA = {
|
|
|
326
326
|
},
|
|
327
327
|
},
|
|
328
328
|
};
|
|
329
|
+
// NOTE: top-level `allOf`/`oneOf`/`anyOf` is rejected by the Anthropic tool API
|
|
330
|
+
// ("input_schema does not support oneOf/allOf/anyOf at the top level"), which 400s
|
|
331
|
+
// the whole request when onto is enabled. Per-`directiveKind` required-field rules
|
|
332
|
+
// are enforced at runtime by OntoValidateReconstructDirectiveToolInputSchema
|
|
333
|
+
// (a Zod discriminatedUnion) in the handler, so they are intentionally not encoded
|
|
334
|
+
// here. Keep this schema a flat object: common required fields plus optional
|
|
335
|
+
// per-kind properties documented in their descriptions.
|
|
329
336
|
const VALIDATE_RECONSTRUCT_DIRECTIVE_INPUT_SCHEMA = {
|
|
330
337
|
type: "object",
|
|
331
338
|
additionalProperties: false,
|
|
332
339
|
required: ["directiveKind", "sourceObservationsPath"],
|
|
333
|
-
allOf: [
|
|
334
|
-
{
|
|
335
|
-
if: {
|
|
336
|
-
properties: { directiveKind: { const: "source_observation" } },
|
|
337
|
-
required: ["directiveKind"],
|
|
338
|
-
},
|
|
339
|
-
then: { required: ["directivePath"] },
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
if: {
|
|
343
|
-
properties: { directiveKind: { const: "candidate_disposition" } },
|
|
344
|
-
required: ["directiveKind"],
|
|
345
|
-
},
|
|
346
|
-
then: {
|
|
347
|
-
required: ["candidateInventoryPath", "candidateDispositionPath"],
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
if: {
|
|
352
|
-
properties: { directiveKind: { const: "ontology_seed" } },
|
|
353
|
-
required: ["directiveKind"],
|
|
354
|
-
},
|
|
355
|
-
then: {
|
|
356
|
-
required: ["ontologySeedPath", "candidateDispositionPath"],
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
],
|
|
360
340
|
properties: {
|
|
361
341
|
directiveKind: {
|
|
362
342
|
type: "string",
|
|
@@ -507,6 +487,9 @@ function toReviewRequest(input) {
|
|
|
507
487
|
return request;
|
|
508
488
|
}
|
|
509
489
|
function formatToolResult(data) {
|
|
490
|
+
// Per MCP, `structuredContent` must be a JSON object. Callers that produce a
|
|
491
|
+
// top-level array (e.g. a list of domains/profiles) must wrap it in an object
|
|
492
|
+
// before calling this, or strict MCP clients reject the result.
|
|
510
493
|
const text = JSON.stringify(data, null, 2);
|
|
511
494
|
return {
|
|
512
495
|
content: [{ type: "text", text }],
|
|
@@ -963,11 +946,15 @@ async function callTool(name, args, options = {}) {
|
|
|
963
946
|
return formatToolResult(await reviewApi.listLenses());
|
|
964
947
|
case "onto.list_domains": {
|
|
965
948
|
const parsed = OntoListDomainsToolInputSchema.parse(args ?? {});
|
|
966
|
-
|
|
949
|
+
const domains = await reviewApi.listDomains(parsed.projectRoot);
|
|
950
|
+
// Wrap the array so structuredContent is a JSON object (MCP requirement).
|
|
951
|
+
return formatToolResult({ domains });
|
|
967
952
|
}
|
|
968
953
|
case "onto.list_source_profiles": {
|
|
969
954
|
const parsed = OntoListSourceProfilesToolInputSchema.parse(args ?? {});
|
|
970
|
-
|
|
955
|
+
const sourceProfiles = await reconstructApi.listSourceProfiles(parsed.projectRoot);
|
|
956
|
+
// Wrap the array so structuredContent is a JSON object (MCP requirement).
|
|
957
|
+
return formatToolResult({ sourceProfiles });
|
|
971
958
|
}
|
|
972
959
|
case "onto.observe_source": {
|
|
973
960
|
const parsed = OntoObserveSourceToolInputSchema.parse(args);
|
package/package.json
CHANGED