Conversation
acd2055 to
b221b26
Compare
…ution Introduce aggregates[] on Capability for defining reusable domain functions - Schema: Aggregate, AggregateFunction, Semantics definitions; ref on McpTool and ExposedOperation - Engine: AggregateRefResolver merges ref fields and derives MCP hints from semantics - Spectral: aggregate-semantics-consistency rule detects contradictions between semantics, MCP hints, and REST methods - Tests: 25 unit + 11 integration + 3 Spectral tests - Docs: Specification-Schema, FAQ, design-guidelines, AGENTS.md, SKILL.md, wrap-api-as-mcp Closes #191
b221b26 to
32a83ba
Compare
| "name", | ||
| "description" | ||
| ], | ||
| "required": [], |
There was a problem hiding this comment.
This will not work after merge of mpc mock.
After the rebase of #236 you will have
"required": [],
"anyOf": [
{ "required": ["name", "description", "call"], ... }, // simple
{ "required": ["name", "description", "steps"], ... }, // orchestrated
{ "required": ["ref"] } // ref (aggregate)
]
which will allow an empty tool sincerefis required only from an anyOf branching perspective.
I think should become :
{
"required": ["name", "description", "outputParameters"],
"type": "object",
"description": "Mock mode: serves static responses from const values. No call, steps, or ref needed.",
"properties": {
"outputParameters": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/MockOutputParameter"
}
}
},
"not": {
"anyOf": [
{ "required": ["call"] },
{ "required": ["steps"] },
{ "required": ["ref"] }
]
}
}
But we should close #236 first and rebase since the two re working on the same schema, we will have non trivial conflicts
Related Issue
Closes #191
What does this PR do?
Introduces
aggregates[]on the Capability object, enabling DDD-inspired domain functions that can be defined once and referenced from multiple adapters (MCP tools, REST operations) viaref.Schema:
Aggregate,AggregateFunction,Semanticsrefproperty onMcpToolandExposedOperation(thirdanyOfbranch alongside simple/orchestrated)nameanddescriptionare optional when usingref(inherited from the function)Engine:
AggregateRefResolvermerges inherited fields from the referenced function (name, description, call, with, steps, inputParameters, outputParameters) — explicit fields override inherited oneshintsfrom functionsemantics(safe → readOnly/destructive, idempotent → idempotent), with explicit hints overriding derived valuesSpectral:
naftiko-aggregate-function-descriptionrule: warns when a function lacks a descriptionnaftiko-aggregate-semantics-consistencyrule (custom JS function): detects contradictions between function semantics and MCP tool hints (e.g. safe=true + destructive=true) or REST methods (e.g. safe=true + DELETE)Documentation:
Built on top of #239 (MCP tool hints).
Tests
AggregateRefResolverTest): function map indexing, ref lookup, MCP tool merge (name, description, call, inputParams), REST operation merge, deriveHints (6 scenarios), mergeHints (3 scenarios), resolve pipelineAggregateIntegrationTest): end-to-end YAML → engine → output for ref resolution, parameter inheritance, hints derivation, overrides, backward compatibility, unknown ref fail-fastNaftikoSpectralRulesetTest): semantics-hints contradiction detection, REST method contradiction, consistent-document no-warnaggregate-basic.yaml,aggregate-hints-override.yaml,aggregate-invalid-ref.yaml, plus 2 Spectral fixturesChecklist
mainAgent Context (optional)