Skip to content

Commit f759d39

Browse files
author
EslaM-X
committed
fix(mcp): update tests/docs for 20 MCP tools and add CG-ME/1 d.ts exports
- Update agent-commerce-mcp integration test for 20 tools\n- Add outputSchema descriptions for Wave 1 tools\n- Add machine-economy exports to index.d.ts\n- Fix stale test count in HOW-TO-EVALUATE.md
1 parent 0c7d89b commit f759d39

4 files changed

Lines changed: 37 additions & 12 deletions

File tree

‎docs/HOW-TO-EVALUATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ npm test
2929
```
3030

3131
**Expected / المتوقع:**
32-
`ℹ tests 1972` · `ℹ pass 1955` · `ℹ fail 0`
32+
`ℹ tests 1986` · `ℹ pass 1986` · `ℹ fail 0`
3333

3434
This enforces the total against [`docs/state-snapshot.json`](state-snapshot.json). Any drift makes it fail.
3535
هذا المجموع مُقيد آليًا ضد لقطة الحالة المقاسة، وأي انحراف يفشل الاختبار.

‎packages/agent-commerce/index.d.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,21 @@ export interface ControlPlaneLedgerVerification {
11031103
boundary: string;
11041104
}
11051105

1106+
// CG-ME/1 - Machine Economy Wave 1 (deterministic offline, no custody/broadcast/network)
1107+
export declare const MACHINE_ECONOMY_VERSION: string;
1108+
export declare const MACHINE_ECONOMY_BOUNDARY: string;
1109+
export declare function parseX402Challenge(input?: any): any;
1110+
export declare function authorizeX402Payment(input?: any): any;
1111+
export declare function verifyX402Settlement(input?: any): any;
1112+
export declare function reconcilePayment(input?: any): any;
1113+
export declare function meterAgentUsage(input?: any): any;
1114+
export declare function registerMachine(input?: any): any;
1115+
export declare function createMachineTask(input?: any): any;
1116+
export declare function verifyTelemetry(input?: any): any;
1117+
export declare function verifyTaskCompletion(input?: any): any;
1118+
export declare function verifyDelegationChain(input?: any): any;
1119+
export declare function machineEconomySelfCheck(): Array<[string, boolean]>;
1120+
11061121
export interface ControlPlane {
11071122
version: string;
11081123
schema: string;

‎packages/agent-commerce/mcp.mjs‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -554,61 +554,61 @@ const TOOLS = Object.freeze([
554554
name: "coreguard_parse_x402_challenge",
555555
description: "Parse and normalize an x402 payment challenge (HTTP 402 accepts). Offline deterministic validation only; no network contact, no payment execution.",
556556
inputSchema: { type: "object", properties: { challenge: { type: "object", description: "x402 challenge/402 body with accepts[]" }, ...CALLER_CONTEXT_PROPERTY }, required: ["challenge"] },
557-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, accepts: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
557+
outputSchema: { type: "object", description: "Parsed x402 challenge with normalized accepts, issues, and boundary; no network call.", properties: { verdict: { type: "string" }, issues: { type: "array" }, accepts: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
558558
},
559559
{
560560
name: "coreguard_authorize_x402_payment",
561561
description: "Evaluate an x402 challenge against a local policy and produce an authorization decision. No custody, no broadcast, no payment execution.",
562562
inputSchema: { type: "object", properties: { challenge: { type: "object" }, policy: { type: "object", description: "policy: maxAmount, allowedNetworks, allowedAssets, allowedPayTo" }, selectedIndex: { type: "integer", minimum: 0 }, ...CALLER_CONTEXT_PROPERTY }, required: ["challenge", "policy"] },
563-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, authorizationId: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
563+
outputSchema: { type: "object", description: "x402 authorization decision with policy issues and authorizationId; no payment executed.", properties: { verdict: { type: "string" }, authorizationId: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
564564
},
565565
{
566566
name: "coreguard_verify_x402_settlement",
567567
description: "Verify caller-supplied x402 settlement evidence against a challenge. No network confirmation performed; evidence-only, fail-closed.",
568568
inputSchema: { type: "object", properties: { challenge: { type: "object" }, settlement: { type: "object", description: "caller-supplied settlement evidence (network, asset, amount, payTo, txRef, status)" }, ...CALLER_CONTEXT_PROPERTY }, required: ["challenge", "settlement"] },
569-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
569+
outputSchema: { type: "object", description: "x402 settlement verification from caller-supplied evidence; no network confirmation.", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
570570
},
571571
{
572572
name: "coreguard_reconcile_payment",
573573
description: "Reconcile authorization, settlement evidence, and receipt. Deterministic evidence check only; no external ledger/custody.",
574574
inputSchema: { type: "object", properties: { authorization: { type: "object" }, challenge: { type: "object" }, settlement: { type: "object" }, receipt: { type: "object" }, ...CALLER_CONTEXT_PROPERTY }, required: ["authorization"] },
575-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
575+
outputSchema: { type: "object", description: "Payment reconciliation verdict across authorization, settlement, and receipt evidence.", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
576576
},
577577
{
578578
name: "coreguard_meter_agent_usage",
579579
description: "Deterministically meter agent usage/cost events into an auditable total. No billing custody or external payment.",
580580
inputSchema: { type: "object", properties: { agentId: { type: "string" }, events: { type: "array", items: { type: "object" } }, currency: { type: "string" }, ...CALLER_CONTEXT_PROPERTY }, required: ["agentId", "events"] },
581-
outputSchema: { type: "object", properties: { totalAmount: { type: "string" }, eventCount: { type: "integer" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
581+
outputSchema: { type: "object", description: "Deterministic agent usage metering totals and event digest; no billing custody.", properties: { totalAmount: { type: "string" }, eventCount: { type: "integer" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
582582
},
583583
{
584584
name: "coreguard_register_machine",
585585
description: "Create a local machine registration record from a manifest. No external device attestation/TPM trust root verification performed.",
586586
inputSchema: { type: "object", properties: { machineId: { type: "string" }, manifest: { type: "object" }, owner: { type: "string" }, ...CALLER_CONTEXT_PROPERTY }, required: ["machineId", "manifest"] },
587-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, registrationId: { type: "string" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
587+
outputSchema: { type: "object", description: "Local machine registration record; external device attestation not performed.", properties: { verdict: { type: "string" }, registrationId: { type: "string" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
588588
},
589589
{
590590
name: "coreguard_create_machine_task",
591591
description: "Create a deterministic machine task record with terms/price/SLA conditions. No payment custody or physical execution guarantee.",
592592
inputSchema: { type: "object", properties: { taskId: { type: "string" }, machineId: { type: "string" }, terms: { type: "object" }, ...CALLER_CONTEXT_PROPERTY }, required: ["taskId", "machineId", "terms"] },
593-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, taskDigest: { type: "string" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
593+
outputSchema: { type: "object", description: "Deterministic machine task record with terms digest and boundary.", properties: { verdict: { type: "string" }, taskDigest: { type: "string" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
594594
},
595595
{
596596
name: "coreguard_verify_telemetry",
597597
description: "Verify caller-supplied telemetry evidence structure/digest presence. Signature authenticity and physical-world truth are NOT proven without trusted device keys/attestation.",
598598
inputSchema: { type: "object", properties: { taskId: { type: "string" }, telemetry: { type: "object" }, ...CALLER_CONTEXT_PROPERTY }, required: ["taskId", "telemetry"] },
599-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
599+
outputSchema: { type: "object", description: "Telemetry evidence verification result; signature trust/physical truth not proven.", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
600600
},
601601
{
602602
name: "coreguard_verify_task_completion",
603603
description: "Verify task completion evidence against task record. Evidence acceptance is not physical-world proof; independent verification required for high-stakes actions.",
604604
inputSchema: { type: "object", properties: { task: { type: "object" }, completion: { type: "object" }, telemetryVerification: { type: "object" }, ...CALLER_CONTEXT_PROPERTY }, required: ["task", "completion"] },
605-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
605+
outputSchema: { type: "object", description: "Task completion evidence verification result; evidence acceptance is not physical proof.", properties: { verdict: { type: "string" }, issues: { type: "array" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
606606
},
607607
{
608608
name: "coreguard_verify_delegation_chain",
609609
description: "Verify delegation chain structure and continuity. Cryptographic signature verification requires trusted roots; not performed here.",
610610
inputSchema: { type: "object", properties: { chain: { type: "array", items: { type: "object" } }, ...CALLER_CONTEXT_PROPERTY }, required: ["chain"] },
611-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, issues: { type: "array" }, depth: { type: "integer" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
611+
outputSchema: { type: "object", description: "Delegation chain structural verification result; signatures require trusted roots.", properties: { verdict: { type: "string" }, issues: { type: "array" }, depth: { type: "integer" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
612612
},
613613
]);
614614

‎test/integrations/agent-commerce-mcp.test.mjs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test("MCP initialize answers the pinned protocol version and server info", async
142142
});
143143
});
144144

145-
test("tools/list exposes the 10 provider-independent tools with schemas", async () => {
145+
test("tools/list exposes the 20 provider-independent tools with schemas", async () => {
146146
await withServer(async ({ request }) => {
147147
await request("initialize", {});
148148
const res = await request("tools/list", {});
@@ -159,6 +159,16 @@ test("tools/list exposes the 10 provider-independent tools with schemas", async
159159
"coreguard_decide_outcome",
160160
"coreguard_profile_reference",
161161
"coreguard_consumption_status",
162+
"coreguard_parse_x402_challenge",
163+
"coreguard_authorize_x402_payment",
164+
"coreguard_verify_x402_settlement",
165+
"coreguard_reconcile_payment",
166+
"coreguard_meter_agent_usage",
167+
"coreguard_register_machine",
168+
"coreguard_create_machine_task",
169+
"coreguard_verify_telemetry",
170+
"coreguard_verify_task_completion",
171+
"coreguard_verify_delegation_chain",
162172
]
163173
);
164174
for (const t of res.result.tools) {

0 commit comments

Comments
 (0)