@thehammer/schema-mcp-server 1.0.6 → 1.0.8
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/api-client.d.ts +19 -0
- package/dist/api-client.js +28 -0
- package/dist/index.js +48 -3
- package/package.json +1 -1
package/dist/api-client.d.ts
CHANGED
|
@@ -38,5 +38,24 @@ export declare function getTemplatePreviewHtml(templateId: number, teamObjectId?
|
|
|
38
38
|
export declare function getStyleList(): Promise<ApiResponse>;
|
|
39
39
|
export declare function listQualityGateItems(): Promise<ApiResponse>;
|
|
40
40
|
export declare function submitQualityGateReview(itemId: number, status: string, analysis: string, message?: string): Promise<ApiResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Check (or kick off) quality gate review for a single category.
|
|
43
|
+
*
|
|
44
|
+
* Returns one of: passed (cache hit), running (reviewer dispatched or in flight),
|
|
45
|
+
* failed (items need fixes with analysis). The orchestrator uses this as its
|
|
46
|
+
* primary quality-gate entry point — call once per category when 100% done with
|
|
47
|
+
* that category's work.
|
|
48
|
+
*/
|
|
49
|
+
export declare function callQualityGate(category: string, message?: string): Promise<ApiResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Orchestrator finalization — mandatory last action before exit.
|
|
52
|
+
*
|
|
53
|
+
* Returns {ok: true} when every outstanding check has cleared, transitioning the
|
|
54
|
+
* dispatch to completed. Returns {ok: false, outstanding: [...]} when any category
|
|
55
|
+
* is pending, any item failed, any template has validation_errors, or any directive
|
|
56
|
+
* has meta.selector_mismatches / meta.extraction_coverage_errors. In the non-empty
|
|
57
|
+
* case, the dispatch stays running so the agent can fix the issues and re-call.
|
|
58
|
+
*/
|
|
59
|
+
export declare function completeDispatch(message?: string): Promise<ApiResponse>;
|
|
41
60
|
export declare function postProgress(progressMessage: string, phase?: string): Promise<ApiResponse>;
|
|
42
61
|
export { SCHEMA_ID };
|
package/dist/api-client.js
CHANGED
|
@@ -177,6 +177,34 @@ export async function submitQualityGateReview(itemId, status, analysis, message)
|
|
|
177
177
|
message,
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Check (or kick off) quality gate review for a single category.
|
|
182
|
+
*
|
|
183
|
+
* Returns one of: passed (cache hit), running (reviewer dispatched or in flight),
|
|
184
|
+
* failed (items need fixes with analysis). The orchestrator uses this as its
|
|
185
|
+
* primary quality-gate entry point — call once per category when 100% done with
|
|
186
|
+
* that category's work.
|
|
187
|
+
*/
|
|
188
|
+
export async function callQualityGate(category, message) {
|
|
189
|
+
return apiRequest("POST", mcpPath("quality-gate"), {
|
|
190
|
+
category,
|
|
191
|
+
message,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Orchestrator finalization — mandatory last action before exit.
|
|
196
|
+
*
|
|
197
|
+
* Returns {ok: true} when every outstanding check has cleared, transitioning the
|
|
198
|
+
* dispatch to completed. Returns {ok: false, outstanding: [...]} when any category
|
|
199
|
+
* is pending, any item failed, any template has validation_errors, or any directive
|
|
200
|
+
* has meta.selector_mismatches / meta.extraction_coverage_errors. In the non-empty
|
|
201
|
+
* case, the dispatch stays running so the agent can fix the issues and re-call.
|
|
202
|
+
*/
|
|
203
|
+
export async function completeDispatch(message) {
|
|
204
|
+
return apiRequest("POST", mcpPath("complete"), {
|
|
205
|
+
message,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
180
208
|
export async function postProgress(progressMessage, phase) {
|
|
181
209
|
return apiRequest("POST", mcpPath("progress"), {
|
|
182
210
|
message: progressMessage,
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const server = new McpServer({
|
|
|
36
36
|
* orchestrator — Read-only + annotations + context + progress (no mutations)
|
|
37
37
|
* schema-builder — Schema mutations + reads (no directives/templates/annotations)
|
|
38
38
|
* behavior-builder — Directive mutations + reads (no schema/templates/annotations)
|
|
39
|
-
* template-builder — Template mutations + reads + styles (
|
|
39
|
+
* template-builder — Template mutations + reads + styles + annotation_create (for missing-field questions)
|
|
40
40
|
* full (default) — All tools (backwards compatible, used by reviewer agents)
|
|
41
41
|
*/
|
|
42
42
|
const SCHEMA_ROLE = process.env.SCHEMA_ROLE || "full";
|
|
@@ -66,6 +66,9 @@ const ROLE_TOOLS = {
|
|
|
66
66
|
"context_workflow_inputs",
|
|
67
67
|
"context_workflow_input_pages",
|
|
68
68
|
"context_chat_history",
|
|
69
|
+
// Agent-driven quality gate lifecycle (orchestrator-only)
|
|
70
|
+
"quality_gate",
|
|
71
|
+
"complete",
|
|
69
72
|
]),
|
|
70
73
|
"schema-builder": new Set([
|
|
71
74
|
...COMMON_TOOLS,
|
|
@@ -92,6 +95,7 @@ const ROLE_TOOLS = {
|
|
|
92
95
|
"template_set_sample_data",
|
|
93
96
|
"quality_gate_submit_review",
|
|
94
97
|
"style_list",
|
|
98
|
+
"annotation_create", // Question annotations for missing fields → orchestrator decides
|
|
95
99
|
]),
|
|
96
100
|
reviewer: new Set([
|
|
97
101
|
...COMMON_TOOLS,
|
|
@@ -529,12 +533,23 @@ if (shouldRegister("template_create"))
|
|
|
529
533
|
return jsonResult(result);
|
|
530
534
|
});
|
|
531
535
|
if (shouldRegister("template_list"))
|
|
532
|
-
server.tool("template_list", "List all template definitions for the current schema"
|
|
536
|
+
server.tool("template_list", "List all template definitions for the current schema. " +
|
|
537
|
+
"Each template includes a `validation_errors` field — when non-null it indicates unresolved " +
|
|
538
|
+
"coherence-check failures (field_warnings, style_warnings, meta_warnings, region_warnings, " +
|
|
539
|
+
"formatter_warnings, required_warnings) from the most recent mutation. Orchestrators do not " +
|
|
540
|
+
"need to poll this — `complete` automatically surfaces template validation errors as " +
|
|
541
|
+
"`template_errors` in its outstanding list.", {}, async () => {
|
|
533
542
|
const result = await api.listTemplates();
|
|
534
543
|
return jsonResult(result);
|
|
535
544
|
});
|
|
536
545
|
if (shouldRegister("template_get"))
|
|
537
|
-
server.tool("template_get", "Get full details of a template definition including template_json"
|
|
546
|
+
server.tool("template_get", "Get full details of a template definition including template_json. " +
|
|
547
|
+
"The response includes a `validation_errors` field — when non-null it indicates unresolved " +
|
|
548
|
+
"coherence-check failures (field_warnings, style_warnings, meta_warnings, region_warnings, " +
|
|
549
|
+
"formatter_warnings, required_warnings). Template-builder sub-agents should inspect this field " +
|
|
550
|
+
"after their own mutations to self-correct before handing work back. Orchestrators do not need " +
|
|
551
|
+
"to poll this — `complete` automatically surfaces template validation errors in its " +
|
|
552
|
+
"outstanding list.", {
|
|
538
553
|
template_id: z.number().describe("ID of the template to fetch"),
|
|
539
554
|
}, async ({ template_id }) => {
|
|
540
555
|
const result = await api.getTemplateDetails(template_id);
|
|
@@ -665,6 +680,36 @@ if (shouldRegister("quality_gate_submit_review"))
|
|
|
665
680
|
const result = await api.submitQualityGateReview(quality_gate_item_id, status, analysis, message);
|
|
666
681
|
return jsonResult(result);
|
|
667
682
|
});
|
|
683
|
+
if (shouldRegister("quality_gate"))
|
|
684
|
+
server.tool("quality_gate", "Run the quality gate for a single category (schema, directive, or template). " +
|
|
685
|
+
"Call this when you are 100% done with that category's work — it either returns cached " +
|
|
686
|
+
"results instantly or dispatches a reviewer. Response statuses: " +
|
|
687
|
+
"'passed' means all items in the category are green (safe to move on); " +
|
|
688
|
+
"'running' means a reviewer is in flight — do other useful work and call again later; " +
|
|
689
|
+
"'failed' means items need fixes — read each item's `analysis`, apply fixes via mutation " +
|
|
690
|
+
"tools (which auto-invalidate the category), then re-call this tool. " +
|
|
691
|
+
"You may call this for different categories in parallel while sub-agents are running.", {
|
|
692
|
+
category: z
|
|
693
|
+
.enum(["schema", "directive", "template"])
|
|
694
|
+
.describe("The quality gate category to check. Must be one of: schema, directive, template."),
|
|
695
|
+
message: messageParam,
|
|
696
|
+
}, async ({ category, message }) => {
|
|
697
|
+
const result = await api.callQualityGate(category, message);
|
|
698
|
+
return jsonResult(result);
|
|
699
|
+
});
|
|
700
|
+
if (shouldRegister("complete"))
|
|
701
|
+
server.tool("complete", "MANDATORY final action — call this to finalize your dispatch. Aggregates every known " +
|
|
702
|
+
"failure surface (pending quality gate categories, failed items, template validation " +
|
|
703
|
+
"errors, directive meta errors) and either transitions your dispatch to completed " +
|
|
704
|
+
"when everything is clean (returns {ok: true}) or returns {ok: false, outstanding: [...]} " +
|
|
705
|
+
"listing exactly what still needs fixing. When outstanding is non-empty, work through " +
|
|
706
|
+
"each item and call this tool again. Do NOT exit your session without calling this tool " +
|
|
707
|
+
"successfully — your dispatch will be marked dead by the heartbeat watchdog instead.", {
|
|
708
|
+
message: messageParam,
|
|
709
|
+
}, async ({ message }) => {
|
|
710
|
+
const result = await api.completeDispatch(message);
|
|
711
|
+
return jsonResult(result);
|
|
712
|
+
});
|
|
668
713
|
// ============================================================================
|
|
669
714
|
// Style Library Tools (read-only)
|
|
670
715
|
// ============================================================================
|