@twin3-ai/agent-id 0.3.49 → 0.3.50

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/mcp-runtime.js ADDED
@@ -0,0 +1,1656 @@
1
+ "use strict";
2
+
3
+ const { configuredEndpoint } = require("./runtime-config.js");
4
+ const { version } = require("./package.json");
5
+ const { MCP_MESSAGES } = require("./mcp-i18n.js");
6
+
7
+ const SUPPORTED_PROTOCOL_VERSIONS = Object.freeze([
8
+ "2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"
9
+ ]);
10
+ const TOOL_ALIASES = Object.freeze({ outcome_report: "m1_outcome_report" });
11
+ const own = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
12
+ const objectValue = value => value !== null && typeof value === "object" && !Array.isArray(value);
13
+
14
+ class RpcError extends Error {
15
+ constructor(code, message) {
16
+ super(message);
17
+ this.code = code;
18
+ }
19
+ }
20
+
21
+ class ToolError extends Error {}
22
+
23
+ function freeze(value) {
24
+ if (value && typeof value === "object" && !Object.isFrozen(value)) {
25
+ Object.values(value).forEach(freeze);
26
+ Object.freeze(value);
27
+ }
28
+ return value;
29
+ }
30
+
31
+ // Validate the JSON Schema vocabulary used by the published tool contracts.
32
+ // Errors describe fields and rules, never the caller's values or credentials.
33
+ function validate(schema, value, field = "arguments") {
34
+ const invalid = rule => { throw new RpcError(-32602, `${field} ${rule}`); };
35
+ if (schema.anyOf && !schema.anyOf.some(option => {
36
+ try { validate(option, value, field); return true; } catch (error) {
37
+ if (!(error instanceof RpcError)) throw error;
38
+ return false;
39
+ }
40
+ })) invalid("does not match any allowed schema");
41
+ if (schema.type) {
42
+ const types = Array.isArray(schema.type) ? schema.type : [schema.type];
43
+ const matches = type => type === "object" ? objectValue(value)
44
+ : type === "array" ? Array.isArray(value)
45
+ : type === "integer" ? Number.isInteger(value)
46
+ : type === "number" ? typeof value === "number" && Number.isFinite(value)
47
+ : type === "null" ? value === null
48
+ : typeof value === type;
49
+ if (!types.some(matches)) invalid(`must be ${types.join(" or ")}`);
50
+ }
51
+ if (own(schema, "const") && value !== schema.const) invalid("must use the declared fixed value");
52
+ if (schema.enum && !schema.enum.includes(value)) invalid("must use an allowed value");
53
+ if (objectValue(value)) {
54
+ for (const key of schema.required || []) {
55
+ if (!own(value, key)) invalid(`requires ${key}`);
56
+ }
57
+ for (const [key, item] of Object.entries(value)) {
58
+ if (own(schema.properties || {}, key)) validate(schema.properties[key], item, `${field}.${key}`);
59
+ else if (schema.additionalProperties === false) invalid("contains an undeclared property");
60
+ else if (objectValue(schema.additionalProperties)) validate(schema.additionalProperties, item, field);
61
+ }
62
+ }
63
+ if (Array.isArray(value) && schema.items) {
64
+ value.forEach((item, index) => validate(schema.items, item, `${field}[${index}]`));
65
+ }
66
+ if (typeof value === "string") {
67
+ const length = [...value].length;
68
+ if (schema.minLength !== undefined && length < schema.minLength) invalid("is too short");
69
+ if (schema.maxLength !== undefined && length > schema.maxLength) invalid("is too long");
70
+ if (schema.pattern && !new RegExp(schema.pattern).test(value)) invalid("has an invalid format");
71
+ if (schema.format === "uri") {
72
+ try { new URL(value); } catch { invalid("must be an absolute URI"); }
73
+ }
74
+ }
75
+ if (typeof value === "number") {
76
+ if (schema.minimum !== undefined && value < schema.minimum) invalid("is below the minimum");
77
+ if (schema.maximum !== undefined && value > schema.maximum) invalid("exceeds the maximum");
78
+ }
79
+ }
80
+
81
+ function requiredCredential(value, label) {
82
+ if (typeof value !== "string" || !value.trim()) throw new ToolError(`${label} is required.`);
83
+ if (/[\r\n]/.test(value)) throw new ToolError(`${label} has an invalid format.`);
84
+ return value.trim();
85
+ }
86
+
87
+ function tool(name, description, inputSchema, http) {
88
+ // The same immutable entry owns declaration, validation, routing and execution.
89
+ const entry = { name, description, inputSchema, ...http };
90
+ entry.handler = async (args, context) => {
91
+ let operation = entry;
92
+ if (entry.operations) {
93
+ const selected = args.operation === undefined ? entry.defaultOperation : args.operation;
94
+ if (typeof selected !== "string" || !own(entry.operations, selected)) {
95
+ throw new RpcError(-32602, "arguments.operation must use a supported operation");
96
+ }
97
+ operation = { ...entry, ...entry.operations[selected] };
98
+ }
99
+ const method = operation.postWhen && operation.postWhen(args) ? "POST" : operation.method;
100
+ let route = operation.route;
101
+ for (const field of operation.pathParameters || []) {
102
+ route = route.replace(`{${field}}`, encodeURIComponent(args[field]));
103
+ }
104
+ const headers = {};
105
+ const body = { ...args };
106
+ const sensitive = [args.agent_key, args.access_token, args.recovery_capability, context.env.AGENT_ID_MCP_ACCESS_TOKEN]
107
+ .flatMap(value => typeof value === "string" ? [value, value.trim()] : []);
108
+ if (operation.auth === "site-key") {
109
+ requiredCredential(args.url, "url");
110
+ const key = requiredCredential(args.agent_key, "agent_key");
111
+ headers.Authorization = `Bearer ${key}`;
112
+ delete body.agent_key;
113
+ } else if (operation.auth === "site-body") {
114
+ requiredCredential(args.url, "url");
115
+ body.agent_key = requiredCredential(args.agent_key, "agent_key");
116
+ } else if (operation.auth === "enterprise") {
117
+ // Strict recruiting schemas cannot carry secrets. Configure the process
118
+ // with an existing enterprise access token; a Site Agent Key is not one.
119
+ const token = requiredCredential(args.access_token === undefined
120
+ ? context.env.AGENT_ID_MCP_ACCESS_TOKEN : args.access_token, "Enterprise access token (AGENT_ID_MCP_ACCESS_TOKEN)");
121
+ headers.Authorization = `Bearer ${token}`;
122
+ sensitive.push(token);
123
+ delete body.access_token;
124
+ delete body.operation;
125
+ }
126
+ if (operation.action) body.action = operation.action;
127
+ const query = new URLSearchParams();
128
+ for (const field of method === "GET" ? operation.query || [] : []) {
129
+ const value = args[field] === undefined ? operation.queryDefaults?.[field] : args[field];
130
+ if (value !== undefined && value !== "") query.set(field, String(value));
131
+ }
132
+ for (const field of method === "GET" ? operation.flags || [] : []) {
133
+ if (args[field]) query.set(field, "1");
134
+ }
135
+ return context.request({ method, route, query, headers, body: method === "POST" ? body : undefined, sensitive });
136
+ };
137
+ return freeze(entry);
138
+ }
139
+
140
+ // Tool declarations pinned to the production manifest captured for J1.
141
+ // Manifest SHA-256: 5dee6b98200b3b59eb8ecd5776291cfea88237340e4666a05589b50194025608.
142
+ // Legacy guards, graph claim arrays and inbox booleans remain for J5 to
143
+ // reconcile in the manifest; the original required/action/key guards stay strict.
144
+ const PUBLIC_EVIDENCE_INPUT_SCHEMA = freeze({
145
+ "type": "object",
146
+ "properties": {
147
+ "url": {
148
+ "type": "string"
149
+ },
150
+ "target_url": {
151
+ "type": "string"
152
+ },
153
+ "intent": {
154
+ "type": "string"
155
+ },
156
+ "evidence": {
157
+ "type": "object"
158
+ },
159
+ "public_metadata": {
160
+ "type": "object"
161
+ },
162
+ "setup_metadata": {
163
+ "type": "object"
164
+ },
165
+ "submission": {
166
+ "type": "object"
167
+ },
168
+ "platform_id": {
169
+ "type": "string"
170
+ },
171
+ "status": {
172
+ "type": "string"
173
+ },
174
+ "listing_url": {
175
+ "type": "string"
176
+ },
177
+ "platform_receipt_id": {
178
+ "type": "string"
179
+ },
180
+ "proof_url": {
181
+ "type": "string"
182
+ },
183
+ "jwt": {
184
+ "type": "string"
185
+ },
186
+ "token_context": {
187
+ "type": "object"
188
+ },
189
+ "claims": {
190
+ "type": "object"
191
+ },
192
+ "signature_verified": {
193
+ "type": "boolean"
194
+ },
195
+ "expected_audience": {
196
+ "type": "string"
197
+ },
198
+ "expected_email": {
199
+ "type": "string"
200
+ },
201
+ "evidence_type": {
202
+ "type": "string"
203
+ },
204
+ "certs": {
205
+ "type": "object"
206
+ },
207
+ "execution": {
208
+ "type": "object"
209
+ },
210
+ "store": {
211
+ "type": "boolean"
212
+ },
213
+ "events": {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "object"
217
+ }
218
+ },
219
+ "logs": {
220
+ "type": "array",
221
+ "items": {
222
+ "type": "object"
223
+ }
224
+ },
225
+ "user_agent": {
226
+ "type": "string"
227
+ },
228
+ "probes": {
229
+ "type": "array",
230
+ "items": {
231
+ "type": "object"
232
+ }
233
+ },
234
+ "probe_set": {
235
+ "type": "object"
236
+ },
237
+ "prompt": {
238
+ "type": "string"
239
+ },
240
+ "answer": {
241
+ "type": "string"
242
+ },
243
+ "citations": {
244
+ "type": "array",
245
+ "items": {}
246
+ },
247
+ "engine": {
248
+ "type": "string"
249
+ },
250
+ "engines": {
251
+ "anyOf": [
252
+ {
253
+ "type": "string"
254
+ },
255
+ {
256
+ "type": "array",
257
+ "items": {
258
+ "type": "string"
259
+ }
260
+ }
261
+ ]
262
+ },
263
+ "competitors": {
264
+ "type": "array",
265
+ "items": {
266
+ "type": "string"
267
+ }
268
+ },
269
+ "conversions": {
270
+ "type": "array",
271
+ "items": {
272
+ "type": "object"
273
+ }
274
+ },
275
+ "event": {
276
+ "type": "string"
277
+ },
278
+ "referrer": {
279
+ "type": "string"
280
+ },
281
+ "survey_source": {
282
+ "type": "string"
283
+ },
284
+ "value": {
285
+ "type": "number"
286
+ },
287
+ "currency": {
288
+ "type": "string"
289
+ },
290
+ "fetch": {
291
+ "type": "boolean"
292
+ },
293
+ "report": {
294
+ "type": "object"
295
+ },
296
+ "reports": {
297
+ "type": "array",
298
+ "items": {
299
+ "type": "object"
300
+ }
301
+ },
302
+ "result": {
303
+ "type": "object"
304
+ },
305
+ "results": {
306
+ "type": "array",
307
+ "items": {
308
+ "type": "object"
309
+ }
310
+ },
311
+ "product_metadata": {
312
+ "type": "object"
313
+ },
314
+ "pricing_metadata": {
315
+ "type": "object"
316
+ },
317
+ "receipt": {
318
+ "type": "object"
319
+ },
320
+ "receipts": {
321
+ "type": "array",
322
+ "items": {
323
+ "type": "object"
324
+ }
325
+ },
326
+ "before": {
327
+ "type": "object"
328
+ },
329
+ "after": {
330
+ "type": "object"
331
+ },
332
+ "audit": {
333
+ "type": "object"
334
+ },
335
+ "content": {
336
+ "type": "string"
337
+ },
338
+ "page": {
339
+ "type": "object"
340
+ },
341
+ "questions": {
342
+ "type": "array",
343
+ "items": {
344
+ "type": "string"
345
+ }
346
+ },
347
+ "topics": {
348
+ "anyOf": [
349
+ {
350
+ "type": "string"
351
+ },
352
+ {
353
+ "type": "array",
354
+ "items": {
355
+ "type": "string"
356
+ }
357
+ }
358
+ ]
359
+ },
360
+ "market": {
361
+ "type": "string"
362
+ },
363
+ "cadence": {
364
+ "type": "string"
365
+ },
366
+ "period": {
367
+ "type": "object"
368
+ },
369
+ "verify_artifacts": {
370
+ "type": "boolean"
371
+ },
372
+ "published_items": {
373
+ "type": "array",
374
+ "items": {
375
+ "type": "object"
376
+ }
377
+ },
378
+ "items": {
379
+ "type": "array",
380
+ "items": {
381
+ "type": "object"
382
+ }
383
+ },
384
+ "verify_publication": {
385
+ "type": "boolean"
386
+ },
387
+ "content_pack": {
388
+ "type": "object"
389
+ },
390
+ "pack": {
391
+ "type": "object"
392
+ },
393
+ "content_workflow_package": {
394
+ "type": "object"
395
+ },
396
+ "package": {
397
+ "type": "object"
398
+ },
399
+ "sheet": {
400
+ "type": "object"
401
+ },
402
+ "rows": {
403
+ "type": "array",
404
+ "items": {
405
+ "type": "object"
406
+ }
407
+ },
408
+ "completed_rows": {
409
+ "type": "array",
410
+ "items": {
411
+ "type": "object"
412
+ }
413
+ },
414
+ "insights": {
415
+ "type": "object"
416
+ },
417
+ "provider": {
418
+ "type": "string"
419
+ },
420
+ "evaluator": {
421
+ "type": "string"
422
+ },
423
+ "budget": {
424
+ "type": "number"
425
+ },
426
+ "draft": {
427
+ "type": "object"
428
+ },
429
+ "create_payload": {
430
+ "type": "object"
431
+ },
432
+ "job_type": {
433
+ "type": "string"
434
+ },
435
+ "job_id": {
436
+ "type": "string"
437
+ },
438
+ "payment_reference": {
439
+ "type": "string"
440
+ },
441
+ "payment_proof": {
442
+ "type": "object"
443
+ },
444
+ "payment_signature": {
445
+ "type": "string"
446
+ },
447
+ "deliverable_uri": {
448
+ "type": "string"
449
+ },
450
+ "deliverable": {
451
+ "type": "object"
452
+ },
453
+ "decision": {
454
+ "type": "string"
455
+ },
456
+ "reason": {
457
+ "type": "string"
458
+ },
459
+ "plan": {
460
+ "type": "string"
461
+ },
462
+ "email": {
463
+ "type": "string"
464
+ },
465
+ "method": {
466
+ "type": "string"
467
+ },
468
+ "procurement_event": {
469
+ "type": "object"
470
+ },
471
+ "action": {
472
+ "type": "object"
473
+ },
474
+ "execute": {
475
+ "type": "boolean"
476
+ },
477
+ "access_token": {
478
+ "type": "string"
479
+ },
480
+ "token_source": {
481
+ "anyOf": [
482
+ {
483
+ "type": "string"
484
+ },
485
+ {
486
+ "type": "object"
487
+ }
488
+ ]
489
+ },
490
+ "metadata_base": {
491
+ "type": "string"
492
+ },
493
+ "service_name": {
494
+ "type": "string"
495
+ },
496
+ "usage_reporting_id": {
497
+ "type": "string"
498
+ },
499
+ "metric_name": {
500
+ "type": "string"
501
+ },
502
+ "metric_value": {
503
+ "anyOf": [
504
+ {
505
+ "type": "number"
506
+ },
507
+ {
508
+ "type": "string"
509
+ }
510
+ ]
511
+ },
512
+ "start_time": {
513
+ "type": "string"
514
+ },
515
+ "end_time": {
516
+ "type": "string"
517
+ },
518
+ "operation_id": {
519
+ "type": "string"
520
+ },
521
+ "user_labels": {
522
+ "type": "object"
523
+ },
524
+ "payload": {
525
+ "type": "object"
526
+ },
527
+ "provider_id": {
528
+ "type": "string"
529
+ },
530
+ "account_id": {
531
+ "type": "string"
532
+ },
533
+ "entitlement_id": {
534
+ "type": "string"
535
+ },
536
+ "twin3_agent_id": {
537
+ "type": "string"
538
+ },
539
+ "pricing_model": {
540
+ "type": "string",
541
+ "enum": [
542
+ "free",
543
+ "subscription",
544
+ "usage",
545
+ "combined",
546
+ "subscription_plus_usage"
547
+ ]
548
+ }
549
+ },
550
+ "required": []
551
+ });
552
+
553
+ const S2_PACKAGE_REVIEW_INPUT_SCHEMA = freeze({
554
+ "type": "object",
555
+ "properties": {
556
+ "url": {
557
+ "type": "string"
558
+ },
559
+ "public_metadata": {
560
+ "type": "object"
561
+ },
562
+ "setup_metadata": {
563
+ "type": "object"
564
+ }
565
+ },
566
+ "required": []
567
+ });
568
+
569
+ const AGENT_TRUST_PACKAGE_INPUT_SCHEMA = freeze({
570
+ "type": "object",
571
+ "properties": {
572
+ "url": {
573
+ "type": "string"
574
+ }
575
+ },
576
+ "required": []
577
+ });
578
+
579
+ const GOOGLE_MARKETPLACE_AGENT_CARD_INPUT_SCHEMA = freeze({
580
+ "type": "object",
581
+ "properties": {
582
+ "url": {
583
+ "type": "string"
584
+ },
585
+ "product_metadata": {
586
+ "type": "object"
587
+ }
588
+ },
589
+ "required": []
590
+ });
591
+
592
+ const GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA = freeze({
593
+ "type": "object",
594
+ "properties": {
595
+ "url": {
596
+ "type": "string"
597
+ },
598
+ "product_metadata": {
599
+ "type": "object"
600
+ },
601
+ "setup_metadata": {
602
+ "type": "object"
603
+ }
604
+ },
605
+ "required": []
606
+ });
607
+
608
+ const GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA = freeze({
609
+ "type": "object",
610
+ "properties": {},
611
+ "required": []
612
+ });
613
+
614
+ const GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA = freeze({
615
+ "type": "object",
616
+ "properties": {
617
+ "url": {
618
+ "type": "string"
619
+ },
620
+ "setup_metadata": {
621
+ "type": "object"
622
+ },
623
+ "product_metadata": {
624
+ "type": "object"
625
+ },
626
+ "pricing_metadata": {
627
+ "type": "object"
628
+ }
629
+ },
630
+ "required": []
631
+ });
632
+
633
+ const GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA = freeze({
634
+ "type": "object",
635
+ "properties": {
636
+ "url": {
637
+ "type": "string"
638
+ },
639
+ "setup_metadata": {
640
+ "type": "object"
641
+ },
642
+ "pricing_metadata": {
643
+ "type": "object"
644
+ }
645
+ },
646
+ "required": []
647
+ });
648
+
649
+ const GOOGLE_MARKETPLACE_PARTNER_APPLICATION_GATE_INPUT_SCHEMA = freeze({
650
+ "type": "object",
651
+ "properties": {
652
+ "url": {
653
+ "type": "string"
654
+ },
655
+ "setup_metadata": {
656
+ "type": "object"
657
+ }
658
+ },
659
+ "required": []
660
+ });
661
+
662
+ const A1_AI_READ_DASHBOARD_INPUT_SCHEMA = freeze({
663
+ "type": "object",
664
+ "properties": {
665
+ "url": {
666
+ "type": "string"
667
+ },
668
+ "events": {
669
+ "type": "array",
670
+ "items": {
671
+ "type": "object"
672
+ }
673
+ },
674
+ "logs": {
675
+ "type": "array",
676
+ "items": {
677
+ "type": "object"
678
+ }
679
+ },
680
+ "period": {
681
+ "type": "object"
682
+ }
683
+ },
684
+ "required": []
685
+ });
686
+
687
+ const P2_PARITY_INSPECT_INPUT_SCHEMA = freeze({
688
+ "type": "object",
689
+ "properties": {
690
+ "url": {
691
+ "type": "string"
692
+ },
693
+ "agent_key": {
694
+ "type": "string"
695
+ }
696
+ },
697
+ "required": [
698
+ "url",
699
+ "agent_key"
700
+ ]
701
+ });
702
+
703
+ const TOOL_REGISTRY = Object.freeze([
704
+ tool("portable_trust_verification",
705
+ "Verify signed Trust Claims and fresh independent runtime receipts from a portable bundle without trusting the issuer runtime.",
706
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
707
+ { method: "POST", route: "/api/agent/trust_verify" }),
708
+ tool("continuous_trust_graph",
709
+ "Evaluate signed claims, runtime receipts, revocations, expiry, and conflicts while retaining negative evidence.",
710
+ {"type": "object", "properties": {"url": {"type": "string"}, "target_url": {"type": "string"}, "intent": {"type": "string"}, "evidence": {"type": "object"}, "public_metadata": {"type": "object"}, "setup_metadata": {"type": "object"}, "submission": {"type": "object"}, "platform_id": {"type": "string"}, "status": {"type": "string"}, "listing_url": {"type": "string"}, "platform_receipt_id": {"type": "string"}, "proof_url": {"type": "string"}, "jwt": {"type": "string"}, "token_context": {"type": "object"}, "claims": {"type": "array", "items": {"type": "object"}}, "signature_verified": {"type": "boolean"}, "expected_audience": {"type": "string"}, "expected_email": {"type": "string"}, "evidence_type": {"type": "string"}, "certs": {"type": "object"}, "execution": {"type": "object"}, "store": {"type": "boolean"}, "events": {"type": "array", "items": {"type": "object"}}, "logs": {"type": "array", "items": {"type": "object"}}, "user_agent": {"type": "string"}, "probes": {"type": "array", "items": {"type": "object"}}, "probe_set": {"type": "object"}, "prompt": {"type": "string"}, "answer": {"type": "string"}, "citations": {"type": "array", "items": {}}, "engine": {"type": "string"}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "competitors": {"type": "array", "items": {"type": "string"}}, "conversions": {"type": "array", "items": {"type": "object"}}, "event": {"type": "string"}, "referrer": {"type": "string"}, "survey_source": {"type": "string"}, "value": {"type": "number"}, "currency": {"type": "string"}, "fetch": {"type": "boolean"}, "report": {"type": "object"}, "reports": {"type": "array", "items": {"type": "object"}}, "result": {"type": "object"}, "results": {"type": "array", "items": {"type": "object"}}, "product_metadata": {"type": "object"}, "pricing_metadata": {"type": "object"}, "receipt": {"type": "object"}, "receipts": {"type": "array", "items": {"type": "object"}}, "before": {"type": "object"}, "after": {"type": "object"}, "audit": {"type": "object"}, "content": {"type": "string"}, "page": {"type": "object"}, "questions": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "period": {"type": "object"}, "verify_artifacts": {"type": "boolean"}, "published_items": {"type": "array", "items": {"type": "object"}}, "items": {"type": "array", "items": {"type": "object"}}, "verify_publication": {"type": "boolean"}, "content_pack": {"type": "object"}, "pack": {"type": "object"}, "content_workflow_package": {"type": "object"}, "package": {"type": "object"}, "sheet": {"type": "object"}, "rows": {"type": "array", "items": {"type": "object"}}, "completed_rows": {"type": "array", "items": {"type": "object"}}, "insights": {"type": "object"}, "provider": {"type": "string"}, "evaluator": {"type": "string"}, "budget": {"type": "number"}, "draft": {"type": "object"}, "create_payload": {"type": "object"}, "job_type": {"type": "string"}, "job_id": {"type": "string"}, "payment_reference": {"type": "string"}, "payment_proof": {"type": "object"}, "payment_signature": {"type": "string"}, "deliverable_uri": {"type": "string"}, "deliverable": {"type": "object"}, "decision": {"type": "string"}, "reason": {"type": "string"}, "plan": {"type": "string"}, "email": {"type": "string"}, "method": {"type": "string"}, "procurement_event": {"type": "object"}, "action": {"type": "object"}, "execute": {"type": "boolean"}, "access_token": {"type": "string"}, "token_source": {"anyOf": [{"type": "string"}, {"type": "object"}]}, "metadata_base": {"type": "string"}, "service_name": {"type": "string"}, "usage_reporting_id": {"type": "string"}, "metric_name": {"type": "string"}, "metric_value": {"anyOf": [{"type": "number"}, {"type": "string"}]}, "start_time": {"type": "string"}, "end_time": {"type": "string"}, "operation_id": {"type": "string"}, "user_labels": {"type": "object"}, "payload": {"type": "object"}, "provider_id": {"type": "string"}, "account_id": {"type": "string"}, "entitlement_id": {"type": "string"}, "twin3_agent_id": {"type": "string"}, "pricing_model": {"type": "string", "enum": ["free", "subscription", "usage", "combined", "subscription_plus_usage"]}}, "required": []},
711
+ { method: "POST", route: "/api/agent/continuous_trust_graph" }),
712
+ tool("tenant_zero_trust_gate",
713
+ "Gate Twin3 Tenant 0 using external black-box negative tests, a live customer change, and independent public refetch.",
714
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
715
+ { method: "POST", route: "/api/agent/tenant_zero_trust_gate" }),
716
+ tool("continuous_observation_gate",
717
+ "Gate the required observation window from real checkpoint samples.",
718
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
719
+ { method: "POST", route: "/api/agent/continuous_observation_gate" }),
720
+ tool("external_pilot_trust_gate",
721
+ "Require two external hosts and an independent portable verifier before pilot completion.",
722
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
723
+ { method: "POST", route: "/api/agent/external_pilot_trust_gate" }),
724
+ tool("google_marketplace_trust_gate",
725
+ "Require real external Google review receipts before claiming Marketplace submission readiness.",
726
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
727
+ { method: "POST", route: "/api/agent/google_marketplace_trust_gate" }),
728
+ tool("w1_workflow_router",
729
+ "Choose the next AEO workflow route: audit, content execution, measurement, or continuous Site Agent loop.",
730
+ {"type": "object", "properties": {"url": {"type": "string"}, "intent": {"type": "string"}, "evidence": {"type": "object"}}, "required": []},
731
+ { route: "/api/agent/workflow_router", method: "POST" }),
732
+ tool("s2_package_review",
733
+ "Review Agent marketplace capability, credential, permission, and claim boundaries.",
734
+ S2_PACKAGE_REVIEW_INPUT_SCHEMA,
735
+ { route: "/api/agent/package_review", method: "POST" }),
736
+ tool("s1_skill_package_validation",
737
+ "Validate an S1 Skill package for source-map, OpenAPI, MCP, examples, credentials, and claim-boundary consistency.",
738
+ {"type": "object", "properties": {"url": {"type": "string"}, "package": {"type": "object"}}, "required": []},
739
+ { route: "/api/agent/skill_package_validate", method: "GET", postWhen: args => Boolean(args.package), query: ["url"] }),
740
+ tool("marketplace_submission_pack",
741
+ "Bundle listing copy, attachments, S2 review, S1 validation, billing boundaries, and non-claims for Agent Store or registry submission.",
742
+ S2_PACKAGE_REVIEW_INPUT_SCHEMA,
743
+ { route: "/api/agent/marketplace_submission", method: "GET", postWhen: args => Boolean(args.public_metadata || args.setup_metadata || args.public || args.setup), query: ["url"] }),
744
+ tool("marketplace_readiness_score",
745
+ "Score Agent Store / registry readiness, list blockers, and preserve non-claims before human submission.",
746
+ {"type": "object", "properties": {"url": {"type": "string"}, "submission": {"type": "object"}, "public_metadata": {"type": "object"}, "setup_metadata": {"type": "object"}}, "required": []},
747
+ { route: "/api/agent/marketplace_readiness", method: "GET", postWhen: args => Boolean(args.submission || args.pack || args.public_metadata || args.setup_metadata || args.public || args.setup), query: ["url"] }),
748
+ tool("marketplace_approval_receipts",
749
+ "Normalize and summarize real marketplace approval receipts without claiming ranking, runtime behavior, or AI recommendation.",
750
+ {"type": "object", "properties": {"url": {"type": "string"}, "platform_id": {"type": "string"}, "status": {"type": "string"}, "listing_url": {"type": "string"}, "platform_receipt_id": {"type": "string"}, "proof_url": {"type": "string"}}, "required": []},
751
+ { route: "/api/agent/marketplace_approval_receipts", method: "GET", postWhen: args => Boolean(args.platform_id || args.platform || args.listing_url || args.platform_receipt_id || args.proof_url || args.evidence_url), query: ["url"] }),
752
+ tool("agent_trust_package",
753
+ "Bundle Agent Card, MCP, OpenAPI, Passport, Proof Graph, domain verification receipt, and protocol alignment for Agent reviewers.",
754
+ AGENT_TRUST_PACKAGE_INPUT_SCHEMA,
755
+ { method: "GET", query: ["url"], postWhen: args => Boolean(args.audit || args.marketplace_receipts || args.approval_receipts), route: "/api/agent/trust_package" }),
756
+ tool("google_marketplace_agent_card",
757
+ "Generate a Google Cloud Marketplace-oriented A2A Agent Card candidate for Partner Engineer review.",
758
+ GOOGLE_MARKETPLACE_AGENT_CARD_INPUT_SCHEMA,
759
+ { route: "/api/agent/google_marketplace_agent_card", method: "GET", postWhen: args => Boolean(args.product_metadata || args.product || args.public_metadata), query: ["url"] }),
760
+ tool("google_marketplace_submission_pack",
761
+ "Bundle Google Cloud Marketplace product metadata, Agent Card, pricing, technical integration, and claim boundaries.",
762
+ GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA,
763
+ { route: "/api/agent/google_marketplace_submission", method: "GET", postWhen: args => Boolean(args.product_metadata || args.setup_metadata || args.product || args.setup || args.public_metadata), query: ["url"] }),
764
+ tool("google_marketplace_readiness_score",
765
+ "Score Google Cloud Marketplace readiness without claiming Google submission, validation, or approval.",
766
+ {"type": "object", "properties": {"url": {"type": "string"}, "submission": {"type": "object"}, "product_metadata": {"type": "object"}, "setup_metadata": {"type": "object"}}, "required": []},
767
+ { route: "/api/agent/google_marketplace_readiness", method: "GET", postWhen: args => Boolean(args.submission || args.pack || args.product_metadata || args.setup_metadata || args.product || args.setup || args.public_metadata), query: ["url"] }),
768
+ tool("google_marketplace_pricing_pack",
769
+ "Return Google Cloud Marketplace AI Agent pricing review material, plans, features, and blockers.",
770
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
771
+ { route: "/api/agent/google_marketplace_pricing", method: "GET" }),
772
+ tool("google_marketplace_develop_flow_gate",
773
+ "Map Google's Marketplace develop flow to exact AgentX evidence files, blockers, and next submission phase.",
774
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
775
+ { route: "/api/agent/google_marketplace_develop_flow_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.product_metadata || args.pricing_metadata || args.setup || args.product || args.pricing), query: ["url"] }),
776
+ tool("google_marketplace_listing_requirements_gate",
777
+ "Track Google Cloud Marketplace base listing requirements evidence before Producer Portal submission.",
778
+ GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA,
779
+ { route: "/api/agent/google_marketplace_listing_requirements_gate", method: "GET", postWhen: args => Boolean(args.product_metadata || args.setup_metadata || args.product || args.setup || args.public_metadata), query: ["url"] }),
780
+ tool("google_marketplace_listing_pack",
781
+ "Return Google Cloud Marketplace product details, listing metadata, enhanced-discovery fields, and blockers.",
782
+ GOOGLE_MARKETPLACE_AGENT_CARD_INPUT_SCHEMA,
783
+ { route: "/api/agent/google_marketplace_listing", method: "GET", postWhen: args => Boolean(args.product_metadata || args.product || args.public_metadata) }),
784
+ tool("google_marketplace_discovery_metadata_gate",
785
+ "Validate explicit Google Marketplace AI discovery metadata before Product details review.",
786
+ GOOGLE_MARKETPLACE_AGENT_CARD_INPUT_SCHEMA,
787
+ { route: "/api/agent/google_marketplace_discovery_metadata", method: "GET", postWhen: args => Boolean(args.product_metadata || args.product || args.public_metadata) }),
788
+ tool("google_marketplace_product_details_review_gate",
789
+ "Track Google Marketplace Product details completeness and review approval evidence.",
790
+ GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA,
791
+ { route: "/api/agent/google_marketplace_product_details_review_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.product_metadata || args.product || args.public_metadata), query: ["url"] }),
792
+ tool("google_marketplace_technical_integration_pack",
793
+ "Return Google Cloud Marketplace technical integration material for Pub/Sub, Partner Procurement API, account linking, entitlement handling, and Service Control boundaries.",
794
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
795
+ { route: "/api/agent/google_marketplace_technical", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.pricing_metadata || args.pricing), query: ["url"] }),
796
+ tool("google_marketplace_backend_gate",
797
+ "Gate executable Google Marketplace backend evidence for JWT verification, Pub/Sub, account approval, entitlement lifecycle, and usage reporting.",
798
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
799
+ { route: "/api/agent/google_marketplace_backend_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.pricing_metadata || args.pricing), query: ["url"] }),
800
+ tool("google_marketplace_lifecycle_smoke",
801
+ "Run a local Google Marketplace procurement lifecycle smoke test for account approval, entitlement approval, plan change, and cancellation.",
802
+ {"type": "object", "properties": {"url": {"type": "string"}, "provider_id": {"type": "string"}, "account_id": {"type": "string"}, "entitlement_id": {"type": "string"}}, "required": []},
803
+ { route: "/api/agent/google_marketplace_lifecycle_smoke", method: "GET", query: ["url", "provider_id", "account_id", "entitlement_id"] }),
804
+ tool("google_marketplace_runtime_smoke",
805
+ "Run one local Google Marketplace runtime smoke across account linking, procurement lifecycle, and usage-reporting dry-run gates.",
806
+ {"type": "object", "properties": {"url": {"type": "string"}, "provider_id": {"type": "string"}, "account_id": {"type": "string"}, "entitlement_id": {"type": "string"}, "pricing_model": {"type": "string", "enum": ["free", "subscription", "usage", "combined", "subscription_plus_usage"]}}, "required": []},
807
+ { route: "/api/agent/google_marketplace_runtime_smoke", method: "GET", query: ["url", "provider_id", "account_id", "entitlement_id", "pricing_model"] }),
808
+ tool("google_marketplace_runtime_receipt",
809
+ "Generate a server-attested runtime receipt from a verified Google Marketplace JWT, Pub/Sub, Procurement API, or Service Control signal.",
810
+ {"type": "object", "properties": {"url": {"type": "string"}, "evidence_type": {"type": "string"}, "evidence": {"type": "object"}, "jwt": {"type": "string"}, "token_context": {"type": "object"}, "expected_audience": {"type": "string"}, "expected_email": {"type": "string"}, "certs": {"type": "object"}, "payload": {"type": "object"}, "execution": {"type": "object"}, "store": {"type": "boolean"}, "pricing_metadata": {"type": "object"}}, "required": []},
811
+ { route: "/api/agent/google_marketplace_runtime_receipt", method: "POST" }),
812
+ tool("google_marketplace_runtime_evidence_ledger",
813
+ "Store redacted Google Marketplace runtime receipts and materialize them for the strict runtime evidence gate.",
814
+ {"type": "object", "properties": {"url": {"type": "string"}, "receipt": {"type": "object"}, "receipts": {"type": "array", "items": {"type": "object"}}, "pricing_metadata": {"type": "object"}}, "required": []},
815
+ { route: "/api/agent/google_marketplace_runtime_evidence_ledger", method: "GET", postWhen: args => Boolean(args.receipt || args.receipts || args.pricing_metadata || args.pricing || args.evidence_kind || args.receipt_type || args.schema), query: ["url"] }),
816
+ tool("google_marketplace_runtime_evidence_gate",
817
+ "Gate real Google Marketplace runtime evidence separately from local synthetic smoke before technical review.",
818
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
819
+ { route: "/api/agent/google_marketplace_runtime_evidence_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.pricing_metadata || args.pricing), query: ["url"] }),
820
+ tool("google_marketplace_test_billing_gate",
821
+ "Track Google Marketplace test billing, product preview, pricing preview, purchase-flow, and usage-reporting evidence.",
822
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
823
+ { route: "/api/agent/google_marketplace_test_billing_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.pricing_metadata || args.pricing), query: ["url"] }),
824
+ tool("google_marketplace_agent_card_validation_gate",
825
+ "Track same-project Cloud Storage upload and Producer Portal Save and Validate evidence for the Google Marketplace Agent Card.",
826
+ GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA,
827
+ { route: "/api/agent/google_marketplace_agent_card_validation_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.product_metadata || args.product || args.public_metadata), query: ["url"] }),
828
+ tool("google_marketplace_agent_card_gcs_upload_pack",
829
+ "Prepare the same-project Cloud Storage Agent Card upload pack, gcloud commands, and Producer Portal Save and Validate steps.",
830
+ GOOGLE_MARKETPLACE_SUBMISSION_PACK_INPUT_SCHEMA,
831
+ { route: "/api/agent/google_marketplace_agent_card_gcs_pack", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.product_metadata || args.product || args.public_metadata), query: ["url"] }),
832
+ tool("google_marketplace_review_bundle",
833
+ "Export Google Marketplace review files for Producer Portal, Agent Card upload, pricing review, technical integration review, and Partner Engineer handoff.",
834
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
835
+ { route: "/api/agent/google_marketplace_review_bundle", method: "GET", postWhen: args => Boolean(args.product_metadata || args.setup_metadata || args.pricing_metadata || args.product || args.setup || args.pricing || args.public_metadata), query: ["url"] }),
836
+ tool("google_marketplace_review_index",
837
+ "Map Google Marketplace review areas to files, endpoints, commands, evidence keys, and claim boundaries.",
838
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
839
+ { route: "/api/agent/google_marketplace_review_index", method: "GET", postWhen: args => Boolean(args.product_metadata || args.setup_metadata || args.pricing_metadata || args.product || args.setup || args.pricing || args.public_metadata), query: ["url"] }),
840
+ tool("google_marketplace_core_technology_source_map",
841
+ "Map core product capabilities to the international engine, the managed-service layer, and Google Marketplace-specific implementation sources.",
842
+ AGENT_TRUST_PACKAGE_INPUT_SCHEMA,
843
+ { route: "/api/agent/google_marketplace_core_source_map", method: "GET", query: ["url"] }),
844
+ tool("google_marketplace_application_status",
845
+ "Track Google Marketplace external evidence, review readiness, publish readiness, and non-claims.",
846
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
847
+ { route: "/api/agent/google_marketplace_application_status", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.product_metadata || args.pricing_metadata || args.setup || args.product || args.pricing || args.public_metadata) }),
848
+ tool("google_marketplace_application_evidence",
849
+ "Persist Google Marketplace application evidence and recompute the external review gate.",
850
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
851
+ { route: "/api/agent/google_marketplace_application_evidence", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.product_metadata || args.pricing_metadata || args.setup || args.product || args.pricing || args.public_metadata) }),
852
+ tool("google_marketplace_partner_application_gate",
853
+ "Track Google Partner, vendor, and Producer Portal access evidence before product configuration.",
854
+ GOOGLE_MARKETPLACE_PARTNER_APPLICATION_GATE_INPUT_SCHEMA,
855
+ { route: "/api/agent/google_marketplace_partner_application_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.project_info_form || args.partner_network || args.vendor_account || args.producer_portal_access || args.producer_portal_product_id) }),
856
+ tool("google_marketplace_operations_gate",
857
+ "Track Producer Portal IAM, test billing account, and App Lifecycle Manager operations readiness.",
858
+ GOOGLE_MARKETPLACE_PARTNER_APPLICATION_GATE_INPUT_SCHEMA,
859
+ { route: "/api/agent/google_marketplace_operations_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup), query: ["url"] }),
860
+ tool("google_marketplace_ops_identity_gate",
861
+ "Track Producer Portal IAM, restricted Partner Procurement API access, service accounts, App Lifecycle Manager, and usage-reporting identity evidence.",
862
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
863
+ { route: "/api/agent/google_marketplace_ops_identity_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.pricing_metadata || args.setup || args.pricing || args.producer_portal_iam || args.partner_procurement_api), query: ["url"] }),
864
+ tool("google_marketplace_cloud_run_deployment_gate",
865
+ "Track Cloud Run runtime evidence, public Agent endpoints, service identity, and metadata token sources before Google technical review.",
866
+ GOOGLE_MARKETPLACE_TECHNICAL_INTEGRATION_PACK_INPUT_SCHEMA,
867
+ { route: "/api/agent/google_marketplace_cloud_run_deployment_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.pricing_metadata || args.setup || args.pricing || args.cloud_run || args.cloud_run_deployment), query: ["url"] }),
868
+ tool("google_marketplace_live_surface_gate",
869
+ "Fetch a public HTTPS Agent runtime and verify Agent Card, MCP, OpenAPI, review index, and Google Marketplace preflight surfaces are reachable before Partner Engineer review.",
870
+ AGENT_TRUST_PACKAGE_INPUT_SCHEMA,
871
+ { route: "/api/agent/google_marketplace_live_surface_gate", method: "GET", query: ["url"] }),
872
+ tool("google_marketplace_preflight_check",
873
+ "Run one strict Google Marketplace preflight before Producer Portal submit-for-review.",
874
+ GOOGLE_MARKETPLACE_DEVELOP_FLOW_GATE_INPUT_SCHEMA,
875
+ { route: "/api/agent/google_marketplace_preflight", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.product_metadata || args.pricing_metadata || args.setup || args.product || args.pricing || args.public_metadata), query: ["url"] }),
876
+ tool("google_marketplace_publish_gate",
877
+ "Track Google Marketplace publish evidence before claiming public Marketplace availability.",
878
+ GOOGLE_MARKETPLACE_PARTNER_APPLICATION_GATE_INPUT_SCHEMA,
879
+ { route: "/api/agent/google_marketplace_publish_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup), query: ["url"] }),
880
+ tool("google_marketplace_review_receipt_gate",
881
+ "Track external Google and Producer Portal review receipts before submission or publication claims.",
882
+ GOOGLE_MARKETPLACE_PARTNER_APPLICATION_GATE_INPUT_SCHEMA,
883
+ { route: "/api/agent/google_marketplace_review_receipt_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup), query: ["url"] }),
884
+ tool("google_marketplace_evidence_template",
885
+ "Generate a fillable Google Marketplace application evidence template for operators.",
886
+ AGENT_TRUST_PACKAGE_INPUT_SCHEMA,
887
+ { route: "/api/agent/google_marketplace_evidence_template", method: "GET" }),
888
+ tool("google_marketplace_evidence_example",
889
+ "Generate an example-only Google Marketplace evidence starter file for operators.",
890
+ AGENT_TRUST_PACKAGE_INPUT_SCHEMA,
891
+ { route: "/api/agent/google_marketplace_evidence_example", method: "GET" }),
892
+ tool("google_marketplace_procurement_event",
893
+ "Normalize Google Marketplace Pub/Sub procurement events and produce non-executing action plans.",
894
+ {"type": "object", "properties": {"procurement_event": {"type": "object"}}, "required": []},
895
+ { route: "/api/agent/google_marketplace_procurement_event", method: "POST" }),
896
+ tool("google_marketplace_procurement_state",
897
+ "Read local Google Marketplace procurement account, entitlement, and action-queue state.",
898
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
899
+ { route: "/api/agent/google_marketplace_procurement_state", method: "GET" }),
900
+ tool("google_marketplace_procurement_execute",
901
+ "Execute one explicit Google Partner Procurement API action with execute=true and a provided or Cloud Run metadata OAuth token source.",
902
+ {"type": "object", "properties": {"action": {"type": "object"}, "execute": {"type": "boolean"}}, "required": ["action"]},
903
+ { route: "/api/agent/google_marketplace_procurement_execute", method: "POST" }),
904
+ tool("google_marketplace_usage_report_payload",
905
+ "Build a Google Service Control usage report payload from entitlement usageReportingId, metric, interval, and labels.",
906
+ {"type": "object", "properties": {"service_name": {"type": "string"}, "usage_reporting_id": {"type": "string"}, "metric_name": {"type": "string"}, "metric_value": {"anyOf": [{"type": "number"}, {"type": "string"}]}, "start_time": {"type": "string"}, "end_time": {"type": "string"}, "operation_id": {"type": "string"}, "user_labels": {"type": "object"}}, "required": []},
907
+ { route: "/api/agent/google_marketplace_usage_report_payload", method: "GET", postWhen: args => Boolean(args.service_name || args.usage_reporting_id || args.metric_name || args.metric_value || args.start_time || args.end_time || args.operation_id || args.user_labels) }),
908
+ tool("google_marketplace_usage_report_execute",
909
+ "Execute Service Control services.check followed by services.report only with execute=true and an OAuth token source.",
910
+ {"type": "object", "properties": {"payload": {"type": "object"}, "execute": {"type": "boolean"}}, "required": ["payload"]},
911
+ { route: "/api/agent/google_marketplace_usage_report_execute", method: "POST" }),
912
+ tool("google_marketplace_frontend_integration",
913
+ "Return Google Marketplace sign-up/login URLs and JWT requirements.",
914
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
915
+ { route: "/api/agent/google_marketplace_frontend_integration", method: "GET" }),
916
+ tool("google_marketplace_account_link",
917
+ "Validate Google Marketplace account-linking inputs and return non-executing approval actions.",
918
+ {"type": "object", "properties": {"jwt": {"type": "string"}, "claims": {"type": "object"}, "signature_verified": {"type": "boolean"}, "expected_audience": {"type": "string"}}, "required": []},
919
+ { route: "/api/agent/google_marketplace_account_link", method: "POST" }),
920
+ tool("google_marketplace_jwt_verifier_gate",
921
+ "Track Google Marketplace x-gcp-marketplace-token verifier evidence before account linking.",
922
+ {"type": "object", "properties": {"url": {"type": "string"}, "setup_metadata": {"type": "object"}, "jwt": {"type": "string"}, "token_context": {"type": "object"}}, "required": []},
923
+ { route: "/api/agent/google_marketplace_jwt_verifier_gate", method: "GET", postWhen: args => Boolean(args.setup_metadata || args.setup || args.jwt || args.token || args.token_context || args["x-gcp-marketplace-token"]) }),
924
+ tool("agentx_passport_verify",
925
+ MCP_MESSAGES.en.agentx_passport_verify,
926
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
927
+ { method: "GET", query: ["url"], postWhen: args => Boolean(args.passport), route: "/api/agent/passport_verify" }),
928
+ tool("audit_url",
929
+ "Audit a URL through twin3 AEO Agent.",
930
+ {"type": "object", "properties": {"url": {"type": "string"}}, "required": ["url"]},
931
+ { route: "/api/agent/audit", method: "POST" }),
932
+ tool("readiness_snapshot",
933
+ "Freeze one audit's public evidence into a deterministic, hash-addressed snapshot.",
934
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
935
+ { method: "GET", query: ["url", "captured_at"], postWhen: args => Boolean(args.audit || args.rule_version || args.target), route: "/api/agent/readiness_snapshot" }),
936
+ tool("readiness_compare",
937
+ "Compare two readiness snapshots by dimension and check without claiming causality.",
938
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
939
+ { method: "POST", route: "/api/agent/readiness_compare" }),
940
+ tool("pilot_report",
941
+ "Create a baseline-to-recheck Pilot report separating technical, A1, A2, and B1 evidence.",
942
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
943
+ { method: "GET", postWhen: args => Boolean(!args.pilot_id), query: ["pilot_id"], route: "/api/agent/pilot_report" }),
944
+ tool("get_pricing",
945
+ "Read machine-readable AEO Agent plans.",
946
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
947
+ { route: "/api/agent/pricing", method: "GET" }),
948
+ tool("agent_billing_guide",
949
+ "Read free routes, paid routes, checkout intents, and x402-style job payment boundaries.",
950
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
951
+ { route: "/api/agent/billing_guide", method: "GET" }),
952
+ tool("agent_checkout",
953
+ "Create a checkout session for paid AEO Agent work.",
954
+ {"type": "object", "properties": {"plan": {"type": "string"}}, "required": ["plan"]},
955
+ { route: "/api/agent/checkout", method: "POST" }),
956
+ tool("self_audit",
957
+ "Audit this AEO Agent service's own Agent-first surfaces.",
958
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
959
+ { route: "/api/agent/self_audit", method: "GET" }),
960
+ tool("get_health",
961
+ "Read this service's Agent-first health state.",
962
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
963
+ { route: "/agent/health.json", method: "GET" }),
964
+ tool("self_backlog",
965
+ "Generate this service's self-optimization backlog.",
966
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
967
+ { route: "/api/agent/self_backlog", method: "GET" }),
968
+ tool("agentx_passport",
969
+ "Read this service's AgentX.ID Passport.",
970
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
971
+ { route: "/api/agent/passport", method: "GET" }),
972
+ tool("proof_graph",
973
+ "Read the real evidence graph behind an AgentX.ID Passport.",
974
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
975
+ { route: "/api/agent/proof_graph", method: "GET" }),
976
+ tool("a1_ai_reads",
977
+ "Ingest and summarize real AI crawler read events from HTTP/CDN logs.",
978
+ {"type": "object", "properties": {"url": {"type": "string"}, "events": {"type": "array", "items": {"type": "object"}}, "logs": {"type": "array", "items": {"type": "object"}}, "user_agent": {"type": "string"}, "status": {"type": "string"}}, "required": []},
979
+ { route: "/api/agent/a1_reads", method: "GET", postWhen: args => Boolean(Array.isArray(args.events) || Array.isArray(args.logs) || args.user_agent), query: ["url"] }),
980
+ tool("a1_ai_read_dashboard",
981
+ "Summarize A1 AI crawler reads into dashboard KPI cards, provider rows, top paths, and failed reads.",
982
+ A1_AI_READ_DASHBOARD_INPUT_SCHEMA,
983
+ { route: "/api/agent/a1_dashboard", method: "GET", postWhen: args => Boolean(Array.isArray(args.events) || Array.isArray(args.logs) || args.user_agent), query: ["url"] }),
984
+ tool("a1_ai_read_evidence_package",
985
+ "Package A1 AI crawler reads into reviewable evidence files with samples, failed reads, labels, and non-claims.",
986
+ A1_AI_READ_DASHBOARD_INPUT_SCHEMA,
987
+ { route: "/api/agent/a1_read_package", method: "GET", postWhen: args => Boolean(Array.isArray(args.events) || Array.isArray(args.logs) || args.user_agent), query: ["url"] }),
988
+ tool("a2_ai_citations",
989
+ "Ingest and summarize AI answer citations, mentions, competitors, and share-of-voice.",
990
+ {"type": "object", "properties": {"url": {"type": "string"}, "target_url": {"type": "string"}, "probes": {"type": "array", "items": {"type": "object"}}, "prompt": {"type": "string"}, "answer": {"type": "string"}, "citations": {"type": "array", "items": {}}, "engine": {"type": "string"}, "competitors": {"type": "array", "items": {"type": "string"}}}, "required": []},
991
+ { route: "/api/agent/a2_citations", method: "GET", postWhen: args => Boolean(Array.isArray(args.probes) || args.prompt || args.answer || Array.isArray(args.citations)), query: ["url"] }),
992
+ tool("a2_ai_citation_evidence_package",
993
+ "Package imported AI answer probes into reviewable citation, mention, coverage, and non-claim evidence files.",
994
+ {"type": "object", "properties": {"url": {"type": "string"}, "probes": {"type": "array", "items": {"type": "object"}}, "events": {"type": "array", "items": {"type": "object"}}, "probe_set": {"type": "object"}, "period": {"type": "object"}, "verify_artifacts": {"type": "boolean"}}, "required": []},
995
+ { route: "/api/agent/a2_citation_package", method: "GET", postWhen: args => Boolean(Array.isArray(args.probes) || Array.isArray(args.events) || args.prompt || args.answer), query: ["url"] }),
996
+ tool("a2_probe_sets",
997
+ "Create stable buyer-question probe sets for comparable monthly AI answer visibility measurement.",
998
+ {"type": "object", "properties": {"url": {"type": "string"}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url"]},
999
+ { route: "/api/agent/a2_probe_sets", method: "POST" }),
1000
+ tool("b1_conversions",
1001
+ "Ingest and summarize AI-attributed lead, RFQ, order, and CRM conversion events.",
1002
+ {"type": "object", "properties": {"url": {"type": "string"}, "events": {"type": "array", "items": {"type": "object"}}, "conversions": {"type": "array", "items": {"type": "object"}}, "event": {"type": "string"}, "referrer": {"type": "string"}, "survey_source": {"type": "string"}, "value": {"type": "number"}, "currency": {"type": "string"}}, "required": []},
1003
+ { route: "/api/agent/b1_conversions", method: "GET", postWhen: args => Boolean(Array.isArray(args.events) || Array.isArray(args.conversions) || args.event || args.referrer || args.survey_source || args.value), query: ["url"] }),
1004
+ tool("b1_conversion_evidence_package",
1005
+ "Package B1 conversion attribution into reviewable evidence files with CRM reconciliation and non-claim labels.",
1006
+ {"type": "object", "properties": {"url": {"type": "string"}, "events": {"type": "array", "items": {"type": "object"}}, "conversions": {"type": "array", "items": {"type": "object"}}, "period": {"type": "object"}}, "required": []},
1007
+ { route: "/api/agent/b1_conversion_package", method: "GET", postWhen: args => Boolean(Array.isArray(args.events) || Array.isArray(args.conversions)), query: ["url"] }),
1008
+ tool("f1_implementation_bundle",
1009
+ "Generate reviewable llms.txt, Agent Card, Schema.org, and WebMCP snippets for a website agent.",
1010
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1011
+ { route: "/api/agent/implementation_bundle", method: "GET", query: ["url"], flags: ["audit"] }),
1012
+ tool("a0_audit_file_package",
1013
+ "Package E1, R1, F1, V1, G3, C1, C2, and C3 handoff instructions into one reviewable audit file package.",
1014
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1015
+ { route: "/api/agent/audit_file_package", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.topics || args.engines), query: ["url"], flags: ["audit"] }),
1016
+ tool("s1_skill_package",
1017
+ "Generate an installable Skill package with SKILL.md, OpenAPI, MCP, and Agent-readable usage instructions.",
1018
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1019
+ { route: "/api/agent/skill_package", method: "GET", postWhen: args => Boolean(args.mode), query: ["url"] }),
1020
+ tool("v1_installation_verification",
1021
+ "Verify deployed F1 files and snippets using audit and E1 evidence.",
1022
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1023
+ { route: "/api/agent/installation_verification", method: "GET", postWhen: args => Boolean(args.audit), query: ["url"] }),
1024
+ tool("c1_content_optimization_plan",
1025
+ "Generate answer-first rewrites, schema guidance, citation-gap matrix, and a 30-day content citability plan.",
1026
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1027
+ { route: "/api/agent/content_optimization_plan", method: "GET", postWhen: args => Boolean((args.content || args.page || args.questions || args.competitors || args.audit)), query: ["url"] }),
1028
+ tool("c4_content_workflow_package",
1029
+ "Package C1/C2/C3 content work into Agent-readable deliverable files with evidence labels.",
1030
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1031
+ { route: "/api/agent/content_workflow_package", method: "GET", postWhen: args => Boolean((args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.audit)), query: ["url"] }),
1032
+ tool("content_optimization_pack",
1033
+ "Bundle C1, C2, C4, and M8 content optimization outputs into one Agent-ready execution pack.",
1034
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1035
+ { route: "/api/agent/content_pack", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.audit || args.published_items || args.items || args.evidence), query: ["url"] }),
1036
+ tool("c5_content_workflow_review",
1037
+ "Review a Content Pack or C4 package for complete six-step delivery and evidence-safe claims.",
1038
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1039
+ { route: "/api/agent/content_workflow_review", method: "GET", postWhen: args => Boolean(args.content_pack || args.pack || args.content_workflow_package || args.package), query: ["url"] }),
1040
+ tool("m8_content_publication_evidence_package",
1041
+ "Track C4 content publication with proof URLs, optional strict HTTP proof fetch, accepted items, rejected items, and pending outputs.",
1042
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1043
+ { route: "/api/agent/content_publication_package", method: "GET", postWhen: args => Boolean((args.published_items || args.items || args.evidence || args.content_workflow_package)), query: ["url"] }),
1044
+ tool("c1_citation_gap_matrix",
1045
+ "Extract a C1 target-vs-competitor citation-gap matrix without fabricated scores.",
1046
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1047
+ { route: "/api/agent/citation_gap_matrix", method: "GET", postWhen: args => Boolean((args.content || args.page || args.questions || args.competitors || args.audit || args.content_plan)), query: ["url"] }),
1048
+ tool("c1_community_citation_plan",
1049
+ "Extract a C1 white-hat community citation plan with proof fields and guardrails.",
1050
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1051
+ { route: "/api/agent/community_citation_plan", method: "GET", postWhen: args => Boolean((args.content || args.page || args.questions || args.competitors || args.audit || args.content_plan)), query: ["url"] }),
1052
+ tool("c2_prompt_test_run_sheet",
1053
+ "Create a fixed manual AI prompt-test run sheet that can be imported into A2 citation measurement.",
1054
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1055
+ { route: "/api/agent/prompt_test_run_sheet", method: "GET", postWhen: args => Boolean((args.content_plan || args.questions || args.topics || args.engines || args.competitors)), query: ["url"] }),
1056
+ tool("c3_prompt_test_results_import",
1057
+ "Import completed C2 prompt-test rows into A2 citation evidence.",
1058
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1059
+ { route: "/api/agent/prompt_test_results", method: "POST" }),
1060
+ tool("e1_evidence_pack",
1061
+ "Return deterministic sampled-page evidence details for every audit check.",
1062
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1063
+ { route: "/api/agent/evidence_pack", method: "GET", postWhen: args => Boolean(args.audit), query: ["url"] }),
1064
+ tool("r1_audit_report",
1065
+ "Generate a customer-readable SEO/AEO/GEO/AGO audit report and priority action plan.",
1066
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1067
+ { route: "/api/agent/audit_report", method: "GET", postWhen: args => Boolean(args.audit), query: ["url"] }),
1068
+ tool("industry_taxonomy",
1069
+ "Read the canonical 12-industry taxonomy and buyer/conversion goals.",
1070
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
1071
+ { method: "GET", route: "/api/agent/industry_taxonomy" }),
1072
+ tool("p2_parity_inspect",
1073
+ "Run a domain-bound canonical audit with explainable industry classification, evidence-only AI View, and integrity-checked benchmark output.",
1074
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1075
+ { method: "POST", auth: "site-key", route: "/api/agent/p2_parity_inspect", requirements: ["verified_domain", "site_agent_key"] }),
1076
+ tool("pilot_program",
1077
+ "Enroll a verified website and record evidence-bound Pilot cycles.",
1078
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1079
+ { method: "GET", auth: "site-key", query: ["url"], postWhen: args => Boolean(args.action || args.snapshot || args.baseline_snapshot || args.report), route: "/api/agent/pilot/program", requirements: ["verified_domain", "site_agent_key"] }),
1080
+ tool("managed_service_customer_dashboard",
1081
+ "Return the managed-service view over canonical xAgent ID scores and evidence.",
1082
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1083
+ { method: "POST", auth: "site-key", route: "/api/agent/managed_service/customer_dashboard", requirements: ["verified_domain", "site_agent_key"] }),
1084
+ tool("checkout_session",
1085
+ MCP_MESSAGES.en.checkout_session,
1086
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1087
+ { method: "POST", auth: "site-key", route: "/api/agent/checkout/session", requirements: ["verified_domain", "site_agent_key", "configured_provider"] }),
1088
+ tool("checkout_status",
1089
+ "Read provider-confirmed entitlements for the authenticated website.",
1090
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1091
+ { method: "GET", auth: "site-key", query: ["url"], route: "/api/agent/checkout/status", requirements: ["verified_domain", "site_agent_key"] }),
1092
+ tool("billing_portal",
1093
+ "Open a short-lived provider-hosted subscription management session for the authenticated website.",
1094
+ P2_PARITY_INSPECT_INPUT_SCHEMA,
1095
+ { method: "POST", auth: "site-key", route: "/api/agent/billing/portal", requirements: ["verified_domain", "site_agent_key", "configured_provider"] }),
1096
+ tool("g1_google_official",
1097
+ "Ingest and summarize Google PageSpeed / Lighthouse reports for SEO and Agentic Browsing evidence.",
1098
+ {"type": "object", "properties": {"url": {"type": "string"}, "fetch": {"type": "boolean"}, "report": {"type": "object"}, "reports": {"type": "array", "items": {"type": "object"}}, "result": {"type": "object"}, "results": {"type": "array", "items": {"type": "object"}}}, "required": []},
1099
+ { route: "/api/agent/g1_google_official", method: "GET", postWhen: args => Boolean(Array.isArray(args.reports) || Array.isArray(args.results) || args.report || args.result || args.lighthouseResult), query: ["url"], flags: ["fetch"] }),
1100
+ tool("g2_google_delta",
1101
+ "Compare before-after Google PageSpeed / Lighthouse snapshots for SEO and Agentic Browsing movement.",
1102
+ {"type": "object", "properties": {"url": {"type": "string"}, "before": {"type": "object"}, "after": {"type": "object"}, "report": {"type": "object"}, "reports": {"type": "array", "items": {"type": "object"}}, "result": {"type": "object"}, "results": {"type": "array", "items": {"type": "object"}}}, "required": []},
1103
+ { route: "/api/agent/g2_google_delta", method: "GET", postWhen: args => Boolean(Array.isArray(args.reports) || Array.isArray(args.results) || args.before || args.after || args.report || args.result), query: ["url"] }),
1104
+ tool("g3_google_verification_plan",
1105
+ "Create a strict PageSpeed / Lighthouse rerun plan for before-after validation.",
1106
+ {"type": "object", "properties": {"url": {"type": "string"}, "audit": {"type": "object"}}, "required": []},
1107
+ { route: "/api/agent/g3_google_verification_plan", method: "GET", query: ["url"], flags: ["audit"] }),
1108
+ tool("m1_outcome_report",
1109
+ "Combine G2, A1, A2, B1, and job evidence into a measurable AEO outcome report.",
1110
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1111
+ { method: "GET", query: ["url"], route: "/api/agent/outcome_report" }),
1112
+ tool("m1_outcome_evidence_package",
1113
+ "Package M1 outcome evidence into reviewable files with claim limits and next actions.",
1114
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1115
+ { route: "/api/agent/outcome_package", method: "GET", query: ["url"] }),
1116
+ tool("m2_monthly_optimization_package",
1117
+ "Package O1, M1, I1 insights, O1 job drafts, and verification steps into one monthly execution handoff.",
1118
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1119
+ { route: "/api/agent/monthly_package", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.content_publication_package || args.a2_citation_package), query: ["url"], flags: ["audit"] }),
1120
+ tool("m3_monthly_execution_tracker",
1121
+ "Turn M2, job statuses, content review, and verification steps into an owned monthly execution workboard.",
1122
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1123
+ { route: "/api/agent/monthly_tracker", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.content_publication_package || args.a2_citation_package), query: ["url"], flags: ["audit"] }),
1124
+ tool("m4_monthly_outcome_scorecard",
1125
+ "Separate reportable monthly AEO evidence from non-reportable causality, ranking, and revenue claims.",
1126
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1127
+ { route: "/api/agent/monthly_scorecard", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.content_publication_package || args.a2_citation_package), query: ["url"], flags: ["audit"] }),
1128
+ tool("m5_monthly_dashboard",
1129
+ "Summarize monthly AEO/SEO evidence as KPI cards with proof levels, claim limits, and next actions.",
1130
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1131
+ { route: "/api/agent/monthly_dashboard", method: "GET", postWhen: args => Boolean(args.content || args.page || args.questions || args.competitors || args.engines || args.topics || args.content_publication_package || args.a2_citation_package), query: ["url"], flags: ["audit"] }),
1132
+ tool("o1_optimization_cycle",
1133
+ "Package SDK evidence, G3, I1, audit-check job drafts, and M1 into one continuous optimization cycle.",
1134
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1135
+ { route: "/api/agent/optimization_cycle", method: "GET", query: ["url"], flags: ["audit"] }),
1136
+ tool("i1_insights",
1137
+ "Generate evidence-backed AEO optimization insights from G1/A1/A2/B1 and audit evidence.",
1138
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1139
+ { route: "/api/agent/insights", method: "GET", postWhen: args => Boolean(args.audit), query: ["url"] }),
1140
+ tool("i1_job_drafts",
1141
+ "Turn standalone I1 optimization insights into scoped AEO job drafts.",
1142
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1143
+ { route: "/api/agent/insights/job_drafts", method: "POST" }),
1144
+ tool("site_agent_install_descriptor",
1145
+ "Return the verified website agent's private install descriptor, including browser SDK install payload.",
1146
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "install_descriptor"}}, "required": ["url", "agent_key", "action"]},
1147
+ { route: "/api/site_agents/call", method: "POST", action: "install_descriptor", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1148
+ tool("site_agent_implementation_bundle",
1149
+ "Return private F1 implementation files and snippets for the verified website agent.",
1150
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "implementation_bundle"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1151
+ { route: "/api/site_agents/call", method: "POST", action: "implementation_bundle", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1152
+ tool("site_agent_audit_file_package",
1153
+ "Return a private A0 audit file package with evidence, report, implementation files, content work, and verification steps.",
1154
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "audit_file_package"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1155
+ { route: "/api/site_agents/call", method: "POST", action: "audit_file_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1156
+ tool("site_agent_skill_package",
1157
+ "Return a private S1 installable Skill package for the verified website agent.",
1158
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "skill_package"}, "mode": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1159
+ { route: "/api/site_agents/call", method: "POST", action: "skill_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1160
+ tool("site_agent_installation_verification",
1161
+ "Verify private V1 installation status for the verified website agent.",
1162
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "installation_verification"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1163
+ { route: "/api/site_agents/call", method: "POST", action: "installation_verification", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1164
+ tool("site_agent_content_optimization_plan",
1165
+ "Generate private C1 answer-first rewrites, schema guidance, citation gaps, and a 30-day plan.",
1166
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "content_optimization_plan"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1167
+ { route: "/api/site_agents/call", method: "POST", action: "content_optimization_plan", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1168
+ tool("site_agent_content_workflow_package",
1169
+ "Return a private C4 agent-ready content workflow package with deliverable files and evidence labels.",
1170
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "content_workflow_package"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1171
+ { route: "/api/site_agents/call", method: "POST", action: "content_workflow_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1172
+ tool("site_agent_content_repair_pack",
1173
+ "Return a private C6 content repair package from C5 review items.",
1174
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "content_repair_pack"}, "review_gate": {"type": "object"}, "c5_repair_history": {"type": "object"}, "history": {"type": "object"}, "content_pack": {"type": "object"}, "pack": {"type": "object"}, "content_workflow_package": {"type": "object"}, "package": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1175
+ { route: "/api/site_agents/call", method: "POST", action: "content_repair_pack", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1176
+ tool("site_agent_content_pack",
1177
+ "Return one private Agent-ready Content Pack that bundles C1, C2, C4, and M8 evidence boundaries.",
1178
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "content_pack"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "content_plan": {"type": "object"}, "plan": {"type": "string"}, "content_workflow_package": {"type": "object"}, "published_items": {"type": "array", "items": {"type": "object"}}, "items": {"type": "array", "items": {"type": "object"}}, "evidence": {"type": "object"}, "verify_publication": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1179
+ { route: "/api/site_agents/call", method: "POST", action: "content_pack", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1180
+ tool("site_agent_content_publication_package",
1181
+ "Return a private M8 content publication evidence package for C4 outputs, proof URLs, and optional strict HTTP proof verification.",
1182
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "content_publication_package"}, "content_workflow_package": {"type": "object"}, "package": {"type": "object"}, "published_items": {"type": "array", "items": {"type": "object"}}, "items": {"type": "array", "items": {"type": "object"}}, "evidence": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1183
+ { route: "/api/site_agents/call", method: "POST", action: "content_publication_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1184
+ tool("site_agent_a1_read_evidence_package",
1185
+ "Return a private A1 AI crawler read evidence package from verified HTTP/CDN logs.",
1186
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "a1_read_evidence_package"}, "events": {"type": "array", "items": {"type": "object"}}, "logs": {"type": "array", "items": {"type": "object"}}, "source": {"type": "string"}, "period": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1187
+ { route: "/api/site_agents/call", method: "POST", action: "a1_read_evidence_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1188
+ tool("site_agent_a1_dashboard",
1189
+ "Return a private A1 AI crawler read dashboard with provider, path, status, and failure KPIs.",
1190
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "a1_dashboard"}, "events": {"type": "array", "items": {"type": "object"}}, "logs": {"type": "array", "items": {"type": "object"}}, "source": {"type": "string"}, "period": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1191
+ { route: "/api/site_agents/call", method: "POST", action: "a1_dashboard", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1192
+ tool("site_agent_site_signal_package",
1193
+ "Return a private S1 site signal evidence package from observed SDK or connector page-structure signals.",
1194
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "site_signal_package"}, "events": {"type": "array", "items": {"type": "object"}}, "sdk_events": {"type": "array", "items": {"type": "object"}}, "period": {"type": "object"}, "source": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1195
+ { route: "/api/site_agents/call", method: "POST", action: "site_signal_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1196
+ tool("site_agent_a2_citation_evidence_package",
1197
+ "Return a private A2 AI answer citation evidence package from imported prompt-test results.",
1198
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "a2_citation_evidence_package"}, "probes": {"type": "array", "items": {"type": "object"}}, "events": {"type": "array", "items": {"type": "object"}}, "probe_set": {"type": "object"}, "period": {"type": "object"}, "source": {"type": "string"}, "verify_artifacts": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1199
+ { route: "/api/site_agents/call", method: "POST", action: "a2_citation_evidence_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1200
+ tool("site_agent_b1_conversion_evidence_package",
1201
+ "Return a private B1 conversion evidence package from verified lead, RFQ, order, and CRM events.",
1202
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "b1_conversion_evidence_package"}, "events": {"type": "array", "items": {"type": "object"}}, "conversions": {"type": "array", "items": {"type": "object"}}, "period": {"type": "object"}, "source": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1203
+ { route: "/api/site_agents/call", method: "POST", action: "b1_conversion_evidence_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1204
+ tool("site_agent_m1_outcome_evidence_package",
1205
+ "Return a private M1 outcome evidence package for the verified website agent.",
1206
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "m1_outcome_evidence_package"}, "period": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1207
+ { route: "/api/site_agents/call", method: "POST", action: "m1_outcome_evidence_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1208
+ tool("site_agent_m2_monthly_optimization_package",
1209
+ "Return a private M2 monthly optimization package for the verified website agent.",
1210
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "m2_monthly_optimization_package"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1211
+ { route: "/api/site_agents/call", method: "POST", action: "m2_monthly_optimization_package", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1212
+ tool("site_agent_m3_monthly_execution_tracker",
1213
+ "Return a private M3 monthly execution tracker that turns the monthly package into owned tasks, blockers, and evidence follow-ups.",
1214
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "m3_monthly_execution_tracker"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1215
+ { route: "/api/site_agents/call", method: "POST", action: "m3_monthly_execution_tracker", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1216
+ tool("site_agent_m4_monthly_outcome_scorecard",
1217
+ "Return a private M4 monthly outcome scorecard that separates reportable evidence from non-reportable causality claims.",
1218
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "m4_monthly_outcome_scorecard"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1219
+ { route: "/api/site_agents/call", method: "POST", action: "m4_monthly_outcome_scorecard", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1220
+ tool("site_agent_m5_monthly_dashboard",
1221
+ "Return a private M5 monthly dashboard with KPI cards, proof levels, claim limits, and next actions.",
1222
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "m5_monthly_dashboard"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1223
+ { route: "/api/site_agents/call", method: "POST", action: "m5_monthly_dashboard", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1224
+ tool("site_agent_monthly_evidence_loop",
1225
+ "Run the full private monthly evidence loop: Content Pack, M2 package, M3 tracker, M4 scorecard, and M5 dashboard.",
1226
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "monthly_evidence_loop"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "content_pack": {"type": "object"}, "pack": {"type": "object"}, "content_publication_package": {"type": "object"}, "a2_citation_package": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1227
+ { route: "/api/site_agents/call", method: "POST", action: "monthly_evidence_loop", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1228
+ tool("site_agent_insights_feed",
1229
+ "Return a private compact insights feed that installed website agents can poll for current tasks and evidence follow-ups.",
1230
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "insights_feed"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "content_publication_package": {"type": "object"}, "a2_citation_package": {"type": "object"}}, "required": ["url", "agent_key", "action"]},
1231
+ { route: "/api/site_agents/call", method: "POST", action: "insights_feed", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1232
+ tool("site_agent_refresh_insight_inbox",
1233
+ "Persist the current private insights feed into the verified website agent's durable inbox without duplicating existing items.",
1234
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "refresh_insight_inbox"}, "feed": {"type": "object"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "content_publication_package": {"type": "object"}, "a2_citation_package": {"type": "object"}, "events": {"type": "array", "items": {"type": "object"}}, "sdk_events": {"type": "array", "items": {"type": "object"}}}, "required": ["url", "agent_key", "action"]},
1235
+ { method: "POST", action: "refresh_insight_inbox", route: "/api/site_agents/call", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1236
+ tool("site_agent_insight_inbox",
1237
+ "List pending durable insight inbox items for the verified website agent.",
1238
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "insight_inbox"}, "include_acknowledged": {"type": "boolean"}, "include_all": {"type": "boolean"}, "status": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1239
+ { method: "POST", action: "insight_inbox", route: "/api/site_agents/call", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1240
+ tool("site_agent_acknowledge_insight",
1241
+ "Acknowledge or dismiss one durable insight inbox item for the verified website agent.",
1242
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "acknowledge_insight"}, "item_id": {"type": "string"}, "status": {"type": "string"}, "decision": {"type": "string"}}, "required": ["url", "agent_key", "action", "item_id"]},
1243
+ { method: "POST", action: "acknowledge_insight", route: "/api/site_agents/call", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1244
+ tool("site_agent_apply_plan",
1245
+ "Return a private apply plan that turns the insights feed into CMS, worker, or repo PR execution routes.",
1246
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "apply_plan"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "period": {"type": "object"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "market": {"type": "string"}, "cadence": {"type": "string"}, "content_publication_package": {"type": "object"}, "a2_citation_package": {"type": "object"}, "feed": {"type": "object"}, "delivery_targets": {"type": "array", "items": {"type": "object"}}}, "required": ["url", "agent_key", "action"]},
1247
+ { route: "/api/site_agents/call", method: "POST", action: "apply_plan", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1248
+ tool("site_agent_apply_evidence",
1249
+ "Submit proof that an apply-plan item was executed, creating or updating the shared AEO job ledger.",
1250
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "apply_evidence"}, "apply_item_id": {"type": "string"}, "apply_item": {"type": "object"}, "apply_plan": {"type": "object"}, "job_id": {"type": "string"}, "evidence_uri": {"type": "string"}, "proof_url": {"type": "string"}, "pull_request_url": {"type": "string"}, "deployment_reference": {"type": "string"}, "evidence": {"type": "object"}, "source_feed_hash": {"type": "string"}, "verify_proof": {"type": "boolean"}, "verify": {"type": "boolean"}}, "required": ["url", "agent_key", "action", "apply_item_id"]},
1251
+ { route: "/api/site_agents/call", method: "POST", action: "apply_evidence", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1252
+ tool("site_agent_citation_gap_matrix",
1253
+ "Return a private C1 citation-gap matrix without fabricating competitor scores.",
1254
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "citation_gap_matrix"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1255
+ { route: "/api/site_agents/call", method: "POST", action: "citation_gap_matrix", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1256
+ tool("site_agent_community_citation_plan",
1257
+ "Return a private C1 white-hat community citation plan with proof fields and guardrails.",
1258
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "community_citation_plan"}, "page": {"type": "object"}, "content": {"type": "string"}, "text": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "competitors": {"type": "array", "items": {"type": "string"}}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1259
+ { route: "/api/site_agents/call", method: "POST", action: "community_citation_plan", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1260
+ tool("site_agent_prompt_test_run_sheet",
1261
+ "Create a private C2 prompt-test run sheet for the verified website agent.",
1262
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "prompt_test_run_sheet"}, "content_plan": {"type": "object"}, "plan": {"type": "string"}, "questions": {"type": "array", "items": {"type": "string"}}, "prompts": {"type": "array", "items": {"type": "string"}}, "topics": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "engines": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}]}, "competitors": {"type": "array", "items": {"type": "string"}}, "market": {"type": "string"}, "cadence": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1263
+ { route: "/api/site_agents/call", method: "POST", action: "prompt_test_run_sheet", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1264
+ tool("site_agent_prompt_test_results_import",
1265
+ "Import private C3 completed prompt-test rows for the verified website agent.",
1266
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "prompt_test_results"}, "sheet": {"type": "object"}, "run_sheet": {"type": "object"}, "rows": {"type": "array", "items": {"type": "object"}}, "results": {"type": "array", "items": {"type": "object"}}, "completed_rows": {"type": "array", "items": {"type": "object"}}}, "required": ["url", "agent_key", "action"]},
1267
+ { route: "/api/site_agents/call", method: "POST", action: "prompt_test_results", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1268
+ tool("site_agent_insights",
1269
+ "Generate private I1 optimization insights for the verified website agent.",
1270
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "insights"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1271
+ { route: "/api/site_agents/call", method: "POST", action: "insights", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1272
+ tool("site_agent_outcome_report",
1273
+ "Return the verified website agent's private M1 outcome report.",
1274
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "outcome_report"}}, "required": ["url", "agent_key", "action"]},
1275
+ { route: "/api/site_agents/call", method: "POST", action: "outcome_report", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1276
+ tool("site_agent_optimization_cycle",
1277
+ "Return the verified website agent's private O1 continuous optimization cycle with audit checks merged into the O1 job queue.",
1278
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "optimization_cycle"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}}, "required": ["url", "agent_key", "action"]},
1279
+ { route: "/api/site_agents/call", method: "POST", action: "optimization_cycle", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1280
+ tool("site_agent_job_drafts",
1281
+ "Create scoped AEO job drafts from I1 insights, audit checks, or C5 repair items for the verified website agent only.",
1282
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "job_drafts"}, "audit": {"type": "object"}, "audit_url": {"type": "boolean"}, "insights": {"type": "object"}, "review_gate": {"type": "object"}, "provider": {"type": "string"}, "evaluator": {"type": "string"}, "currency": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1283
+ { route: "/api/site_agents/call", method: "POST", action: "job_drafts", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1284
+ tool("site_agent_accept_job_draft",
1285
+ "Accept one of the verified website agent's own drafts into the AEO job ledger.",
1286
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "accept_job_draft"}, "draft": {"type": "object"}, "provider": {"type": "string"}, "evaluator": {"type": "string"}, "currency": {"type": "string"}, "budget": {"type": "number"}}, "required": ["url", "agent_key", "action", "draft"]},
1287
+ { route: "/api/site_agents/call", method: "POST", action: "accept_job_draft", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1288
+ tool("site_agent_decide_job_draft",
1289
+ "Record accept, defer, or reject decisions for the verified website agent's own drafts.",
1290
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "decide_job_draft"}, "decision": {"type": "string", "enum": ["accept", "defer", "reject"]}, "draft": {"type": "object"}, "draft_id": {"type": "string"}, "create_payload": {"type": "object"}, "reason": {"type": "string"}, "provider": {"type": "string"}, "evaluator": {"type": "string"}, "currency": {"type": "string"}, "budget": {"type": "number"}}, "required": ["url", "agent_key", "action", "decision"]},
1291
+ { route: "/api/site_agents/call", method: "POST", action: "decide_job_draft", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1292
+ tool("site_agent_draft_decisions",
1293
+ "List draft decision receipts for the verified website agent only.",
1294
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "draft_decisions"}, "decision": {"type": "string"}, "draft_id": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1295
+ { route: "/api/site_agents/call", method: "POST", action: "draft_decisions", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1296
+ tool("site_agent_decision_reviews",
1297
+ "List owner apply-plan decision review receipts for the verified website agent only.",
1298
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "decision_reviews"}, "decision": {"type": "string"}, "apply_item_id": {"type": "string"}, "item_id": {"type": "string"}}, "required": ["url", "agent_key", "action"]},
1299
+ { route: "/api/site_agents/call", method: "POST", action: "decision_reviews", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1300
+ tool("site_agent_jobs",
1301
+ "List redacted AEO job records for the verified website agent only.",
1302
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "jobs"}}, "required": ["url", "agent_key", "action"]},
1303
+ { route: "/api/site_agents/call", method: "POST", action: "jobs", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1304
+ tool("site_agent_c5_repair_history",
1305
+ "Return redacted C5 content repair history for the verified website agent only.",
1306
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "c5_repair_history"}}, "required": ["url", "agent_key", "action"]},
1307
+ { route: "/api/site_agents/call", method: "POST", action: "c5_repair_history", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1308
+ tool("site_agent_report_job_evidence",
1309
+ "Attach implementation evidence to one of the verified website agent's own jobs.",
1310
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "const": "report_job_evidence"}, "job_id": {"type": "string"}, "evidence_uri": {"type": "string"}, "evidence": {"type": "object"}}, "required": ["url", "agent_key", "action", "job_id"]},
1311
+ { route: "/api/site_agents/call", method: "POST", action: "report_job_evidence", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1312
+ tool("google_cloud_alignment",
1313
+ "Read the Google Cloud Enterprise Agent Platform alignment brief.",
1314
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
1315
+ { route: "/api/agent/google_alignment", method: "GET" }),
1316
+ tool("google_agent_identity_bridge",
1317
+ "Prepare Google Agent Identity onboarding or validate an unverified effectiveIdentity binding candidate without importing Google credentials.",
1318
+ {"type": "object", "properties": {"twin3_agent_id": {"type": "string"}, "evidence": {"type": "object"}}, "required": []},
1319
+ { route: "/api/agent/google_identity_bridge", method: "GET", postWhen: args => Boolean(args.evidence), query: ["twin3_agent_id"], queryDefaults: {"twin3_agent_id": "agt_0000"} }),
1320
+ tool("trust_commerce_stack",
1321
+ "Read the AgentX.ID Passport, SBT, ERC-8004, x402, ERC-8183, and AP2 architecture plan.",
1322
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
1323
+ { route: "/api/agent/trust_stack", method: "GET" }),
1324
+ tool("aeo_job_drafts",
1325
+ "Turn failed audit checks and Agentic Browsing gaps into scoped AEO job drafts.",
1326
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1327
+ { route: "/api/agent/job_drafts", method: "POST" }),
1328
+ tool("aeo_job_accept_draft",
1329
+ "Accept an AEO job draft into the job ledger without funding it.",
1330
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1331
+ { route: "/api/agent/job_drafts/accept", method: "POST" }),
1332
+ tool("aeo_job_create",
1333
+ "Create an ERC-8183-style AEO delivery job.",
1334
+ {"type": "object", "properties": {"url": {"type": "string"}, "job_type": {"type": "string"}, "provider": {"type": "string"}, "evaluator": {"type": "string"}, "budget": {"type": "number"}, "currency": {"type": "string"}}, "required": ["url"]},
1335
+ { route: "/api/agent/jobs/create", method: "POST" }),
1336
+ tool("aeo_job_fund",
1337
+ "Mark an AEO delivery job as funded without exposing payment secrets.",
1338
+ {"type": "object", "properties": {"job_id": {"type": "string"}, "payment_reference": {"type": "string"}}, "required": ["job_id"]},
1339
+ { route: "/api/agent/jobs/fund", method: "POST" }),
1340
+ tool("aeo_job_payment_quote",
1341
+ "Return an x402-style payment requirement for an open AEO job.",
1342
+ {"type": "object", "properties": {"job_id": {"type": "string"}}, "required": ["job_id"]},
1343
+ { route: "/api/agent/jobs/payment_quote", method: "POST" }),
1344
+ tool("aeo_job_payment_proof",
1345
+ "Accept a payment proof hash and mark an open AEO job as funded.",
1346
+ {"type": "object", "properties": {"job_id": {"type": "string"}, "payment_proof": {"type": "object"}, "payment_signature": {"type": "string"}}, "required": ["job_id"]},
1347
+ { route: "/api/agent/jobs/fund_with_proof", method: "POST" }),
1348
+ tool("aeo_job_submit",
1349
+ "Submit an AEO delivery job by deliverable hash or URI.",
1350
+ {"type": "object", "properties": {"job_id": {"type": "string"}, "provider": {"type": "string"}, "deliverable_uri": {"type": "string"}, "deliverable": {"type": "object"}}, "required": ["job_id"]},
1351
+ { route: "/api/agent/jobs/submit", method: "POST" }),
1352
+ tool("aeo_job_evaluate",
1353
+ "Complete or reject an AEO delivery job with evaluator attestation.",
1354
+ {"type": "object", "properties": {"job_id": {"type": "string"}, "evaluator": {"type": "string"}, "decision": {"type": "string"}, "reason": {"type": "string"}}, "required": ["job_id"]},
1355
+ { route: "/api/agent/jobs/evaluate", method: "POST" }),
1356
+ tool("register_site_agent",
1357
+ MCP_MESSAGES.en.register_site_agent,
1358
+ {"type": "object", "properties": {"url": {"type": "string"}, "email": {"type": "string"}}, "required": ["url"]},
1359
+ { route: "/api/site_agents/register", method: "POST" }),
1360
+ tool("site_agent_install_guide",
1361
+ "Return the public no-side-effect Site Agent installation guide.",
1362
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1363
+ { route: "/api/site_agents/install_guide", method: "GET", query: ["url"] }),
1364
+ tool("verify_domain_ownership",
1365
+ "Verify DNS TXT, well-known JSON, or HTML meta proof and issue a Site Agent Key.",
1366
+ {"type": "object", "properties": {"url": {"type": "string"}, "method": {"type": "string"}}, "required": ["url"]},
1367
+ { route: "/api/site_agents/verify_domain", method: "POST" }),
1368
+ tool("start_site_agent_key_recovery",
1369
+ "Start a short-lived Site Agent Key recovery challenge bound to a fresh DNS TXT proof and one-time private capability.",
1370
+ {"type": "object", "properties": {"url": {"type": "string", "format": "uri"}}, "required": ["url"], "additionalProperties": false},
1371
+ { method: "POST", route: "/api/site_agents/key_recovery/start" }),
1372
+ tool("complete_site_agent_key_recovery",
1373
+ "Complete recovery only after fresh DNS proof and the private recovery capability are both supplied in the request body.",
1374
+ {"type": "object", "properties": {"url": {"type": "string", "format": "uri"}, "challenge_id": {"type": "string"}, "recovery_capability": {"type": "string", "writeOnly": true}}, "required": ["url", "challenge_id", "recovery_capability"], "additionalProperties": false},
1375
+ { method: "POST", route: "/api/site_agents/key_recovery/complete", requirements: ["fresh_dns_txt", "private_recovery_capability"] }),
1376
+ tool("site_agent_actions",
1377
+ "Read the machine-readable Site Agent action catalog.",
1378
+ GOOGLE_MARKETPLACE_PRICING_PACK_INPUT_SCHEMA,
1379
+ { route: "/api/site_agents/actions", method: "GET" }),
1380
+ tool("site_agent_call",
1381
+ "Authenticated call from a customer website agent.",
1382
+ {"type": "object", "properties": {"url": {"type": "string"}, "agent_key": {"type": "string"}, "action": {"type": "string", "enum": ["a1_ai_reads", "a1_dashboard", "a1_package", "a1_read_evidence_package", "a2_citation_evidence_package", "a2_package", "accept_draft", "accept_job_draft", "acknowledge_insight", "agent_feed", "ai_citation_evidence_package", "ai_read_dashboard", "ai_read_evidence_package", "ai_read_logs", "apply_evidence", "apply_plan", "audit_file_package", "audit_report", "b1_conversion_evidence_package", "b1_conversions", "b1_package", "c5_repair_history", "citation_gap_matrix", "community_citation_plan", "connector_events", "connector_sdk_events", "content_optimization_plan", "content_pack", "content_publication_package", "content_repair_pack", "content_to_dashboard_loop", "content_workflow_package", "conversion_events", "conversion_evidence_package", "customer_performance_comparison", "customer_performance_history", "customer_performance_snapshot", "dashboard", "decide_job_draft", "decision_reviews", "draft_decisions", "enterprise_policy", "evidence_pack", "execution_apply_plan", "execution_tracker", "i1_accept_job_draft", "i1_insights", "i1_job_drafts", "implementation_bundle", "insight_inbox", "insights", "insights_feed", "insights_job_drafts", "install_descriptor", "installation_verification", "job_drafts", "job_evidence", "job_status", "jobs", "list_jobs", "m19_apply_plan", "m1_outcome_evidence_package", "m1_outcome_report", "m1_package", "m20_apply_evidence", "m2_monthly_optimization_package", "m2_package", "m3_monthly_execution_tracker", "m3_tracker", "m4_monthly_outcome_scorecard", "m4_scorecard", "m5_dashboard", "m5_monthly_dashboard", "measurement_comparison", "measurement_history", "measurement_snapshot", "monthly_dashboard", "monthly_evidence_loop", "monthly_loop", "monthly_optimization_package", "monthly_package", "monthly_scorecard", "monthly_tracker", "operate_cycle", "operate_models", "operate_profile", "operate_rollback", "optimization_cycle", "outcome_package", "outcome_report", "outcome_scorecard", "prompt_test_results", "prompt_test_run_sheet", "refresh_insight_inbox", "report_apply_evidence", "report_job_evidence", "s1_site_signals", "save_measurement_snapshot", "sdk_event_package", "sdk_insights", "site_agent_events", "site_agent_job_evidence", "site_agent_jobs", "site_apply_plan", "site_feed", "site_monthly_evidence_loop", "site_signal_package", "site_signals_package", "skill_package", "submit_apply_evidence"]}}, "required": ["url", "agent_key", "action"]},
1383
+ { route: "/api/site_agents/call", method: "POST", auth: "site-body", requirements: ["verified_domain", "site_agent_key"] }),
1384
+ tool("managed_inspection_subscription",
1385
+ "Enable or control the verified website's hosted monthly public inspection.",
1386
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1387
+ { method: "POST", auth: "enterprise", scopes: ["managed:write"], defaultOperation: "enable", operations: {"enable": {"method": "POST", "route": "/api/site_agents/v1/managed/subscription"}, "get": {"method": "GET", "scopes": ["insights:read"], "route": "/api/site_agents/v1/managed/subscription"}, "pause": {"method": "POST", "route": "/api/site_agents/v1/managed/subscription/pause"}, "resume": {"method": "POST", "route": "/api/site_agents/v1/managed/subscription/resume"}}, route: "/api/site_agents/v1/managed/subscription", requirements: ["verified_domain", "managed:write"] }),
1388
+ tool("managed_inspection_runs",
1389
+ "Read the verified website's own redacted hosted-inspection results.",
1390
+ PUBLIC_EVIDENCE_INPUT_SCHEMA,
1391
+ { method: "GET", auth: "enterprise", query: ["limit"], scopes: ["insights:read"], route: "/api/site_agents/v1/managed/runs", requirements: ["verified_domain", "insights:read"] }),
1392
+ tool("hiring_intent_query",
1393
+ "Read one exact company-approved HiringIntent for the authenticated Company Agent. No candidate data, employer credentials, or public enumeration is returned.",
1394
+ {"type": "object", "properties": {"hiring_intent_id": {"type": "string", "pattern": "^hi_[A-Za-z0-9_-]{16,64}$"}}, "required": ["hiring_intent_id"], "additionalProperties": false},
1395
+ { method: "GET", auth: "enterprise", query: ["hiring_intent_id"], scopes: ["recruiting:intent:read"], route: "/api/site_agents/v1/recruiting/intents", requirements: ["verified_domain", "recruiting:intent:read", "exact_hiring_intent_id"] }),
1396
+ tool("introduction_request_query",
1397
+ "Read one exact private introduction request for the authenticated Company Agent. Pre-consent responses contain no Human ID or profile data.",
1398
+ {"type": "object", "properties": {"application_id": {"type": "string", "pattern": "^ir_[A-Za-z0-9_-]{20,80}$"}}, "required": ["application_id"], "additionalProperties": false},
1399
+ { method: "GET", auth: "enterprise", query: ["application_id"], scopes: ["recruiting:introduction:read"], route: "/api/site_agents/v1/recruiting/introductions", requirements: ["verified_domain", "recruiting:introduction:read", "exact_application_id"] }),
1400
+ tool("introduction_decision",
1401
+ "Sign and privately deliver one accepted or declined company introduction decision under a current OA5 recruiting authority.",
1402
+ {"type": "object", "properties": {"application_id": {"type": "string", "pattern": "^ir_[A-Za-z0-9_-]{20,80}$"}, "authority_id": {"type": "string", "pattern": "^auth_[A-Za-z0-9_-]{16,80}$"}, "decision": {"type": "string", "enum": ["accepted", "declined"]}, "idempotency_key": {"type": "string", "minLength": 16, "maxLength": 128}}, "required": ["application_id", "authority_id", "decision", "idempotency_key"], "additionalProperties": false},
1403
+ { method: "POST", auth: "enterprise", pathParameters: ["application_id"], scopes: ["recruiting:introduction:decide"], route: "/api/site_agents/v1/recruiting/introductions/{application_id}/decision", requirements: ["verified_domain", "recruiting:introduction:decide", "current_oa5_recruiting_authority"] }),
1404
+ tool("recruiting_authorize_pull",
1405
+ MCP_MESSAGES.en.recruiting_authorize_pull,
1406
+ {"type": "object", "properties": {"application_id": {"type": "string", "pattern": "^ir_[A-Za-z0-9_-]{20,80}$"}, "purpose": {"type": "string", "enum": ["disclosed_profile_fetch", "conversation_message_relay"]}, "message_id": {"type": "string", "minLength": 8, "maxLength": 128}, "idempotency_key": {"type": "string", "minLength": 16, "maxLength": 128}}, "required": ["application_id", "purpose", "idempotency_key"], "additionalProperties": false},
1407
+ { method: "POST", auth: "enterprise", pathParameters: ["application_id"], scopes: ["recruiting:profile:read", "recruiting:conversation:send"], scopeByPurpose: {"disclosed_profile_fetch": "recruiting:profile:read", "conversation_message_relay": "recruiting:conversation:send"}, route: "/api/site_agents/v1/recruiting/introductions/{application_id}/authorizations", requirements: ["verified_domain", "purpose_specific_recruiting_scope", "current_oa5_recruiting_authority", "active_human_consent"] }),
1408
+ tool("recruiting_disclosed_profile",
1409
+ MCP_MESSAGES.en.recruiting_disclosed_profile,
1410
+ {"type": "object", "properties": {"application_id": {"type": "string", "pattern": "^ir_[A-Za-z0-9_-]{20,80}$"}, "idempotency_key": {"type": "string", "minLength": 16, "maxLength": 128}}, "required": ["application_id", "idempotency_key"], "additionalProperties": false},
1411
+ { method: "POST", auth: "enterprise", pathParameters: ["application_id"], scopes: ["recruiting:profile:read"], route: "/api/site_agents/v1/recruiting/introductions/{application_id}/profile", requirements: ["verified_domain", "recruiting:profile:read", "current_oa5_recruiting_authority", "active_human_disclosure_grant"] }),
1412
+ tool("recruiting_conversation_message",
1413
+ MCP_MESSAGES.en.recruiting_conversation_message,
1414
+ {"type": "object", "properties": {"application_id": {"type": "string", "pattern": "^ir_[A-Za-z0-9_-]{20,80}$"}, "message_id": {"type": "string", "minLength": 8, "maxLength": 128}, "text": {"type": "string", "minLength": 1, "maxLength": 16384}}, "required": ["application_id", "message_id", "text"], "additionalProperties": false},
1415
+ { method: "POST", auth: "enterprise", pathParameters: ["application_id"], scopes: ["recruiting:conversation:send"], route: "/api/site_agents/v1/recruiting/introductions/{application_id}/messages", requirements: ["verified_domain", "recruiting:conversation:send", "current_oa5_recruiting_authority", "owner_opened_conversation"] }),
1416
+ tool("jobbank_company",
1417
+ "Read the verified website's own source-backed LEI candidates and public TaiwanJobs summaries. Returns no Human ID or person/candidate data.",
1418
+ {"type": "object", "properties": {"url": {"type": "string", "format": "uri"}, "agent_key": {"type": "string", "writeOnly": true}, "registration_id": {"type": "string", "pattern": "^[0-9]{8}$"}, "source_employer_id": {"type": "string", "pattern": "^[0-9]{1,20}$"}, "job_limit": {"type": "integer", "minimum": 1, "maximum": 50, "default": 50}, "include_jobs": {"type": "boolean", "default": true}}, "required": ["url", "agent_key"], "additionalProperties": false},
1419
+ { route: "/api/site_agents/v1/jobbank/company", method: "GET", auth: "site-key", query: ["url", "registration_id", "source_employer_id", "job_limit", "include_jobs"], requirements: ["verified_domain", "site_agent_key"] }),
1420
+ tool("company_card_resolve",
1421
+ "Resolve one exact Taiwan registration/company ID to an unclaimed public company-card URL. This is not a company directory or candidate search.",
1422
+ {"type": "object", "properties": {"registration_id": {"type": "string", "pattern": "^[0-9]{8}$"}, "company_id": {"type": "string", "pattern": "^TW:RA000551:[0-9]{8}$"}}, "anyOf": [{"required": ["registration_id"]}, {"required": ["company_id"]}], "additionalProperties": false},
1423
+ { route: "/api/company-card/resolve", method: "GET", query: ["registration_id", "company_id"] })
1424
+ ]);
1425
+
1426
+ const SENSITIVE_FIELD = /^(agent_key|access_token|authorization|recovery_capability|private_key|secret)$/i;
1427
+
1428
+ function redact(value, sensitive) {
1429
+ if (typeof value === "string") {
1430
+ for (const secret of sensitive.filter(item => typeof item === "string" && item)) {
1431
+ value = value.split(secret).join("[redacted]");
1432
+ }
1433
+ return value;
1434
+ }
1435
+ if (Array.isArray(value)) return value.map(item => redact(item, sensitive));
1436
+ if (objectValue(value)) return Object.fromEntries(Object.entries(value).map(([key, item]) => [
1437
+ key, SENSITIVE_FIELD.test(key)
1438
+ ? "[redacted]" : redact(item, sensitive)
1439
+ ]));
1440
+ return value;
1441
+ }
1442
+
1443
+ function backendFailure(status, payload, sensitive, retryAfter) {
1444
+ const reason = status === 401 ? MCP_MESSAGES.en.backend_authentication_failed
1445
+ : status === 403 ? MCP_MESSAGES.en.backend_permission_denied
1446
+ : status === 429 ? MCP_MESSAGES.en.backend_rate_limited
1447
+ : status >= 500 ? MCP_MESSAGES.en.backend_unavailable
1448
+ : MCP_MESSAGES.en.backend_rejected_request;
1449
+ const code = typeof payload?.error === "string" && /^[a-z][a-z0-9_.:-]{0,127}$/i.test(payload.error)
1450
+ ? payload.error : "backend_rejected_request";
1451
+ const credentials = [...sensitive];
1452
+ const collectCredentials = value => {
1453
+ if (Array.isArray(value)) value.forEach(collectCredentials);
1454
+ else if (objectValue(value)) for (const [key, item] of Object.entries(value)) {
1455
+ if (SENSITIVE_FIELD.test(key) && typeof item === "string" && item) {
1456
+ credentials.push(item);
1457
+ if (/^authorization$/i.test(key)) credentials.push(item.replace(/^Bearer\s+/i, ""));
1458
+ } else collectCredentials(item);
1459
+ }
1460
+ };
1461
+ collectCredentials(payload);
1462
+ const publicDetail = value => {
1463
+ if (typeof value === "string") {
1464
+ // Credential-bearing diagnostics can echo other, unknown secrets too.
1465
+ // Keep the whole string private while preserving separate public reasons.
1466
+ return redact(value, credentials) === value ? value : "[redacted]";
1467
+ }
1468
+ if (Array.isArray(value)) return value.map(publicDetail);
1469
+ if (objectValue(value)) return Object.fromEntries(Object.entries(value)
1470
+ .filter(([key]) => !/^(debug|diagnostics?|provider_diagnostics|raw|stack|stacktrace|traceback|headers)$/i.test(key))
1471
+ .map(([key, item]) => [redact(key, credentials), SENSITIVE_FIELD.test(key) ? "[redacted]" : publicDetail(item)]));
1472
+ return value;
1473
+ };
1474
+ const outcomes = {};
1475
+ const outcomeFields = ["verification", "gate", "graph", "preflight", "verdict", "failure_codes", "failures", "blockers", "next_actions"];
1476
+ const explanationFields = ["message", "reason", "error_message", "error_description"];
1477
+ for (const field of outcomeFields) {
1478
+ if (objectValue(payload) && own(payload, field)) outcomes[field] = publicDetail(payload[field]);
1479
+ }
1480
+ const detail = { error: publicDetail(code) };
1481
+ for (const field of explanationFields) {
1482
+ if (objectValue(payload) && own(payload, field)) detail[field] = publicDetail(payload[field]);
1483
+ }
1484
+ if (typeof payload === "string") detail.message = publicDetail(payload);
1485
+ if (typeof payload?.error === "string" && payload.error !== code) detail.error_message = publicDetail(payload.error);
1486
+ const contractSummary = (value, schema) => {
1487
+ if (value?.schema !== schema) return {};
1488
+ return { schema, ...(value.execution_status === "blocked" ? { execution_status: "blocked" } : {}) };
1489
+ };
1490
+ const summaries = {};
1491
+ for (const [field, schema] of [
1492
+ ["execution", "agentx-google-marketplace-procurement-execution-v0.1"],
1493
+ ["runtime_evidence", "agentx-google-marketplace-runtime-evidence-gate-v0.1"],
1494
+ ["ledger", "agentx-google-marketplace-runtime-evidence-ledger-v0.1"],
1495
+ ]) {
1496
+ const summary = contractSummary(payload?.[field], schema);
1497
+ if (summary.schema) summaries[field] = summary;
1498
+ const failures = Object.fromEntries([...outcomeFields, ...explanationFields]
1499
+ .filter(key => objectValue(payload?.[field]) && own(payload[field], key))
1500
+ .map(key => [key, publicDetail(payload[field][key])]));
1501
+ if (Object.keys(failures).length) detail[field] = failures;
1502
+ }
1503
+ // Preserve public decisions and actionable failures, with redaction. Other
1504
+ // backend fields remain private; execution contracts retain known summaries.
1505
+ return {
1506
+ isError: true,
1507
+ content: [{ type: "text", text: JSON.stringify({
1508
+ ok: false, status, reason, ...(retryAfter ? { retry_after: publicDetail(retryAfter) } : {}), ...outcomes,
1509
+ ...contractSummary(payload, "agentx-google-marketplace-usage-report-execution-v0.1"), ...summaries,
1510
+ detail
1511
+ }, null, 2) }]
1512
+ };
1513
+ }
1514
+
1515
+ function createMcpRuntime({ env = process.env, endpoint = configuredEndpoint(env), fetchImpl = globalThis.fetch, timeoutMs = 30000 } = {}) {
1516
+ const origin = new URL(endpoint);
1517
+ if (!["http:", "https:"].includes(origin.protocol) || origin.username || origin.password || origin.search || origin.hash) {
1518
+ throw new Error("MCP backend must be a configured HTTP(S) origin without credentials, query or fragment.");
1519
+ }
1520
+ const base = origin.toString().replace(/\/+$/, "");
1521
+ const registry = TOOL_REGISTRY;
1522
+ const byName = new Map(registry.map(entry => [entry.name, entry]));
1523
+ let state = "new";
1524
+
1525
+ async function request({ method, route, query, headers, body, sensitive }) {
1526
+ let response;
1527
+ let payload;
1528
+ try {
1529
+ response = await fetchImpl(`${base}${route}${query.size ? `?${query}` : ""}`, {
1530
+ method, headers: { Accept: "application/json", ...(body ? { "content-type": "application/json" } : {}), ...headers },
1531
+ ...(body ? { body: JSON.stringify(body) } : {}),
1532
+ redirect: "error", signal: AbortSignal.timeout(timeoutMs)
1533
+ });
1534
+ const text = await response.text();
1535
+ try { payload = JSON.parse(text); } catch {
1536
+ return backendFailure(response.status, { error: "backend_invalid_json" }, sensitive);
1537
+ }
1538
+ } catch {
1539
+ throw new ToolError("Backend request failed or timed out; check the configured service and retry.");
1540
+ }
1541
+ if (payload === null) return backendFailure(response.status, { error: "backend_invalid_response" }, sensitive);
1542
+ if (!response.ok || payload?.ok === false || payload?.isError === true || payload?.error) {
1543
+ return backendFailure(response.status, payload, sensitive, response.headers.get("retry-after"));
1544
+ }
1545
+ return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
1546
+ }
1547
+
1548
+ async function dispatch(message) {
1549
+ const params = message.params === undefined ? {} : message.params;
1550
+ if (!objectValue(params)) throw new RpcError(-32602, "params must be an object");
1551
+ if (params._meta !== undefined && !objectValue(params._meta)) throw new RpcError(-32602, "params._meta must be an object");
1552
+ if (message.method === "initialize") {
1553
+ if (state !== "new") throw new RpcError(-32600, "This MCP session is already initialized");
1554
+ if (typeof params.protocolVersion !== "string" || !params.protocolVersion
1555
+ || !objectValue(params.capabilities) || !objectValue(params.clientInfo)
1556
+ || typeof params.clientInfo.name !== "string" || typeof params.clientInfo.version !== "string") {
1557
+ throw new RpcError(-32602, "initialize requires protocolVersion, capabilities and clientInfo");
1558
+ }
1559
+ const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(params.protocolVersion)
1560
+ ? params.protocolVersion : SUPPORTED_PROTOCOL_VERSIONS[0];
1561
+ state = "negotiated";
1562
+ return { protocolVersion, serverInfo: { name: "agent-id", version }, capabilities: { tools: { listChanged: false } } };
1563
+ }
1564
+ if (message.method === "ping") {
1565
+ if (Object.keys(params).some(key => key !== "_meta")) throw new RpcError(-32602, "ping has no tool parameters");
1566
+ return {};
1567
+ }
1568
+ if (!["tools/list", "tools/call"].includes(message.method)) throw new RpcError(-32601, "Unknown method");
1569
+ if (state !== "ready") throw new RpcError(-32002, "Initialize and send notifications/initialized before using tools");
1570
+ if (message.method === "tools/list") {
1571
+ if (Object.keys(params).some(key => !["cursor", "_meta"].includes(key))
1572
+ || (params.cursor !== undefined && params.cursor !== "")) {
1573
+ throw new RpcError(-32602, "Invalid tools/list cursor or parameters");
1574
+ }
1575
+ return { tools: registry.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })) };
1576
+ }
1577
+ if (typeof params.name !== "string" || !params.name
1578
+ || Object.keys(params).some(key => !["name", "arguments", "_meta"].includes(key))) {
1579
+ throw new RpcError(-32602, "tools/call requires a tool name and supported parameters");
1580
+ }
1581
+ const entry = byName.get(own(TOOL_ALIASES, params.name) ? TOOL_ALIASES[params.name] : params.name);
1582
+ if (!entry) throw new RpcError(-32602, "Unknown tool");
1583
+ const args = params.arguments === undefined ? {} : params.arguments;
1584
+ validate(entry.inputSchema, args);
1585
+ try { return await entry.handler(args, { env, request }); } catch (error) {
1586
+ if (error instanceof RpcError) throw error;
1587
+ return { isError: true, content: [{ type: "text", text: error instanceof ToolError ? error.message : "Tool execution failed." }] };
1588
+ }
1589
+ }
1590
+
1591
+ async function handleMessage(message) {
1592
+ const hasId = objectValue(message) && own(message, "id");
1593
+ const validId = hasId && (typeof message.id === "string" || (typeof message.id === "number" && Number.isFinite(message.id)));
1594
+ const id = validId ? message.id : null;
1595
+ const errorResponse = (code, text) => ({ jsonrpc: "2.0", id, error: { code, message: text } });
1596
+ if (!objectValue(message) || message.jsonrpc !== "2.0" || typeof message.method !== "string" || !message.method || (hasId && !validId)) {
1597
+ // Identifiable notifications never receive a response, including invalid
1598
+ // params. Non-message input still gets the JSON-RPC invalid-request error.
1599
+ if (objectValue(message) && !hasId && typeof message.method === "string") return undefined;
1600
+ return errorResponse(-32600, "Invalid JSON-RPC request");
1601
+ }
1602
+ if (!hasId) {
1603
+ if (message.method === "notifications/initialized" && state === "negotiated"
1604
+ && (message.params === undefined || (objectValue(message.params)
1605
+ && Object.keys(message.params).every(key => key === "_meta")
1606
+ && (message.params._meta === undefined || objectValue(message.params._meta))))) state = "ready";
1607
+ // A notification must not execute a tool or initiate a session.
1608
+ return undefined;
1609
+ }
1610
+ try { return { jsonrpc: "2.0", id, result: await dispatch(message) }; } catch (error) {
1611
+ return errorResponse(error instanceof RpcError ? error.code : -32603,
1612
+ error instanceof RpcError ? error.message : "Internal MCP error");
1613
+ }
1614
+ }
1615
+
1616
+ async function handleLine(line) {
1617
+ let message;
1618
+ try { message = JSON.parse(line); } catch {
1619
+ return { jsonrpc: "2.0", id: null, error: { code: -32700, message: "Invalid JSON" } };
1620
+ }
1621
+ return handleMessage(message);
1622
+ }
1623
+
1624
+ function run({ input = process.stdin, output = process.stdout, diagnostics = process.stderr } = {}) {
1625
+ input.setEncoding("utf8");
1626
+ let buffer = "";
1627
+ let pending = Promise.resolve();
1628
+ const enqueue = line => {
1629
+ if (!line.trim()) return;
1630
+ pending = pending.then(async () => {
1631
+ const response = await handleLine(line);
1632
+ if (response) output.write(JSON.stringify(response) + "\n");
1633
+ }).catch(() => { diagnostics.write("MCP transport failed.\n"); });
1634
+ };
1635
+ return new Promise((resolve, reject) => {
1636
+ input.on("data", chunk => {
1637
+ buffer += chunk;
1638
+ let boundary;
1639
+ while ((boundary = buffer.indexOf("\n")) >= 0) {
1640
+ const line = buffer.slice(0, boundary);
1641
+ buffer = buffer.slice(boundary + 1);
1642
+ enqueue(line);
1643
+ }
1644
+ });
1645
+ input.once("end", () => { enqueue(buffer); pending.then(resolve, reject); });
1646
+ input.once("error", () => reject(new Error("MCP input transport failed.")));
1647
+ });
1648
+ }
1649
+ return { registry, handleMessage, handleLine, run };
1650
+ }
1651
+
1652
+ function runMcp(options) {
1653
+ return createMcpRuntime(options).run();
1654
+ }
1655
+
1656
+ module.exports = { createMcpRuntime, runMcp, TOOL_REGISTRY, TOOL_ALIASES, SUPPORTED_PROTOCOL_VERSIONS };