@tryvira/mcp 0.1.78 → 0.1.90
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/README.md +15 -4
- package/dist/cli.js +863 -131
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -13,9 +13,19 @@ var registry = /* @__PURE__ */ Object.create(null);
|
|
|
13
13
|
var add = (names, authority) => names.forEach((name) => {
|
|
14
14
|
registry[name] = authority;
|
|
15
15
|
});
|
|
16
|
-
var generatedReadTools = ["list_strategy_executions", "search_runtime_traces", "get_ai_system", "list_system_connections", "list_inventory", "get_connection", "get_connection_health", "list_teach_analyses", "get_teach_analysis", "get_evaluation", "list_conversation_archive", "list_teach_runs", "get_teach_run_recommendation", "get_improvement_proposal", "list_compound_task_plans", "get_compound_task_plan", "get_behavior_program"];
|
|
16
|
+
var generatedReadTools = ["list_strategy_executions", "search_runtime_traces", "get_ai_system", "list_system_connections", "list_inventory", "get_connection", "get_connection_health", "list_teach_analyses", "get_teach_analysis", "get_evaluation", "list_conversation_archive", "list_teach_runs", "get_teach_run_recommendation", "get_task_run_evidence", "get_improvement_proposal", "list_compound_task_plans", "get_compound_task_plan", "get_behavior_program"];
|
|
17
17
|
add(generatedReadTools, read());
|
|
18
|
-
add(["get_scope", "list_capabilities", "get_job", "list_inbox", "get_conflict_inspection", "get_optimization_run", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_behavior_program", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "list_ai_systems", "get_ai_system", "list_system_connections", "get_connection", "get_connection_health", "list_inventory", "list_connection_inventory", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision", "get_pack_revision_diff", "list_packs", "get_pack", "diagnose_pack", "list_evaluations", "get_teach_analysis", "get_teach_run_recommendation", "get_evaluation", "get_evaluation_comparison", "get_evaluation_plan", "get_improvement_proposal", "search_runtime_traces"], read());
|
|
18
|
+
add(["get_scope", "list_capabilities", "get_job", "list_inbox", "get_conflict_inspection", "get_optimization_run", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_behavior_program", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "get_ai_usage_reconciliation", "list_ai_systems", "get_ai_system", "list_system_connections", "get_connection", "get_connection_health", "list_inventory", "list_connection_inventory", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision", "get_pack_revision_diff", "list_packs", "get_pack", "diagnose_pack", "list_evaluations", "get_teach_analysis", "get_teach_run_recommendation", "get_evaluation", "get_evaluation_comparison", "get_evaluation_plan", "get_improvement_proposal", "search_runtime_traces"], read());
|
|
19
|
+
add(["list_organization_units", "list_organization_unit_members", "list_project_organization_units", "list_organization_billing_admins", "list_ai_system_unit_grants", "get_ai_credit_wallet", "list_ai_credit_budgets", "list_ai_usage_receipts", "get_ai_usage_summary", "list_notification_destinations"], read());
|
|
20
|
+
registry.preview_organization_unit_archive = { permissionClass: "integration.read", requiredRoles: ["workspace.owner"], effectType: "read", scopePolicy: "environment", approvalRequirement: "none" };
|
|
21
|
+
add(["reserve_ai_credits", "release_ai_credit_reservation"], effectful("billing.write", "human", ["admin.billing.write", "workspace.owner"]));
|
|
22
|
+
add(["save_compound_task_plan"], effectful("runtime.execute", "server"));
|
|
23
|
+
add(["queue_task_run_host_dispatch"], effectful("runtime.execute", "human"));
|
|
24
|
+
add(["create_organization_unit", "set_organization_unit_member", "bind_project_organization_unit"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
25
|
+
add(["archive_organization_unit"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
26
|
+
add(["set_organization_billing_admin"], effectful("billing.write", "human", ["workspace.owner"]));
|
|
27
|
+
add(["grant_ai_system_unit_access", "revoke_ai_system_unit_access"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
28
|
+
add(["create_notification_destination", "revoke_notification_destination"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
19
29
|
add(["connect_ai_system", "observe", "record_user_feedback", "record_business_outcome"], effectful("integration.write", "server", ["studio.write", "admin"]));
|
|
20
30
|
add(["mark_inbox_read"], effectful("teach.write", "server", ["studio.write", "admin"]));
|
|
21
31
|
add(["inspect_conflicts", "resolve_conflict"], effectful("behavior.write", "server", ["studio.write", "admin", "release.approve"]));
|
|
@@ -25,7 +35,7 @@ add(["test_connection"], effectful("integration.write", "server", ["studio.write
|
|
|
25
35
|
add(["resolve_semantic", "resolve_task_run", "simulate_behavior_strategy"], read("runtime.execute"));
|
|
26
36
|
add(["observe"], effectful("observation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
27
37
|
add(["list_observations", "get_observation"], read("observation.write"));
|
|
28
|
-
add(["resolve_runtime", "start_task_run", "continue_task_run", "cancel_task_run", "retry_task_run", "start_strategy_execution", "continue_strategy_execution", "cancel_strategy_execution", "compile_behavior_capsule", "serve_behavior_projection", "authorize_host_tool"], effectful("runtime.execute"));
|
|
38
|
+
add(["execute_managed_chat", "resolve_runtime", "start_task_run", "continue_task_run", "cancel_task_run", "retry_task_run", "start_strategy_execution", "continue_strategy_execution", "cancel_strategy_execution", "compile_behavior_capsule", "serve_behavior_projection", "authorize_host_tool"], effectful("runtime.execute"));
|
|
29
39
|
add(["create_semantic_task", "create_behavior_point", "activate_behavior_strategy", "delete_ai_system", "delete_semantic_task", "delete_behavior_point", "delete_behavior_strategy"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
30
40
|
add(["create_behavior_program", "delete_behavior_program", "delete_behavior_program_cascade", "validate_behavior_strategy", "activate_behavior_strategy", "create_behavior_strategy", "create_behavior_strategy_variant"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
31
41
|
add(["submit_teach_evidence", "create_teach_proposal", "transition_teach_proposal", "accept_teach_recommendation"], effectful("teach.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
@@ -34,6 +44,7 @@ registry.get_teach_behavior_set = read();
|
|
|
34
44
|
add(["start_evaluation", "create_evaluation_plan", "seal_evaluation_plan", "create_improvement_proposal", "review_improvement_proposal", "create_behavior_revision_candidate", "evaluate_behavior_revision_candidate", "accept_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
35
45
|
add(["review_comparative_finding", "edit_improvement_proposal", "transition_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
36
46
|
add(["create_release"], effectful("release.approve", "human"));
|
|
47
|
+
add(["retire_program_pointer"], effectful("release.approve", "human"));
|
|
37
48
|
add(["create_signal_discovery_proposal", "review_signal_discovery_proposal", "materialize_signal_discovery", "create_signal_mapping", "review_signal_mapping", "review_discovery_candidate"], effectful("discovery.write"));
|
|
38
49
|
add(["create_observation"], effectful("observation.write"));
|
|
39
50
|
add(["create_pack_revision", "transition_pack_revision", "materialize_pack_revision", "import_pack", "install_pack", "evaluate_pack", "approve_pack", "release_pack", "preview_pack_upgrade"], effectful("pack.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
@@ -49,6 +60,726 @@ var MCP_TOOL_REGISTRY = Object.freeze(registry);
|
|
|
49
60
|
var getMcpToolAuthority = (tool) => Object.hasOwn(MCP_TOOL_REGISTRY, tool) ? MCP_TOOL_REGISTRY[tool] : void 0;
|
|
50
61
|
var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
|
|
51
62
|
|
|
63
|
+
// src/public-tool-catalog.ts
|
|
64
|
+
var coreTools = Object.freeze([
|
|
65
|
+
{ name: "get_scope", description: "Read the immutable scope configured for this MCP session.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
66
|
+
{ name: "list_capabilities", description: "Show coarse role-based product capability groups and the canonical Control API operation inventory. Role eligibility is a hint; it is not per-operation availability or authorization.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, surface: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
67
|
+
{ name: "list_organization_units", description: "List organization units visible to the authenticated actor.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
68
|
+
{ name: "list_ai_system_unit_grants", description: "List unit access grants for an AI System. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId"] } },
|
|
69
|
+
{ name: "grant_ai_system_unit_access", description: "Grant scoped capabilities on an AI System to a Project-bound unit. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, unitId: { type: "string" }, permissions: { type: "array", items: { type: "string", enum: ["system.read", "system.use", "observation.write", "teach.write", "evaluation.write", "release.approve", "integration.manage", "secret.read", "trace.read"] } } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "unitId", "permissions"] } },
|
|
70
|
+
{ name: "revoke_ai_system_unit_access", description: "Revoke an AI System unit access grant. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "unitId"] } },
|
|
71
|
+
{ name: "list_organization_billing_admins", description: "List organization Billing Admin memberships. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
72
|
+
{ name: "set_organization_billing_admin", description: "Grant or revoke an organization Billing Admin membership. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, actorId: { type: "string" }, status: { type: "string", enum: ["ACTIVE", "REVOKED"] } }, required: ["organizationId", "projectId", "environmentId", "actorId", "status"] } },
|
|
73
|
+
{ name: "get_ai_credit_wallet", description: "Read the organization AI credit balance and recent ledger entries. Organization billing admin permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
74
|
+
{ name: "get_ai_usage_summary", description: "Read monthly provider cost and customer credits by provider/model, optionally filtered to an organization unit. Owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
75
|
+
{ name: "list_ai_usage_receipts", description: "Read rated provider usage receipts, optionally filtered to an organization unit. Owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string", minLength: 1 }, limit: { type: "integer", minimum: 1, maximum: 500 } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
76
|
+
{ name: "list_ai_credit_budgets", description: "Read organization AI credit budget caps and consumed or reserved usage. Organization billing admin permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
77
|
+
{ name: "reserve_ai_credits", description: "Reserve an approved upper bound before a managed AI provider call. Organization Billing Admin permission and human approval are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, amountMicrocredits: { type: "integer", minimum: 1, maximum: 9007199254740991 }, periodStart: { type: "string" }, periodEnd: { type: "string" }, idempotencyKey: { type: "string" }, aiSystemId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "amountMicrocredits", "periodStart", "periodEnd", "idempotencyKey"] } },
|
|
78
|
+
{ name: "release_ai_credit_reservation", description: "Release an unused AI credit reservation before a usage receipt is recorded. Organization Billing Admin permission and human approval are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, reservationId: { type: "string" }, idempotencyKey: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "reservationId"] } },
|
|
79
|
+
{ name: "create_organization_unit", description: "Create an organization unit. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, parentUnitId: { type: ["string", "null"] }, name: { type: "string" }, kind: { type: "string", enum: ["business_unit", "department", "team"] } }, required: ["organizationId", "projectId", "environmentId", "name", "kind"] } },
|
|
80
|
+
{ name: "list_organization_unit_members", description: "List memberships for a unit managed by the authenticated owner or Department Admin.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "unitId"] } },
|
|
81
|
+
{ name: "preview_organization_unit_archive", description: "Preview the affected descendants, memberships, and project ownership before an organization unit is archived. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "unitId"] } },
|
|
82
|
+
{ name: "archive_organization_unit", description: "Archive an organization unit subtree after reviewing its impact. Workspace owner permission and explicit confirmation are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" }, confirm: { type: "boolean", const: true } }, required: ["organizationId", "projectId", "environmentId", "unitId", "confirm"] } },
|
|
83
|
+
{ name: "set_organization_unit_member", description: "Set a scoped unit membership. Owner authority is required for elevated roles.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" }, actorId: { type: "string" }, role: { type: "string", enum: ["department_admin", "teacher", "reviewer", "billing_admin", "viewer"] }, status: { type: "string", enum: ["ACTIVE", "REVOKED"] } }, required: ["organizationId", "projectId", "environmentId", "unitId", "actorId", "role"] } },
|
|
84
|
+
{ name: "list_project_organization_units", description: "List organization unit bindings for the current project.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, targetProjectId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "targetProjectId"] } },
|
|
85
|
+
{ name: "bind_project_organization_unit", description: "Bind an organization unit to a project. Workspace owners may bind units and assign primary ownership; Department Admins may bind only their active unit as a non-primary owner.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, targetProjectId: { type: "string" }, unitId: { type: "string" }, primaryOwner: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "targetProjectId", "unitId"] } },
|
|
86
|
+
{ name: "list_inbox", description: "List scoped review notifications for the authenticated actor.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
87
|
+
{ name: "list_notification_destinations", description: "List authorized notification destinations in the current organization, project, and environment scope. Endpoint secrets are never returned.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
88
|
+
{ name: "create_notification_destination", description: "Register an encrypted Slack or Microsoft Teams Workflows destination. The endpoint is a secret and is never returned; owner or integration.write permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, label: { type: "string", minLength: 1 }, provider: { type: "string", enum: ["slack", "microsoft_teams"] }, endpoint: { type: "string", minLength: 1, writeOnly: true }, idempotencyKey: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "label", "provider", "endpoint"] } },
|
|
89
|
+
{ name: "revoke_notification_destination", description: "Revoke a scoped notification destination. Pending deliveries are suppressed after revocation; owner or integration.write permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, destinationId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "destinationId"] } },
|
|
90
|
+
{ name: "mark_inbox_read", description: "Mark one scoped review notification as read.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, notificationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "notificationId"] } },
|
|
91
|
+
{ name: "inspect_conflicts", description: "Create a scoped conflict inspection.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, proposed: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, controlPointId: { type: "string" }, policyEffect: { type: "string" }, strategyKey: { type: "string" }, scope: { type: "string" } }, required: ["id", "controlPointId", "policyEffect", "strategyKey"] } }, active: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, controlPointId: { type: "string" }, policyEffect: { type: "string" }, strategyKey: { type: "string" }, scope: { type: "string" } }, required: ["id", "controlPointId", "policyEffect", "strategyKey"] } }, controls: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, level: { type: "string" }, autonomy: { type: "string", enum: ["MANUAL", "ASSISTED", "AUTOMATIC"] }, value: { type: "string" }, enabled: { type: "boolean" }, authorityDigest: { type: ["string", "null"] } }, required: ["id", "level", "autonomy", "value", "enabled"] } } }, required: ["organizationId", "projectId", "environmentId", "proposed", "active", "controls"] } },
|
|
92
|
+
{ name: "get_conflict_inspection", description: "Read a persisted scoped conflict inspection.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, inspectionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "inspectionId"] } },
|
|
93
|
+
{ name: "resolve_conflict", description: "Approve or reject a scoped conflict inspection.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, inspectionId: { type: "string" }, status: { type: "string" }, authorityDigest: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "inspectionId", "status"] } },
|
|
94
|
+
{ name: "start_optimization", description: "Start provider-backed scoped optimization.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, request: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "request"] } },
|
|
95
|
+
{ name: "get_optimization_run", description: "Read a scoped durable optimization run.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, runId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "runId"] } },
|
|
96
|
+
{ name: "cancel_optimization_run", description: "Request cancellation of a scoped optimization run.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, runId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "runId"] } },
|
|
97
|
+
{ name: "connect_ai_system", description: "Connect the customer chatbot/agent and return its capability handshake. Use for an AI System connection; not for a raw adapter probe or behavior authoring.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, name: { type: "string" }, systemType: { type: "string" }, adapterType: { type: "string" }, adapterVersion: { type: "string" }, capabilities: { type: "array", items: { type: "string" } }, config: { type: "object" }, idempotencyKey: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "name", "systemType", "adapterType", "adapterVersion"] } },
|
|
98
|
+
{ name: "get_job", description: "Read a scope-bound asynchronous job and completion evidence.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, jobId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "jobId"] } },
|
|
99
|
+
{ name: "list_semantic_tasks", description: "Read scoped Semantic Tasks with optional cursor pagination and search.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
100
|
+
{ name: "create_semantic_task", description: "Create a scoped Semantic Task for later review/activation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, taskKey: { type: "string" }, description: { type: "string" }, version: { type: "number" }, aliases: { type: "array", items: { type: "string" } }, examples: { type: "array", items: { type: "string" } }, negativeExamples: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "taskKey"] } },
|
|
101
|
+
{ name: "list_behavior_points", description: "Read scoped canonical BehaviorPoints with optional cursor pagination and search.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
102
|
+
{ name: "list_discovery_candidates", description: "Read scoped discovery candidates with pagination and review filters.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, reviewState: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
103
|
+
{ name: "create_behavior_point", description: "Create a scoped BehaviorPoint bound to one or more Semantic Tasks.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, key: { type: "string" }, taskId: { type: "string" }, taskIds: { type: "array", items: { type: "string" } }, constraints: { type: "array", items: { type: "object", additionalProperties: true } } }, required: ["organizationId", "projectId", "environmentId", "key"] } },
|
|
104
|
+
{ name: "activate_behavior_strategy", description: "Activate a validated scoped Behavior Strategy revision.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, strategyId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "strategyId"] } },
|
|
105
|
+
{ name: "submit_teach_evidence", description: "Submit scoped evidence to the Teach lifecycle.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, source: { type: "string" }, content: { type: "string" }, consent: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "id", "content", "consent"] } },
|
|
106
|
+
{ name: "get_teach_behavior_set", description: "Read a provider-backed Teach run behavior set and its completeness; review is required before evaluation or release.", effectful: false, inputSchema: { type: "object", properties: { teachRunId: { type: "string" } }, required: ["teachRunId"] } },
|
|
107
|
+
{ name: "accept_teach_recommendation", description: "Accept a complete Teach behavior graph for evaluation; this never publishes directly.", effectful: true, inputSchema: { type: "object", properties: { teachRunId: { type: "string" }, actorId: { type: "string" } }, required: ["teachRunId", "actorId"] } },
|
|
108
|
+
{ name: "create_teach_proposal", description: "Create a reviewed Teach proposal from admitted evidence.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evidenceId: { type: "string" }, controlPointId: { type: "string" }, summary: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "evidenceId", "controlPointId", "summary"] } },
|
|
109
|
+
{ name: "transition_teach_proposal", description: "Review, evaluate, or promote a Teach proposal.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, proposalId: { type: "string" }, transition: { type: "string" }, decision: { type: "string" }, score: { type: "number" }, evaluationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "proposalId", "transition"] } },
|
|
110
|
+
{ name: "create_release", description: "Create a scoped release using either provider-backed evaluation or explicit manual approval with step-up evidence. Optionally set aiSystemId (or manifest.aiSystemId) to bind the release to an AI System; it must match the linked evaluation and the caller needs release.approve on that System.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, releaseId: { type: "string" }, artifactId: { type: "string" }, evaluationId: { type: "string" }, aiSystemId: { type: "string" }, manifest: { type: "object", properties: { aiSystemId: { type: "string" } }, additionalProperties: true }, manualApproval: { type: "object", properties: { reason: { type: "string" } }, required: ["reason"] }, stepUp: { type: "object", properties: { id: { type: "string" }, assertion: { type: "string" }, purpose: { type: "string" } }, required: ["id", "assertion", "purpose"] } }, required: ["organizationId", "projectId", "environmentId", "artifactId"] } },
|
|
111
|
+
{ name: "retire_program_pointer", description: "Retire the current scoped program pointer with a version fence. Irreversible for the active pointer; requires release.approve permission and explicit human confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, pointerKey: { type: "string", minLength: 1 }, confirm: { type: "boolean", const: true }, expectedVersion: { type: "integer", minimum: 1, maximum: Number.MAX_SAFE_INTEGER }, reason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["organizationId", "projectId", "environmentId", "pointerKey", "confirm", "expectedVersion", "reason"] } },
|
|
112
|
+
{ name: "resolve_semantic", description: "Resolve input through the governed semantic runtime. Remote inference consumes AI credits for the authorized AI System.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, input: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, requestId: { type: "string", minLength: 1 }, sessionId: { type: "string" }, profile: { type: "object" }, selection: { type: "object" }, candidates: { type: "array", items: { type: "object", additionalProperties: true } }, timeoutMs: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "input", "aiSystemId"] } },
|
|
113
|
+
{ name: "execute_managed_chat", description: "Run an authorized Vira-managed chat completion. A provider usage receipt is settled before output is returned. This is a billable model operation, not BYOK observation.", effectful: true, inputSchema: { type: "object", additionalProperties: false, properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, connectionId: { type: "string", minLength: 1 }, operationId: { type: "string", minLength: 1, maxLength: 200 }, model: { type: "string", minLength: 1 }, messages: { type: "array", minItems: 1, maxItems: 128, items: { type: "object", additionalProperties: true } }, max_tokens: { type: "integer", minimum: 1, maximum: 8192 } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "connectionId", "operationId", "model", "messages"] } },
|
|
114
|
+
{ name: "resolve_task_run", description: "Resolve a scoped TaskRun route without starting execution. Remote inference consumes AI credits for the authorized AI System.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, input: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, requestId: { type: "string", minLength: 1 }, requestedMode: { type: "string" }, intentCount: { type: "number" }, hostCapabilities: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "input", "aiSystemId"] } },
|
|
115
|
+
{ name: "start_task_run", description: "Start a TaskRun from a natural-language request. The server requires an authorized AI System and derives the actor, host capabilities, mode and released plan; requestedMode and plan fields are advanced overrides only.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, taskRunId: { type: "string" }, requestId: { type: "string" }, ownerActorRef: { type: "string" }, input: { type: "string" }, requestedMode: { type: "string" }, hostCapabilities: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "input"] } },
|
|
116
|
+
{ name: "list_compound_task_plans", description: "List persisted compound execution plans for the authenticated organization, project, and environment with bounded cursor pagination.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
117
|
+
{ name: "save_compound_task_plan", description: "Persist a validated immutable compound execution plan in the authenticated scope. This writes a plan but does not execute it.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, plan: { type: "object", additionalProperties: true }, idempotencyKey: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "plan"] } },
|
|
118
|
+
{ name: "get_compound_task_plan", description: "Read one persisted compound execution plan in the authenticated organization, project, and environment.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, planId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "planId"] } },
|
|
119
|
+
{ name: "get_task_run", description: "Read a scoped TaskRun state and lifecycle version.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
120
|
+
{ name: "queue_task_run_host_dispatch", description: "Queue an effectful SINGLE TaskRun after a real human approval has already been issued in the authenticated session. Never execute locally or issue an approval through this tool; read TaskRun evidence for the result.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string" }, taskRunId: { type: "string" }, childRunId: { type: "string" }, aiSystemId: { type: "string" }, sessionId: { type: "string" }, approvalId: { type: "string" }, context: { type: "object", additionalProperties: true }, proposal: { type: "object", additionalProperties: true } }, required: ["organizationId", "projectId", "environmentId", "organizationUnitId", "taskRunId", "childRunId", "aiSystemId", "sessionId", "approvalId", "context", "proposal"] } },
|
|
121
|
+
{ name: "get_task_run_evidence", description: "Read one authorized TaskRun execution evidence graph: verified Strategy release/evaluation, step receipts and exact rated AI credit usage. Parent and child department/AI System grants are checked by Control API.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
122
|
+
{ name: "list_task_run_events", description: "Read the persisted scoped TaskRun lifecycle events.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
123
|
+
{ name: "continue_task_run", description: "Resume a waiting scoped TaskRun using its current state version.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" }, expectedVersion: { type: "number" }, cursor: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId", "expectedVersion"] } },
|
|
124
|
+
{ name: "cancel_task_run", description: "Cancel a scoped TaskRun using its current state version.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" }, expectedVersion: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId", "expectedVersion"] } },
|
|
125
|
+
{ name: "retry_task_run", description: "Retry a failed, blocked, or partial scoped TaskRun using its immutable plan and current state version.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" }, expectedVersion: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId", "expectedVersion"] } },
|
|
126
|
+
{ name: "resolve_runtime", description: "Resolve a persisted BehaviorPoint through the governed runtime boundary. behaviorPoint may be omitted when semanticContext supplies the selected canonical route.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, behaviorPoint: { type: "string" }, executionBoundary: { type: "object" }, semanticContext: { type: "object" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
127
|
+
{ name: "create_signal_discovery_proposal", description: "Propose a discovered signal for scoped human review.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, signalStableKey: { type: "string" }, evidenceEventIds: { type: "array", items: { type: "string" } }, suggestedProducerType: { type: "string" }, suggestedProducerKey: { type: "string" }, confidence: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "signalStableKey", "evidenceEventIds"] } },
|
|
128
|
+
{ name: "review_signal_discovery_proposal", description: "Approve or reject a discovered signal proposal.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, proposalId: { type: "string" }, decision: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "proposalId", "decision"] } },
|
|
129
|
+
{ name: "materialize_signal_discovery", description: "Materialize an approved signal into a definition and producer mapping.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, proposalId: { type: "string" }, valueType: { type: "string" }, description: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "proposalId"] } },
|
|
130
|
+
{ name: "create_signal_mapping", description: "Create a scoped signal producer mapping proposal.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, signalStableKey: { type: "string" }, signalVersion: { type: "number" }, producerType: { type: "string" }, producerKey: { type: "string" }, sourceEventType: { type: "string" }, evidenceEventIds: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "signalStableKey", "signalVersion", "producerType", "producerKey"] } },
|
|
131
|
+
{ name: "get_signal_mapping", description: "Read one scoped signal producer mapping.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, mappingId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "mappingId"] } },
|
|
132
|
+
{ name: "review_signal_mapping", description: "Approve or reject a scoped signal producer mapping.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, mappingId: { type: "string" }, decision: { type: "string" }, eventId: { type: "string" }, definition: { type: "object" }, teachConsentRecord: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "mappingId", "decision"] } },
|
|
133
|
+
{ name: "list_behavior_programs", description: "Read scoped canonical behavior programs with optional cursor pagination and search.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
134
|
+
{ name: "list_behavior_strategies", description: "Read persisted immutable Behavior Strategy revisions with optional cursor pagination and search.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
135
|
+
{ name: "get_behavior_strategy", description: "Read one persisted Behavior Strategy definition and artifact binding.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, strategyId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "strategyId"] } },
|
|
136
|
+
{ name: "simulate_behavior_strategy", description: "Run the explicit structural dry-run for a persisted Behavior Strategy.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, strategyId: { type: "string" }, initialState: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "strategyId"] } },
|
|
137
|
+
{ name: "start_strategy_execution", description: "Start a persisted Strategy execution through the governed runtime boundary.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, behaviorPoint: { type: "string" }, executionBoundary: { type: "object" }, revisionId: { type: "string" }, idempotencyKey: { type: "string" }, nonce: { type: "string" }, expiresAt: { type: "number" }, decisionPlanId: { type: "string" }, candidates: { type: "array", items: { type: "object" } }, policy: { type: "string" }, allowedIds: { type: "array", items: { type: "string" } }, calibrationId: { type: "string" }, postModelJudge: { type: "object" }, shadow: { type: "object" }, artifactDigest: { type: "string" }, traceId: { type: "string" }, executionId: { type: "string" }, state: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "revisionId", "idempotencyKey", "nonce", "expiresAt", "decisionPlanId", "candidates", "policy", "artifactDigest"] } },
|
|
138
|
+
{ name: "get_strategy_execution", description: "Read one scoped Strategy execution.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
139
|
+
{ name: "get_strategy_execution_trace", description: "Read persisted Strategy step receipts and trace evidence.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
140
|
+
{ name: "get_ai_usage_reconciliation", description: "Read server-authorized Strategy provider request and rated-credit evidence for the active department. Read-only; does not create receipts, settle credits or approve a bill.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
141
|
+
{ name: "continue_strategy_execution", description: "Continue a waiting Strategy execution with the same pinned artifact, state, and external references.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" }, authorityDigest: { type: "string" }, state: { type: "object", additionalProperties: true }, references: { type: "object", additionalProperties: true } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
142
|
+
{ name: "cancel_strategy_execution", description: "Cancel a non-terminal scoped Strategy execution.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
143
|
+
{ name: "list_ai_systems", description: "Read AI Systems visible in the selected department with optional cursor pagination and search. Results include the canonical ownerUnitId and active consumingUnitGrants for Workspace Owners; grants do not replace active membership.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
144
|
+
{ name: "get_connection_health", description: "Read the latest health state for one AI System connection.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, connectionId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "connectionId"] } },
|
|
145
|
+
{ name: "list_connection_inventory", description: "Read capability inventory for one AI System in the authenticated scope.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, systemId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "systemId"] } },
|
|
146
|
+
{ name: "delete_ai_system", description: "Delete an unused scoped AI system after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, systemId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "systemId", "confirm"] } },
|
|
147
|
+
{ name: "delete_semantic_task", description: "Delete an unused scoped Semantic Task after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "taskId", "confirm"] } },
|
|
148
|
+
{ name: "delete_behavior_point", description: "Delete an unused scoped BehaviorPoint after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, pointId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "pointId", "confirm"] } },
|
|
149
|
+
{ name: "delete_behavior_strategy", description: "Delete a non-active unused scoped Behavior Strategy after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, strategyId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "strategyId", "confirm"] } },
|
|
150
|
+
{ name: "review_discovery_candidate", description: "Record a human review decision for a scoped discovery candidate.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, kind: { type: "string" }, key: { type: "string" }, decision: { type: "string" }, patch: { type: "object" }, payload: { type: "object", description: "Deprecated alias for patch; do not supply both." } }, required: ["organizationId", "projectId", "environmentId", "kind", "key", "decision"] } },
|
|
151
|
+
{ name: "create_observation", description: "Submit one scoped observation for discovery; it does not publish behavior.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, content: { type: "object" }, consent: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "id", "content", "consent"] } },
|
|
152
|
+
{ name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction. Supply a stable eventId so retries are idempotent.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
153
|
+
{ name: "record_business_outcome", description: "Record a scoped business outcome for an observed AI interaction. Supply a stable eventId so retries are idempotent.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
154
|
+
{ name: "observe", description: "Submit an observation using a stable eventId. conversation.output events derive the canonical eventId from conversationId and requestId so OpenCode and MCP retries share one identity.", effectful: true, inputSchema: { type: "object", properties: { event: { type: "object", required: ["type"] }, idempotencyKey: { type: "string" } }, required: ["event"] } },
|
|
155
|
+
{ name: "start_evaluation", description: "Start a scoped evaluation. Use assertions for a manual evaluation, or planId + evaluationPolicy + comparisonPlan for a provider-backed execution bound to a sealed evaluation plan. Optionally set aiSystemId (or targetArtifact.aiSystemId) to persist AI System attribution; the caller needs evaluation.write on that System.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, aiSystemId: { type: "string" }, planId: { type: "string" }, evaluationPolicy: { type: "object" }, comparisonPlan: { type: "object", properties: { arms: { type: "array", items: { type: "string" } } }, required: ["arms"] }, targetArtifact: { oneOf: [{ type: "string" }, { type: "object", properties: { aiSystemId: { type: "string" } }, additionalProperties: true }] }, dataset: { type: "array", items: { type: "object", additionalProperties: true } }, assertions: { type: "array", items: { type: "boolean" } }, threshold: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "id", "dataset"] } },
|
|
156
|
+
{ name: "create_evaluation_plan", description: "Create an immutable OFF/current-on evaluation plan for a scoped behavior target.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, suiteId: { type: "string" }, suiteVersion: { type: "string" }, suiteDigest: { type: "string" }, datasetSnapshotDigest: { type: "string" }, evaluationPolicyDigest: { type: "string" }, arms: { type: "array" } }, required: ["organizationId", "projectId", "environmentId", "id", "suiteId", "suiteVersion", "suiteDigest", "datasetSnapshotDigest", "evaluationPolicyDigest", "arms"] } },
|
|
157
|
+
{ name: "seal_evaluation_plan", description: "Seal an evaluation plan so its suite, dataset, and execution arms cannot drift.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, planId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "planId"] } },
|
|
158
|
+
{ name: "create_improvement_proposal", description: "Create a Teach improvement proposal from a completed comparative evaluation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evaluationId: { type: "string" }, id: { type: "string" }, basePackId: { type: "string" }, basePackDigest: { type: "string" }, behaviorSet: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "evaluationId", "id", "basePackId", "basePackDigest"] } },
|
|
159
|
+
{ name: "review_improvement_proposal", description: "Review a Teach improvement proposal without mutating canonical runtime state.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, proposalId: { type: "string" }, action: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "proposalId", "action"] } },
|
|
160
|
+
{ name: "create_behavior_revision_candidate", description: "Create an immutable behavior revision candidate from a reviewed Teach improvement proposal.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, sourceTeachProposalId: { type: "string" }, parentRevisionId: { type: "string" }, parentRevisionDigest: { type: "string" }, changeSet: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "id", "sourceTeachProposalId", "parentRevisionId", "parentRevisionDigest", "changeSet"] } },
|
|
161
|
+
{ name: "evaluate_behavior_revision_candidate", description: "Evaluate exactly one immutable Behavior Revision Candidate with provider-backed dataset assertions. It does not evaluate or release the parent Pack.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, candidateId: { type: "string" }, dataset: { type: "array", items: { type: "object", additionalProperties: true } }, assertions: { type: "array", items: { type: "boolean" } } }, required: ["organizationId", "projectId", "environmentId", "candidateId", "dataset"] } },
|
|
162
|
+
{ name: "accept_behavior_revision_candidate", description: "Accept a candidate only when a passed evaluation is bound to its immutable digest.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, candidateId: { type: "string" }, candidateEvaluationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "candidateId", "candidateEvaluationId"] } },
|
|
163
|
+
{ name: "create_pack_revision", description: "Create a draft Pack Revision from an accepted behavior candidate.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, packKey: { type: "string" }, version: { type: "string" }, behaviorRevisionCandidateId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "id", "packKey", "version", "behaviorRevisionCandidateId"] } },
|
|
164
|
+
{ name: "transition_pack_revision", description: "Validate, request approval, approve, or release a governed Pack Revision.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, revisionId: { type: "string" }, transition: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "revisionId", "transition"] } },
|
|
165
|
+
{ name: "materialize_pack_revision", description: "Materialize an approved Pack Revision into canonical runtime state.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, revisionId: { type: "string" }, packId: { type: "string" }, variables: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "revisionId", "packId"] } },
|
|
166
|
+
{ name: "get_pack_revision_diff", description: "Read the immutable lineage and change summary for a Pack Revision.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, revisionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "revisionId"] } },
|
|
167
|
+
{ name: "compile_behavior_capsule", description: "Compile a persisted scoped Behavior VM capsule and return its receipt.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, programId: { type: "string" }, input: { type: "string" }, selection: { type: "object" }, candidates: { type: "array" } }, required: ["organizationId", "projectId", "environmentId", "programId", "input"] } },
|
|
168
|
+
{ name: "serve_behavior_projection", description: "Serve the active scoped behavior projection through the governed runtime boundary.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, programId: { type: "string" }, input: { type: "string" }, provider: { type: "string" }, protocol: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "input", "provider"] } },
|
|
169
|
+
{ name: "list_packs", description: "Read scoped behavior packs with optional cursor pagination, status and search filters.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, status: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
170
|
+
{ name: "get_pack", description: "Read one scoped behavior pack, including manifest and materialization metadata.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "packId"] } },
|
|
171
|
+
{ name: "list_evaluations", description: "Read scoped evaluations with bounded pagination and optional status filter.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, status: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
172
|
+
{ name: "diagnose_pack", description: "Run Pack Doctor without materializing or releasing a pack.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" }, runtimeBindings: { type: "array", items: { type: "string" } }, knownVerifiers: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "packId"] } },
|
|
173
|
+
{ name: "import_pack", description: "Import and validate a scoped behavior pack.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, manifest: { type: "object" }, objects: { type: "object" }, archiveBase64: { type: "string" }, fileName: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "manifest"] } },
|
|
174
|
+
{ name: "install_pack", description: "Install a scoped behavior pack.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" }, variables: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "packId"] } },
|
|
175
|
+
{ name: "evaluate_pack", description: "Evaluate one imported/installed Pack in its Pack lifecycle with server-owned execution. Use before Pack approval/release; it is not the candidate evaluator.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" }, evaluation: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "packId", "evaluation"] } },
|
|
176
|
+
{ name: "approve_pack", description: "Approve a scoped behavior pack.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "packId"] } },
|
|
177
|
+
{ name: "release_pack", description: "Release a scoped behavior pack.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "packId"] } },
|
|
178
|
+
{ name: "preview_pack_upgrade", description: "Preview a scoped behavior pack upgrade.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, packId: { type: "string" }, incoming: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "packId", "incoming"] } },
|
|
179
|
+
{ name: "get_evaluation", description: "Read evaluation status, case results, receipts, and provenance.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evaluationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "evaluationId"] } },
|
|
180
|
+
{ name: "get_evaluation_comparison", description: "Read the arms, findings, and comparison for one evaluation.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evaluationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "evaluationId"] } }
|
|
181
|
+
]);
|
|
182
|
+
var MCP_PUBLIC_CORE_TOOL_NAMES = Object.freeze([
|
|
183
|
+
"get_scope",
|
|
184
|
+
"list_capabilities",
|
|
185
|
+
"list_organization_units",
|
|
186
|
+
"preview_organization_unit_archive",
|
|
187
|
+
"archive_organization_unit",
|
|
188
|
+
"list_ai_system_unit_grants",
|
|
189
|
+
"grant_ai_system_unit_access",
|
|
190
|
+
"revoke_ai_system_unit_access",
|
|
191
|
+
"list_organization_billing_admins",
|
|
192
|
+
"set_organization_billing_admin",
|
|
193
|
+
"get_ai_credit_wallet",
|
|
194
|
+
"list_ai_credit_budgets",
|
|
195
|
+
"reserve_ai_credits",
|
|
196
|
+
"release_ai_credit_reservation",
|
|
197
|
+
"list_ai_usage_receipts",
|
|
198
|
+
"get_ai_usage_summary",
|
|
199
|
+
"create_organization_unit",
|
|
200
|
+
"list_organization_unit_members",
|
|
201
|
+
"set_organization_unit_member",
|
|
202
|
+
"list_project_organization_units",
|
|
203
|
+
"bind_project_organization_unit",
|
|
204
|
+
"connect_ai_system",
|
|
205
|
+
"list_ai_systems",
|
|
206
|
+
"list_connection_inventory",
|
|
207
|
+
"get_connection_health",
|
|
208
|
+
"get_job",
|
|
209
|
+
"list_semantic_tasks",
|
|
210
|
+
"create_semantic_task",
|
|
211
|
+
"list_behavior_points",
|
|
212
|
+
"list_discovery_candidates",
|
|
213
|
+
"create_signal_discovery_proposal",
|
|
214
|
+
"review_signal_discovery_proposal",
|
|
215
|
+
"materialize_signal_discovery",
|
|
216
|
+
"create_signal_mapping",
|
|
217
|
+
"get_signal_mapping",
|
|
218
|
+
"review_signal_mapping",
|
|
219
|
+
"create_behavior_point",
|
|
220
|
+
"resolve_semantic",
|
|
221
|
+
"execute_managed_chat",
|
|
222
|
+
"resolve_task_run",
|
|
223
|
+
"start_task_run",
|
|
224
|
+
"list_compound_task_plans",
|
|
225
|
+
"save_compound_task_plan",
|
|
226
|
+
"get_compound_task_plan",
|
|
227
|
+
"get_task_run",
|
|
228
|
+
"get_task_run_evidence",
|
|
229
|
+
"queue_task_run_host_dispatch",
|
|
230
|
+
"list_task_run_events",
|
|
231
|
+
"continue_task_run",
|
|
232
|
+
"cancel_task_run",
|
|
233
|
+
"retry_task_run",
|
|
234
|
+
"resolve_runtime",
|
|
235
|
+
"create_observation",
|
|
236
|
+
"record_user_feedback",
|
|
237
|
+
"record_business_outcome",
|
|
238
|
+
"submit_teach_evidence",
|
|
239
|
+
"get_teach_behavior_set",
|
|
240
|
+
"create_teach_proposal",
|
|
241
|
+
"accept_teach_recommendation",
|
|
242
|
+
"start_evaluation",
|
|
243
|
+
"create_improvement_proposal",
|
|
244
|
+
"create_behavior_revision_candidate",
|
|
245
|
+
"evaluate_behavior_revision_candidate",
|
|
246
|
+
"accept_behavior_revision_candidate",
|
|
247
|
+
"create_pack_revision",
|
|
248
|
+
"transition_pack_revision",
|
|
249
|
+
"materialize_pack_revision",
|
|
250
|
+
"get_pack_revision_diff",
|
|
251
|
+
"import_pack",
|
|
252
|
+
"install_pack",
|
|
253
|
+
"evaluate_pack",
|
|
254
|
+
"approve_pack",
|
|
255
|
+
"release_pack",
|
|
256
|
+
"create_release",
|
|
257
|
+
"retire_program_pointer",
|
|
258
|
+
"serve_behavior_projection",
|
|
259
|
+
"list_behavior_strategies",
|
|
260
|
+
"get_behavior_strategy",
|
|
261
|
+
"simulate_behavior_strategy",
|
|
262
|
+
"list_packs",
|
|
263
|
+
"get_pack",
|
|
264
|
+
"list_evaluations",
|
|
265
|
+
"get_strategy_execution_trace",
|
|
266
|
+
"get_ai_usage_reconciliation",
|
|
267
|
+
"continue_strategy_execution",
|
|
268
|
+
"list_inbox",
|
|
269
|
+
"list_notification_destinations",
|
|
270
|
+
"create_notification_destination",
|
|
271
|
+
"revoke_notification_destination",
|
|
272
|
+
"mark_inbox_read",
|
|
273
|
+
"inspect_conflicts",
|
|
274
|
+
"get_conflict_inspection",
|
|
275
|
+
"resolve_conflict",
|
|
276
|
+
"review_discovery_candidate",
|
|
277
|
+
"diagnose_pack",
|
|
278
|
+
"get_evaluation",
|
|
279
|
+
"get_evaluation_comparison"
|
|
280
|
+
]);
|
|
281
|
+
var controlApiRequestProperties = {
|
|
282
|
+
organizationId: { type: "string" },
|
|
283
|
+
projectId: { type: "string" },
|
|
284
|
+
environmentId: { type: "string" },
|
|
285
|
+
path: { type: "string", description: "Registered Control API path; unregistered paths and methods are rejected." },
|
|
286
|
+
method: { type: "string", enum: ["POST", "PUT", "PATCH", "DELETE"] },
|
|
287
|
+
pathParams: { type: "object", additionalProperties: { type: "string" } },
|
|
288
|
+
query: { type: "object", additionalProperties: true },
|
|
289
|
+
body: { type: "object", additionalProperties: true },
|
|
290
|
+
idempotencyKey: { type: "string" }
|
|
291
|
+
};
|
|
292
|
+
var genericControlTools = Object.freeze([
|
|
293
|
+
{ name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: { type: "object", additionalProperties: false, properties: controlApiRequestProperties, required: ["organizationId", "projectId", "environmentId", "path"] } },
|
|
294
|
+
{ name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", effectful: true, inputSchema: { type: "object", additionalProperties: false, properties: controlApiRequestProperties, required: ["organizationId", "projectId", "environmentId", "path", "body"] } }
|
|
295
|
+
]);
|
|
296
|
+
var parameterDescription = (toolName, name) => {
|
|
297
|
+
if (name === "organizationId" || name === "projectId" || name === "environmentId") return "Authenticated customer scope identifier; must match the API key scope and is never inferred from model text.";
|
|
298
|
+
if (name.endsWith("Id") || name.endsWith("Key") || name.endsWith("Digest")) return `Immutable ${name} reference used to bind this ${toolName} operation to the correct released or persisted resource.`;
|
|
299
|
+
if (name === "actorId" || name === "ownerActorRef") return "Actor identity for the authorized customer action; do not use a service or Vira-internal identity.";
|
|
300
|
+
if (name === "input") return "The end-user request or runtime input that Vira must resolve, execute, or evaluate.";
|
|
301
|
+
if (name === "expectedVersion") return "Current persisted lifecycle version; required for optimistic concurrency and must be read immediately before the transition.";
|
|
302
|
+
if (name === "decision" || name === "transition") return "Explicit lifecycle decision requested by the authorized reviewer; invalid or out-of-order transitions fail closed.";
|
|
303
|
+
if (name === "manifest" || name === "objects" || name === "evaluation") return `Structured ${name} payload validated against the published contract; caller-supplied scores or authority signals are not trusted.`;
|
|
304
|
+
return `Documented ${name} input for ${toolName}; use the published type and keep customer data within the authenticated scope.`;
|
|
305
|
+
};
|
|
306
|
+
var normalizeJsonSchema = (value) => {
|
|
307
|
+
if (Array.isArray(value)) return value.map(normalizeJsonSchema);
|
|
308
|
+
if (!value || typeof value !== "object") return value;
|
|
309
|
+
const record2 = value;
|
|
310
|
+
const normalized = Object.fromEntries(Object.entries(record2).map(([key, item]) => [key, normalizeJsonSchema(item)]));
|
|
311
|
+
if (normalized.additionalProperties === true) normalized.additionalProperties = {};
|
|
312
|
+
if (normalized.type === "object" && !Object.hasOwn(normalized, "properties")) normalized.properties = {};
|
|
313
|
+
if (normalized.type === "object" && !Object.hasOwn(normalized, "additionalProperties")) normalized.additionalProperties = {};
|
|
314
|
+
return normalized;
|
|
315
|
+
};
|
|
316
|
+
var describeInput = (toolName, inputSchema) => {
|
|
317
|
+
const properties = inputSchema.properties && typeof inputSchema.properties === "object" ? inputSchema.properties : {};
|
|
318
|
+
const described = Object.fromEntries(Object.entries(properties).map(([name, property]) => [name, { ...property, description: typeof property.description === "string" && property.description.trim() ? property.description : parameterDescription(toolName, name) }]));
|
|
319
|
+
const required2 = Array.isArray(inputSchema.required) ? inputSchema.required.map(String).filter((name) => !["organizationId", "projectId", "environmentId"].includes(name)) : void 0;
|
|
320
|
+
const result = { ...inputSchema, $schema: "https://json-schema.org/draft/2020-12/schema", additionalProperties: false, properties: described };
|
|
321
|
+
if (required2?.length) result.required = required2;
|
|
322
|
+
else delete result.required;
|
|
323
|
+
return normalizeJsonSchema(result);
|
|
324
|
+
};
|
|
325
|
+
var requiredInputs = (tool) => Array.isArray(tool.inputSchema.required) ? (tool.inputSchema.required ?? []).map(String) : [];
|
|
326
|
+
var lifecycleGuidance = {
|
|
327
|
+
create_behavior_point: "Use after a Semantic Task exists to attach one canonical behavior authority. Provide either taskId or taskIds, not both; use create_behavior_program for executable rules.",
|
|
328
|
+
create_semantic_task: "Use to author a new intent definition with aliases, positive examples, and negative examples. It creates a draft; it does not classify input or publish behavior.",
|
|
329
|
+
list_semantic_tasks: "Use before authoring or routing to inspect the registered intent catalog. Prefer list_behavior_points when you need behavior authorities.",
|
|
330
|
+
list_behavior_points: "Use to inspect canonical BehaviorPoints and their task links. Prefer get_behavior_strategy for strategy details and resolve_runtime only after choosing one point.",
|
|
331
|
+
list_capabilities: "Use before a write or runtime call to check what this credential can access on a public surface; it never grants capability.",
|
|
332
|
+
import_pack: "Use to validate and create a Pack draft. It does not install or release; continue with install_pack, evaluate_pack, approve_pack, then release_pack.",
|
|
333
|
+
get_pack: "Use to inspect one Pack manifest, digest, status, conflicts, and materialization metadata. It is read-only.",
|
|
334
|
+
list_packs: "Use to find scoped Pack drafts and releases; use get_pack for one Pack\u2019s full detail.",
|
|
335
|
+
list_evaluations: "Use to inspect evaluation records and statuses; use start_evaluation to run one and get_evaluation for full provenance.",
|
|
336
|
+
get_evaluation: "Use to read one evaluation\u2019s status, provenance, score, and receipts; it never starts or approves an evaluation.",
|
|
337
|
+
retire_program_pointer: "RETIRE ACTIVE POINTER: first inspect the current pointer and version, then retire only the exact pointer version reviewed by the human. This removes the active pointer but preserves retirement history; it cannot be undone through this operation. Requires release.approve and explicit confirm=true.",
|
|
338
|
+
mark_inbox_read: "Use after list_inbox returns a notificationId that the current actor has reviewed. On success the notification is marked read; repeated calls for the same notification are safe and do not create a new notification.",
|
|
339
|
+
serve_behavior_projection: "RUNTIME PROJECTION: use after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. The response contains the projected behavior and an execution receipt. Do not use this tool for authoring, classification, candidate evaluation, model calls, or host actions; it does not call the model or execute tools. Use compile_behavior_capsule for pre-model context, resolve_runtime/executeRuntime for enforcement, and evaluate_behavior_revision_candidate for unreleased candidate testing."
|
|
340
|
+
};
|
|
341
|
+
var enrichTool = (tool) => {
|
|
342
|
+
const required2 = requiredInputs(tool);
|
|
343
|
+
const guidance = lifecycleGuidance[tool.name] ?? (tool.effectful ? "Use only after the preceding resource and authority prerequisites are satisfied; inspect the server receipt before continuing." : "Use to read the scoped resource; use its create, execute, or transition sibling for state changes.");
|
|
344
|
+
const contract = required2.length ? `Required fields: ${required2.join(", ")}.` : "No fields are required unless supplied by the schema.";
|
|
345
|
+
const scope2 = "The authenticated MCP session supplies the tenant scope; all supplied scope identifiers must match it. Unknown fields are rejected.";
|
|
346
|
+
const state = tool.effectful ? "This changes governed state and remains fail-closed behind server authorization and an auditable receipt." : "This is read-only and returns scope-bound data.";
|
|
347
|
+
return { ...tool, description: `${(tool.description ?? "Vira MCP operation").trim()} ${guidance} ${contract} ${scope2} ${state}`, annotations: { title: tool.name, readOnlyHint: !tool.effectful, destructiveHint: tool.effectful === true && /delete|revoke|cancel|retire/.test(tool.name), idempotentHint: /^(get|list|resolve|diagnose|inspect|preview|simulate|search|test)_/.test(tool.name), openWorldHint: false }, inputSchema: describeInput(tool.name, tool.inputSchema) };
|
|
348
|
+
};
|
|
349
|
+
var descriptionOverrides = {
|
|
350
|
+
create_behavior_point: "AUTHORING: attach a canonical BehaviorPoint to an existing Semantic Task. Supply either taskId or taskIds; constraints define the policy boundary. Use create_behavior_program for executable rules and do not use this tool to publish a Pack.",
|
|
351
|
+
create_semantic_task: "AUTHORING: register a Semantic Task with aliases, positive examples, and negative examples for governed routing. It creates a draft; it does not classify input or publish behavior.",
|
|
352
|
+
list_semantic_tasks: "CATALOG READ: inspect registered Semantic Tasks before authoring or routing. limit, cursor, and search are optional. Use resolve_semantic to classify an actual request.",
|
|
353
|
+
list_ai_systems: "AI SYSTEM READ: list AI Systems connected in the authenticated scope. Use before creating a connection or to find a system to inspect; use get_connection_health and list_connection_inventory for connection diagnostics.",
|
|
354
|
+
list_behavior_points: "AUTHORITY READ: inspect canonical BehaviorPoints and task links. Pagination and search are optional. Use resolve_runtime only after selecting one point.",
|
|
355
|
+
list_capabilities: "ACCESS READ: use before a write, runtime, or lifecycle call to inspect this credential\u2019s allowed capabilities. Omit surface to receive the full scoped report; provide surface to filter it. The result lists permitted operations/roles and public surfaces, never grants authority, and get_scope is the alternative when you only need tenant identity.",
|
|
356
|
+
import_pack: "PACK AUTHORING: validate and create a Pack draft from a manifest or archive. Only manifest plus authenticated scope are required; objects/archiveBase64/fileName are alternatives. Continue install \u2192 evaluate \u2192 approve \u2192 release.",
|
|
357
|
+
list_packs: "PACK READ: find scoped Pack drafts and releases. Pagination, status, and search are optional; use get_pack for full detail and never infer release from list membership alone.",
|
|
358
|
+
get_pack: "PACK DETAIL READ: inspect one Pack\u2019s canonical manifest, digest, status, conflicts, and materialization metadata. Read-only; it never installs, evaluates, approves, or releases.",
|
|
359
|
+
list_evaluations: "EVALUATION READ: list scoped evaluation records. Pagination and status are optional; use start_evaluation to run one and get_evaluation for full provenance.",
|
|
360
|
+
mark_inbox_read: "REVIEW STATE: mark one notification returned by list_inbox as read after the actor has reviewed it. Required: notificationId. Success changes only that notification\u2019s read state; repeated calls are safe. Use list_inbox first to discover IDs.",
|
|
361
|
+
serve_behavior_projection: "RUNTIME PROJECTION: use after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. Required: input and provider; programId is optional when the active pointer is unambiguous. Do not use this tool for authoring, classification, candidate evaluation, model calls, or host actions; it does not call the model or execute tools. Use compile_behavior_capsule for pre-model context, resolve_runtime/executeRuntime for enforcement, and evaluate_behavior_revision_candidate for unreleased candidate testing.",
|
|
362
|
+
resolve_semantic: "ROUTING 1/3: classify input into registered Semantic Tasks and intent candidates. It never resolves runtime authority or executes; follow with resolve_runtime for one BehaviorPoint or resolve_task_run for AUTO/multi-task planning.",
|
|
363
|
+
resolve_runtime: "ROUTING 2/3: resolve one already-selected BehaviorPoint into released runtime authority. It does not classify text or execute; use resolve_task_run/start_task_run for TaskRun execution.",
|
|
364
|
+
resolve_task_run: "ROUTING 2/3 FOR TASKRUN: preview server-owned AUTO mode and the SINGLE/STRATEGY/COMPOUND/HYBRID child plan. It never executes; call start_task_run after inspection.",
|
|
365
|
+
start_evaluation: "EVALUATION ENTRYPOINT: start a standalone dataset/evaluation-plan run, including comparative execution. Use evaluate_pack for an imported Pack and evaluate_behavior_revision_candidate for one immutable candidate.",
|
|
366
|
+
evaluate_pack: "PACK LIFECYCLE EVALUATION: evaluate one imported/installed Pack before approve_pack/release_pack. It is not start_evaluation and not evaluate_behavior_revision_candidate.",
|
|
367
|
+
evaluate_behavior_revision_candidate: "CANDIDATE EVALUATION ONLY: execute a real dataset against exactly one immutable candidate. It does not evaluate/release the parent Pack or grant human approval.",
|
|
368
|
+
approve_pack: "PACK APPROVAL: record human approval for a passed imported/installed Pack evaluation; use before release_pack. For a Pack Revision use transition_pack_revision approve.",
|
|
369
|
+
release_pack: "PACK FINAL STEP: release an already evaluated and approved imported/installed Pack. For a Pack Revision use transition_pack_revision release.",
|
|
370
|
+
transition_pack_revision: "PACK REVISION STATE MACHINE: validate, request approval, approve, release, or reject a Pack Revision. Do not substitute approve_pack/release_pack; those operate on imported Pack records."
|
|
371
|
+
};
|
|
372
|
+
var MCP_TOOL_OUTPUT_CONTRACT = Object.freeze({ $schema: "https://json-schema.org/draft/2020-12/schema", type: "object", additionalProperties: false, properties: { result: {} }, required: ["result"] });
|
|
373
|
+
var MCP_PUBLIC_TOOL_CATALOG = Object.freeze([...coreTools.filter((tool) => MCP_PUBLIC_CORE_TOOL_NAMES.includes(tool.name)), ...genericControlTools].map((tool) => {
|
|
374
|
+
const authority = getMcpToolAuthority(tool.name);
|
|
375
|
+
if (!authority) throw new Error("MCP_TOOL_AUTHORITY_MISSING");
|
|
376
|
+
const canonical = { ...tool, effectful: authority.effectType === "effectful", outputSchema: MCP_TOOL_OUTPUT_CONTRACT };
|
|
377
|
+
const enriched = enrichTool(canonical);
|
|
378
|
+
return descriptionOverrides[tool.name] ? { ...enriched, description: descriptionOverrides[tool.name] } : enriched;
|
|
379
|
+
}));
|
|
380
|
+
var catalogNames = MCP_PUBLIC_TOOL_CATALOG.map((tool) => tool.name);
|
|
381
|
+
if (new Set(catalogNames).size !== catalogNames.length || catalogNames.some((name) => !getMcpToolAuthority(name))) throw new Error("MCP_PUBLIC_TOOL_CATALOG_INVALID");
|
|
382
|
+
function assertMcpToolScope(input2, scope2, errorCode = "MCP_SCOPE_MISMATCH") {
|
|
383
|
+
const fields = ["organizationId", "projectId", "environmentId", "organizationUnitId"];
|
|
384
|
+
const assertRecord = (value) => {
|
|
385
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
386
|
+
for (const key of fields) {
|
|
387
|
+
const supplied = value[key];
|
|
388
|
+
if (supplied !== void 0 && supplied !== scope2[key]) throw new Error(errorCode);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
assertRecord(input2);
|
|
392
|
+
assertRecord(input2.query);
|
|
393
|
+
assertRecord(input2.body);
|
|
394
|
+
}
|
|
395
|
+
function unwrapMcpClientResponse(value) {
|
|
396
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
397
|
+
const response = value;
|
|
398
|
+
if (Number.isInteger(response.status) && typeof response.requestId === "string" && Object.hasOwn(response, "body")) return response.body;
|
|
399
|
+
}
|
|
400
|
+
return value;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/taskrun-host-dispatch.ts
|
|
404
|
+
var id = (v) => typeof v === "string" && v.length > 0 && v.length <= 500 && v === v.trim();
|
|
405
|
+
var obj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
406
|
+
function buildMcpTaskRunHostDispatch(args, scope2) {
|
|
407
|
+
if (![scope2.organizationId, scope2.projectId, scope2.environmentId, scope2.organizationUnitId, args.taskRunId, args.childRunId, args.aiSystemId, args.sessionId, args.approvalId].every(id)) throw Error("MCP_SINGLE_HOST_DISPATCH_REQUIRED");
|
|
408
|
+
if (args.organizationUnitId !== void 0 && args.organizationUnitId !== scope2.organizationUnitId) throw Error("MCP_SCOPE_MISMATCH");
|
|
409
|
+
const context = args.context, proposal = args.proposal;
|
|
410
|
+
if (!obj(context) || !obj(proposal) || !id(context.execution_id) || !context.execution_id.startsWith("runtime:taskrun:") || !id(context.data_version) || !id(proposal.proposal_id)) throw Error("MCP_SINGLE_HOST_CONTEXT_INVALID");
|
|
411
|
+
return { executionId: context.execution_id, dataVersion: context.data_version, sessionId: args.sessionId, aiSystemId: args.aiSystemId, scope: { ...scope2 }, context, proposal, approval: { approvalId: args.approvalId }, taskRunDispatch: { taskRunId: args.taskRunId, childRunId: args.childRunId } };
|
|
412
|
+
}
|
|
413
|
+
function assertMcpTaskRunHostQueued(value) {
|
|
414
|
+
if (!obj(value) || value.status !== "QUEUED" || value.clientExecutionAllowed !== false || !id(value.invocationId) || !/^single-host:[a-f0-9]{64}$/.test(value.invocationId) || Object.hasOwn(value, "allowed")) throw Error("MCP_SINGLE_HOST_QUEUE_PROOF_REQUIRED");
|
|
415
|
+
return { status: "QUEUED", invocationId: value.invocationId, clientExecutionAllowed: false };
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// ../../contracts/observation-event-identity.ts
|
|
419
|
+
function requiredIdentityPart(value, code) {
|
|
420
|
+
if (typeof value !== "string" || !value.trim() || value !== value.trim()) throw new Error(code);
|
|
421
|
+
return value;
|
|
422
|
+
}
|
|
423
|
+
function createConversationOutputObservationIdentity(input2) {
|
|
424
|
+
const conversationId = requiredIdentityPart(input2.conversationId, "CONVERSATION_ID_REQUIRED");
|
|
425
|
+
const requestId = requiredIdentityPart(input2.requestId, "CONVERSATION_REQUEST_ID_REQUIRED");
|
|
426
|
+
const eventId = `${conversationId}:assistant:${requestId}`;
|
|
427
|
+
return Object.freeze({ conversationId, requestId, eventId, idempotencyKey: `conversation.output:${eventId}` });
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ../../contracts/external-host-commercial-v1.ts
|
|
431
|
+
var externalHostCommercialEvidence = Object.freeze({
|
|
432
|
+
schemaVersion: 1,
|
|
433
|
+
chargeClass: "byok",
|
|
434
|
+
authority: "HOST_REPORTED_UNVERIFIED",
|
|
435
|
+
settlementStatus: "NOT_CHARGEABLE",
|
|
436
|
+
managedCreditEligible: false
|
|
437
|
+
});
|
|
438
|
+
var meteringEvents = /* @__PURE__ */ new Set([
|
|
439
|
+
"model.request",
|
|
440
|
+
"model.response",
|
|
441
|
+
"cost",
|
|
442
|
+
"latency"
|
|
443
|
+
]);
|
|
444
|
+
var forbiddenClaims = /* @__PURE__ */ new Set([
|
|
445
|
+
"billingAccountId",
|
|
446
|
+
"customerMicrocredits",
|
|
447
|
+
"managedMicrocredits",
|
|
448
|
+
"chargeClass",
|
|
449
|
+
"managedCreditEligible",
|
|
450
|
+
"settlementStatus",
|
|
451
|
+
"reconciliationStatus",
|
|
452
|
+
"receiptSetAttested",
|
|
453
|
+
"reservationId",
|
|
454
|
+
"usageReceiptId",
|
|
455
|
+
"creditStatus",
|
|
456
|
+
"ratedMicrocredits",
|
|
457
|
+
"settledCustomerMicrocredits",
|
|
458
|
+
"providerCostMinor",
|
|
459
|
+
"creditReservationId",
|
|
460
|
+
"creditSettlementId",
|
|
461
|
+
"creditLedgerEntryId",
|
|
462
|
+
"credit",
|
|
463
|
+
"settlement",
|
|
464
|
+
"rateCard",
|
|
465
|
+
"rateCardId",
|
|
466
|
+
"rating",
|
|
467
|
+
"ratedReceipt",
|
|
468
|
+
"ratedReceiptId",
|
|
469
|
+
"providerBillingProof",
|
|
470
|
+
"independentProviderProof",
|
|
471
|
+
"providerEvidence"
|
|
472
|
+
]);
|
|
473
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
474
|
+
function normalizeExternalHostCommercialPayload(eventType, value) {
|
|
475
|
+
if (!meteringEvents.has(eventType)) return value;
|
|
476
|
+
if (!record(value)) throw new Error("EXTERNAL_HOST_METERING_PAYLOAD_INVALID");
|
|
477
|
+
for (const key of forbiddenClaims) {
|
|
478
|
+
if (Object.prototype.hasOwnProperty.call(value, key))
|
|
479
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
480
|
+
}
|
|
481
|
+
const supplied = value.commercial;
|
|
482
|
+
if (supplied !== void 0 && (!record(supplied) || Object.keys(supplied).length !== Object.keys(externalHostCommercialEvidence).length || Object.entries(externalHostCommercialEvidence).some(([key, expected]) => supplied[key] !== expected)))
|
|
483
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
484
|
+
const model = value.model;
|
|
485
|
+
if (record(model) && [...forbiddenClaims].some((key) => Object.prototype.hasOwnProperty.call(model, key)))
|
|
486
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
487
|
+
return { ...value, commercial: externalHostCommercialEvidence };
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// src/observation.ts
|
|
491
|
+
function normalizeMcpObservationEvent(value) {
|
|
492
|
+
if (value.eventType !== "conversation.output") {
|
|
493
|
+
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
494
|
+
if (!eventId) throw new Error("MCP_OBSERVATION_EVENT_ID_REQUIRED");
|
|
495
|
+
const classified = normalizeExternalHostCommercialPayload(String(value.eventType), value.payload ?? {});
|
|
496
|
+
return { event: classified === value.payload ? value : { ...value, payload: classified }, idempotencyKey: eventId };
|
|
497
|
+
}
|
|
498
|
+
if (value.conversationId === void 0 && value.requestId === void 0) {
|
|
499
|
+
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
500
|
+
if (!eventId) throw new Error("MCP_OBSERVATION_EVENT_ID_REQUIRED");
|
|
501
|
+
const classified = normalizeExternalHostCommercialPayload(String(value.eventType), value.payload ?? {});
|
|
502
|
+
return { event: classified === value.payload ? value : { ...value, payload: classified }, idempotencyKey: eventId };
|
|
503
|
+
}
|
|
504
|
+
const identity = createConversationOutputObservationIdentity({ conversationId: value.conversationId, requestId: value.requestId });
|
|
505
|
+
if (value.eventId !== void 0 && value.eventId !== identity.eventId) throw new Error("MCP_CONVERSATION_OUTPUT_EVENT_ID_MISMATCH");
|
|
506
|
+
return { event: { ...value, eventId: identity.eventId }, idempotencyKey: identity.idempotencyKey };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/authority-request.ts
|
|
510
|
+
import { randomUUID } from "node:crypto";
|
|
511
|
+
function newMcpAuthorizationKey(tool) {
|
|
512
|
+
if (typeof tool !== "string" || !/^[a-z][a-z0-9_]{0,127}$/.test(tool)) throw new Error("MCP_AUTHORITY_TOOL_INVALID");
|
|
513
|
+
return "mcp:authorize:" + tool + ":" + randomUUID();
|
|
514
|
+
}
|
|
515
|
+
function newMcpMutationKey(tool) {
|
|
516
|
+
if (typeof tool !== "string" || !/^[a-z][a-z0-9_]{0,127}$/.test(tool)) throw new Error("MCP_MUTATION_TOOL_INVALID");
|
|
517
|
+
return "mcp:execute:" + tool + ":" + randomUUID();
|
|
518
|
+
}
|
|
519
|
+
function sanitizeMcpAuthorityArguments(tool, args) {
|
|
520
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) throw new Error("MCP_AUTHORITY_ARGUMENTS_INVALID");
|
|
521
|
+
if (tool === "create_notification_destination" && typeof args.endpoint === "string") return { ...args, endpoint: "[REDACTED]" };
|
|
522
|
+
if (tool === "queue_task_run_host_dispatch") return Object.fromEntries(Object.entries(args).filter(([key]) => !["approvalId", "context", "proposal", "sessionId"].includes(key)));
|
|
523
|
+
return { ...args };
|
|
524
|
+
}
|
|
525
|
+
function assertMcpAuthorityDecisionReceipt(value) {
|
|
526
|
+
if (value?.allowed !== true) throw new Error(
|
|
527
|
+
typeof value?.reason === "string" && value.reason.trim() ? value.reason : "MCP_AUTHORITY_DENIED"
|
|
528
|
+
);
|
|
529
|
+
if (typeof value.decisionDigest !== "string" || !/^[a-f0-9]{64}$/.test(value.decisionDigest))
|
|
530
|
+
throw new Error("MCP_AUTHORITY_DECISION_DIGEST_MISSING");
|
|
531
|
+
return value.decisionDigest;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// src/control-operation-boundary.ts
|
|
535
|
+
var REGISTERED_MCP_CONTROL_OPERATIONS = Object.freeze([
|
|
536
|
+
"DELETE /v1/ai-systems/{systemId}/unit-grants/{unitId}",
|
|
537
|
+
"DELETE /v1/behavior-points/{pointId}",
|
|
538
|
+
"DELETE /v1/behavior-programs/{programId}/cascade",
|
|
539
|
+
"DELETE /v1/semantic-tasks/{taskId}",
|
|
540
|
+
"GET /v1/ai-systems",
|
|
541
|
+
"GET /v1/ai-systems/{systemId}",
|
|
542
|
+
"GET /v1/ai-systems/{systemId}/clone-cutover/route",
|
|
543
|
+
"GET /v1/ai-systems/{systemId}/clone-cutover/route/live",
|
|
544
|
+
"GET /v1/ai-systems/{systemId}/connections",
|
|
545
|
+
"GET /v1/ai-systems/{systemId}/inventory",
|
|
546
|
+
"GET /v1/ai-systems/{systemId}/ownership-transfer/readiness",
|
|
547
|
+
"GET /v1/ai-systems/{systemId}/unit-grants",
|
|
548
|
+
"GET /v1/behavior-improvement-proposals/{proposalId}",
|
|
549
|
+
"GET /v1/behavior-points",
|
|
550
|
+
"GET /v1/behavior-policy-bindings/current",
|
|
551
|
+
"GET /v1/behavior-policy-sources",
|
|
552
|
+
"GET /v1/behavior-policy-sources/{sourceRevisionId}",
|
|
553
|
+
"GET /v1/behavior-programs",
|
|
554
|
+
"GET /v1/behavior-programs/{programId}",
|
|
555
|
+
"GET /v1/behavior-strategies",
|
|
556
|
+
"GET /v1/behavior-strategies/{strategyId}",
|
|
557
|
+
"GET /v1/billing/ai-usage",
|
|
558
|
+
"GET /v1/billing/ai-usage/summary",
|
|
559
|
+
"GET /v1/billing/credits",
|
|
560
|
+
"GET /v1/billing/credits/budgets",
|
|
561
|
+
"GET /v1/capabilities",
|
|
562
|
+
"GET /v1/compound-tasks/plans",
|
|
563
|
+
"GET /v1/compound-tasks/plans/{planId}",
|
|
564
|
+
"GET /v1/conflicts/{inspectionId}",
|
|
565
|
+
"GET /v1/connections/{connectionId}",
|
|
566
|
+
"GET /v1/connections/{connectionId}/health",
|
|
567
|
+
"GET /v1/discovery/candidates",
|
|
568
|
+
"GET /v1/evaluations",
|
|
569
|
+
"GET /v1/evaluations/{evaluationId}",
|
|
570
|
+
"GET /v1/jobs/{jobId}",
|
|
571
|
+
"GET /v1/notification-destinations",
|
|
572
|
+
"GET /v1/notifications/inbox",
|
|
573
|
+
"GET /v1/observations/backfills/{backfillId}/history",
|
|
574
|
+
"GET /v1/observations/backfills/{backfillId}/readiness",
|
|
575
|
+
"GET /v1/observations/trajectories/{trajectoryKey}/runtime-evidence",
|
|
576
|
+
"GET /v1/optimization/runs/{runId}",
|
|
577
|
+
"GET /v1/organization-units",
|
|
578
|
+
"GET /v1/organization-units/{unitId}/members",
|
|
579
|
+
"GET /v1/organization/billing-admins",
|
|
580
|
+
"GET /v1/packs",
|
|
581
|
+
"GET /v1/packs/{packId}",
|
|
582
|
+
"GET /v1/projects/{projectId}/organization-units",
|
|
583
|
+
"GET /v1/runtime/strategy-executions",
|
|
584
|
+
"GET /v1/runtime/strategy-executions/{executionId}",
|
|
585
|
+
"GET /v1/runtime/strategy-executions/{executionId}/credit-reconciliation",
|
|
586
|
+
"GET /v1/runtime/strategy-executions/{executionId}/trace",
|
|
587
|
+
"GET /v1/runtime/traces/search",
|
|
588
|
+
"GET /v1/semantic-tasks",
|
|
589
|
+
"GET /v1/signals/mappings/{id}",
|
|
590
|
+
"GET /v1/task-runs/{taskRunId}",
|
|
591
|
+
"GET /v1/task-runs/{taskRunId}/events",
|
|
592
|
+
"GET /v1/task-runs/{taskRunId}/evidence",
|
|
593
|
+
"GET /v1/teach/analyses",
|
|
594
|
+
"GET /v1/teach/analyses/{analysisId}",
|
|
595
|
+
"GET /v1/teach/conversations",
|
|
596
|
+
"GET /v1/teach/runs",
|
|
597
|
+
"GET /v1/teach/runs/{teachRunId}/behavior-set",
|
|
598
|
+
"GET /v1/teach/runs/{teachRunId}/recommendation",
|
|
599
|
+
"POST /v1/ai-systems",
|
|
600
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/accept",
|
|
601
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/prepare",
|
|
602
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/readiness",
|
|
603
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/accept",
|
|
604
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/admission",
|
|
605
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/behavior",
|
|
606
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/drain",
|
|
607
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/drain/cases",
|
|
608
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/accept",
|
|
609
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/activate",
|
|
610
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/rollback",
|
|
611
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/rollback/accept",
|
|
612
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/probe",
|
|
613
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/reconcile/host",
|
|
614
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/reconcile/probe-release",
|
|
615
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/stage",
|
|
616
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/withdraw",
|
|
617
|
+
"POST /v1/ai-systems/{systemId}/connections",
|
|
618
|
+
"POST /v1/ai-systems/{systemId}/ownership-transfer/accept",
|
|
619
|
+
"POST /v1/ai-systems/{systemId}/ownership-transfer/commit",
|
|
620
|
+
"POST /v1/ai-systems/{systemId}/unit-grants",
|
|
621
|
+
"POST /v1/behavior-improvement-proposals/{proposalId}",
|
|
622
|
+
"POST /v1/behavior-points",
|
|
623
|
+
"POST /v1/behavior-policy-bindings/commit",
|
|
624
|
+
"POST /v1/behavior-policy-bindings/commit-wide",
|
|
625
|
+
"POST /v1/behavior-policy-bindings/impact",
|
|
626
|
+
"POST /v1/behavior-policy-bindings/preview",
|
|
627
|
+
"POST /v1/behavior-policy-sources",
|
|
628
|
+
"POST /v1/behavior-programs",
|
|
629
|
+
"POST /v1/behavior-revision-candidates",
|
|
630
|
+
"POST /v1/behavior-strategies",
|
|
631
|
+
"POST /v1/behavior-strategies/{strategyId}/simulate",
|
|
632
|
+
"POST /v1/behavior-strategies/{strategyId}/validate",
|
|
633
|
+
"POST /v1/behavior-strategies/{strategyId}/variants",
|
|
634
|
+
"POST /v1/billing/credits/reservations",
|
|
635
|
+
"POST /v1/billing/credits/reservations/{reservationId}/release",
|
|
636
|
+
"POST /v1/compound-tasks/plans",
|
|
637
|
+
"POST /v1/conflicts/inspect",
|
|
638
|
+
"POST /v1/conflicts/{inspectionId}/resolve",
|
|
639
|
+
"POST /v1/connections/{connectionId}/test",
|
|
640
|
+
"POST /v1/discovery/candidates/{kind}/{key}/publish",
|
|
641
|
+
"POST /v1/discovery/candidates/{kind}/{key}/review",
|
|
642
|
+
"POST /v1/evaluation-plans",
|
|
643
|
+
"POST /v1/evaluations",
|
|
644
|
+
"POST /v1/evaluations/{evaluationId}/improvement-proposal",
|
|
645
|
+
"POST /v1/model-serving/resolve",
|
|
646
|
+
"POST /v1/model-serving/traces",
|
|
647
|
+
"POST /v1/notification-destinations",
|
|
648
|
+
"POST /v1/notification-destinations/{destinationId}/revoke",
|
|
649
|
+
"POST /v1/notifications/{notificationId}/read",
|
|
650
|
+
"POST /v1/observations",
|
|
651
|
+
"POST /v1/observations/batch",
|
|
652
|
+
"POST /v1/observations/sdk",
|
|
653
|
+
"POST /v1/optimization/execute",
|
|
654
|
+
"POST /v1/optimization/runs/{runId}/cancel",
|
|
655
|
+
"POST /v1/organization-units",
|
|
656
|
+
"POST /v1/organization-units/{unitId}/archive",
|
|
657
|
+
"POST /v1/organization-units/{unitId}/archive-preview",
|
|
658
|
+
"POST /v1/organization-units/{unitId}/members/{actorId}",
|
|
659
|
+
"POST /v1/organization/billing-admins/{actorId}",
|
|
660
|
+
"POST /v1/pack-revisions",
|
|
661
|
+
"POST /v1/packs/import",
|
|
662
|
+
"POST /v1/packs/{packId}/evaluate",
|
|
663
|
+
"POST /v1/packs/{packId}/install",
|
|
664
|
+
"POST /v1/packs/{packId}/release",
|
|
665
|
+
"POST /v1/projects/{projectId}/organization-units/{unitId}",
|
|
666
|
+
"POST /v1/promotions/program-pointers/{pointerKey}/retire",
|
|
667
|
+
"POST /v1/quality/evaluate",
|
|
668
|
+
"POST /v1/releases",
|
|
669
|
+
"POST /v1/releases/manual-program",
|
|
670
|
+
"POST /v1/runtime/actions/approvals",
|
|
671
|
+
"POST /v1/runtime/actions/authorize",
|
|
672
|
+
"POST /v1/runtime/behavior-capsule",
|
|
673
|
+
"POST /v1/runtime/behavior-projection",
|
|
674
|
+
"POST /v1/runtime/capabilities/attest",
|
|
675
|
+
"POST /v1/runtime/capabilities/resolve",
|
|
676
|
+
"POST /v1/runtime/execute",
|
|
677
|
+
"POST /v1/runtime/resolve",
|
|
678
|
+
"POST /v1/runtime/strategy-executions",
|
|
679
|
+
"POST /v1/runtime/strategy-executions/{executionId}/cancel",
|
|
680
|
+
"POST /v1/runtime/strategy-executions/{executionId}/continue",
|
|
681
|
+
"POST /v1/semantic-tasks",
|
|
682
|
+
"POST /v1/semantic/resolve",
|
|
683
|
+
"POST /v1/signals/discovery-proposals",
|
|
684
|
+
"POST /v1/signals/discovery-proposals/{id}/materialize",
|
|
685
|
+
"POST /v1/signals/discovery-proposals/{id}/review",
|
|
686
|
+
"POST /v1/signals/mappings",
|
|
687
|
+
"POST /v1/signals/mappings/{id}/review",
|
|
688
|
+
"POST /v1/task-runs",
|
|
689
|
+
"POST /v1/task-runs/resolve",
|
|
690
|
+
"POST /v1/task-runs/{taskRunId}/cancel",
|
|
691
|
+
"POST /v1/task-runs/{taskRunId}/continue",
|
|
692
|
+
"POST /v1/teach/analyses",
|
|
693
|
+
"POST /v1/teach/conversations",
|
|
694
|
+
"POST /v1/teach/conversations/import",
|
|
695
|
+
"POST /v1/teach/conversations/{evidenceId}/revoke",
|
|
696
|
+
"POST /v1/teach/cross-conversation-analyses",
|
|
697
|
+
"POST /v1/teach/evidence",
|
|
698
|
+
"POST /v1/teach/proposals",
|
|
699
|
+
"POST /v1/teach/proposals/{proposalId}/request-changes",
|
|
700
|
+
"POST /v1/teach/runs/{teachRunId}/recommendation/accept"
|
|
701
|
+
]);
|
|
702
|
+
var deniedRegardlessOfContract = (path, method) => path === "/v1/notification-destinations" || path.startsWith("/v1/notification-destinations/") || method !== "GET" && /^\/v1\/observations\/(?:supersessions|backfills)(?:\/|$)/.test(path) || // These mutations require exact human/owner workflows, not a generic
|
|
703
|
+
// model-authored request with a coarse write_control_api permission.
|
|
704
|
+
method !== "GET" && // High-impact changes require dedicated tools, explicit human approval,
|
|
705
|
+
// and version/receipt fences rather than a generic MCP write envelope.
|
|
706
|
+
(method === "DELETE" || /^\/v1\/(?:releases|promotions|deployments)(?:\/|$)/.test(path) || /^\/v1\/ai-systems\/[^/]+\/clone-cutover(?:\/|$)/.test(path) || /^\/v1\/(?:packs|pack-revisions|behavior-revision-candidates)\/[^/]+\/(?:release|approve|promote|accept|materialize|install)(?:\/|$)/.test(path) || /^\/v1\/teach\/proposals\/[^/]+\/(?:promote|approve)(?:\/|$)/.test(path) || /^\/v1\/runtime\/actions(?:\/|$)/.test(path) || /^\/v1\/(?:organization-units|organization\/billing-admins|projects\/[^/]+\/organization-units)(?:\/|$)/.test(path) || /^\/v1\/ai-systems\/[^/]+\/unit-grants(?:\/|$)/.test(path) || /^\/v1\/billing(?:\/|$)/.test(path) || /^\/v1\/runtime\/actions\/approvals(?:\/|$)/.test(path) || /^\/v1\/promotions\/program-pointers\/[^/]+\/retire$/.test(path));
|
|
707
|
+
var canonicalSegment = (value) => {
|
|
708
|
+
if (typeof value !== "string" || !value.trim() || value !== value.trim() || value.length > 512 || value === "." || value === ".." || /[/?#\\%\u0000]/.test(value))
|
|
709
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
710
|
+
return encodeURIComponent(value);
|
|
711
|
+
};
|
|
712
|
+
function resolveStdioMcpControlOperation(method, path, pathParams = {}) {
|
|
713
|
+
if (typeof path !== "string" || !path.startsWith("/v1/") || /[?#\\]/.test(path))
|
|
714
|
+
throw new Error("MCP_CONTROL_PATH_INVALID");
|
|
715
|
+
const supplied = path.split("/");
|
|
716
|
+
if (supplied.some((segment, i) => {
|
|
717
|
+
if (i === 0) return false;
|
|
718
|
+
if (!segment || segment === "." || segment === "..") return true;
|
|
719
|
+
try {
|
|
720
|
+
const decoded = decodeURIComponent(segment);
|
|
721
|
+
return decoded === "." || decoded === ".." || /[/?#\\%\u0000]/.test(decoded);
|
|
722
|
+
} catch {
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
725
|
+
})) throw new Error("MCP_CONTROL_PATH_INVALID");
|
|
726
|
+
if (!pathParams || typeof pathParams !== "object" || Array.isArray(pathParams))
|
|
727
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
728
|
+
const explicit = pathParams;
|
|
729
|
+
const entries = REGISTERED_MCP_CONTROL_OPERATIONS.filter((entry) => entry.startsWith(method + " ")).map((entry) => entry.slice(method.length + 1));
|
|
730
|
+
const route = entries.includes(path) ? path : entries.find((template2) => {
|
|
731
|
+
const segments = template2.split("/");
|
|
732
|
+
return segments.length === supplied.length && segments.every((part, i) => /^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part) || part === supplied[i]);
|
|
733
|
+
});
|
|
734
|
+
if (!route || deniedRegardlessOfContract(route, method))
|
|
735
|
+
throw new Error("MCP_CONTROL_OPERATION_NOT_FOUND");
|
|
736
|
+
const template = route.split("/");
|
|
737
|
+
const names = template.flatMap((part) => /^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part) ? [part.slice(1, -1)] : []);
|
|
738
|
+
if (Object.keys(explicit).some((key) => !names.includes(key)))
|
|
739
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
740
|
+
const concrete = template.map((part, i) => {
|
|
741
|
+
if (!/^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part)) return part;
|
|
742
|
+
const name = part.slice(1, -1);
|
|
743
|
+
const source = supplied[i] === part ? void 0 : decodeURIComponent(supplied[i]);
|
|
744
|
+
const provided = explicit[name];
|
|
745
|
+
if (provided !== void 0 && source !== void 0 && provided !== source)
|
|
746
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_MISMATCH");
|
|
747
|
+
return canonicalSegment(provided ?? source);
|
|
748
|
+
}).join("/");
|
|
749
|
+
return concrete;
|
|
750
|
+
}
|
|
751
|
+
function validateStdioMcpScope(scope2, value) {
|
|
752
|
+
for (const key of ["organizationId", "projectId", "environmentId"])
|
|
753
|
+
if (value[key] !== void 0 && value[key] !== scope2[key])
|
|
754
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
755
|
+
if (scope2.organizationUnitId !== void 0 && value.organizationUnitId !== void 0 && value.organizationUnitId !== scope2.organizationUnitId)
|
|
756
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
757
|
+
}
|
|
758
|
+
function bindStdioMcpScope(scope2, value) {
|
|
759
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
760
|
+
throw new Error("MCP_CONTROL_BODY_INVALID");
|
|
761
|
+
const body = value;
|
|
762
|
+
validateStdioMcpScope(scope2, body);
|
|
763
|
+
if (Object.hasOwn(body, "scope")) {
|
|
764
|
+
if (!body.scope || typeof body.scope !== "object" || Array.isArray(body.scope))
|
|
765
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
766
|
+
validateStdioMcpScope(scope2, body.scope);
|
|
767
|
+
}
|
|
768
|
+
return { ...body, ...scope2 };
|
|
769
|
+
}
|
|
770
|
+
function bindStdioMcpQuery(scope2, value) {
|
|
771
|
+
if (value !== void 0 && (!value || typeof value !== "object" || Array.isArray(value)))
|
|
772
|
+
throw new Error("MCP_CONTROL_QUERY_INVALID");
|
|
773
|
+
const query = value ?? {};
|
|
774
|
+
if (Object.hasOwn(query, "scope")) throw new Error("MCP_SCOPE_MISMATCH");
|
|
775
|
+
validateStdioMcpScope(scope2, query);
|
|
776
|
+
const result = new URLSearchParams();
|
|
777
|
+
for (const [key, item] of Object.entries(query))
|
|
778
|
+
if (item !== void 0) result.set(key, typeof item === "string" ? item : JSON.stringify(item));
|
|
779
|
+
for (const [key, item] of Object.entries(scope2)) result.set(key, item);
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
782
|
+
|
|
52
783
|
// src/cli.ts
|
|
53
784
|
var required = (key) => {
|
|
54
785
|
const value = process.env[key]?.trim();
|
|
@@ -59,12 +790,17 @@ var baseUrl = (process.env.VIRA_API_URL ?? "").replace(/\/$/, "");
|
|
|
59
790
|
if (!baseUrl) throw new Error("VIRA_API_URL_REQUIRED");
|
|
60
791
|
var allowInsecureLocalhost = process.env.VIRA_ALLOW_INSECURE_LOCALHOST === "true";
|
|
61
792
|
var apiKey = required("VIRA_API_KEY");
|
|
793
|
+
var organizationUnitId = process.env.VIRA_ORGANIZATION_UNIT_ID?.trim() || void 0;
|
|
62
794
|
var scope = {
|
|
63
795
|
organizationId: required("VIRA_ORGANIZATION_ID"),
|
|
64
796
|
projectId: required("VIRA_PROJECT_ID"),
|
|
65
|
-
environmentId: required("VIRA_ENVIRONMENT_ID")
|
|
797
|
+
environmentId: required("VIRA_ENVIRONMENT_ID"),
|
|
798
|
+
...process.env.VIRA_ORGANIZATION_UNIT_ID?.trim() ? { organizationUnitId: process.env.VIRA_ORGANIZATION_UNIT_ID.trim() } : {}
|
|
66
799
|
};
|
|
67
|
-
var
|
|
800
|
+
var mcpApiTimeoutMs = Number(process.env.VIRA_MCP_API_TIMEOUT_MS ?? 3e4);
|
|
801
|
+
if (!Number.isInteger(mcpApiTimeoutMs) || mcpApiTimeoutMs < 1e3 || mcpApiTimeoutMs > 12e4) throw new Error("VIRA_MCP_API_TIMEOUT_MS_INVALID");
|
|
802
|
+
var mcpHttpOptions = { apiKey, timeoutMs: mcpApiTimeoutMs, retries: 1, defaultHeaders: organizationUnitId ? { "x-vira-organization-unit-id": organizationUnitId } : void 0 };
|
|
803
|
+
var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost, timeoutMs: mcpApiTimeoutMs, retries: 1, organizationUnitId });
|
|
68
804
|
var hostToolDefinitions = (() => {
|
|
69
805
|
try {
|
|
70
806
|
const parsed = JSON.parse(process.env.VIRA_HOST_TOOL_DEFINITIONS ?? "[]");
|
|
@@ -111,11 +847,11 @@ var importPackSchema = input({ manifest: packManifestSchema.optional(), objects:
|
|
|
111
847
|
if (!value.manifest && !value.archiveBase64) ctx.addIssue({ code: z.ZodIssueCode.custom, message: "MCP_PACK_MANIFEST_OR_ARCHIVE_REQUIRED", path: ["manifest"] });
|
|
112
848
|
if (value.archiveBase64 && !value.fileName) ctx.addIssue({ code: z.ZodIssueCode.custom, message: "MCP_PACK_FILE_NAME_REQUIRED", path: ["fileName"] });
|
|
113
849
|
});
|
|
114
|
-
var scopeQuery = (args) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
850
|
+
var scopeQuery = (args, allowOrganizationUnitFilter = false) => {
|
|
851
|
+
if (!allowOrganizationUnitFilter) return assertMcpToolScope(args, scope);
|
|
852
|
+
const requestedUnit = typeof args.organizationUnitId === "string" ? args.organizationUnitId : void 0;
|
|
853
|
+
if (scope.organizationUnitId && requestedUnit && scope.organizationUnitId !== requestedUnit) throw new Error("MCP_SCOPE_MISMATCH");
|
|
854
|
+
return assertMcpToolScope({ ...args, organizationUnitId: void 0 }, scope);
|
|
119
855
|
};
|
|
120
856
|
var decodePageCursor = (cursor) => {
|
|
121
857
|
if (!cursor) return 0;
|
|
@@ -132,71 +868,105 @@ var listFromApi = async (path, args) => {
|
|
|
132
868
|
for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
133
869
|
if (typeof args.limit === "number") url.searchParams.set("limit", String(args.limit));
|
|
134
870
|
if (typeof args.cursor === "string") url.searchParams.set("cursor", args.cursor);
|
|
135
|
-
const response = await viraHttpRequest(url, { method: "GET"
|
|
871
|
+
const response = await viraHttpRequest(url, { ...mcpHttpOptions, method: "GET" });
|
|
136
872
|
const body = response.body;
|
|
137
873
|
const requestedLimit = typeof args.limit === "number" ? args.limit : 100;
|
|
138
874
|
const offset = decodePageCursor(typeof args.cursor === "string" ? args.cursor : void 0);
|
|
139
875
|
if (offset < 0) throw new Error("MCP_PAGE_CURSOR_INVALID");
|
|
140
876
|
if (!body || typeof body !== "object" || Array.isArray(body)) return body;
|
|
141
|
-
const
|
|
142
|
-
const collectionKey = Object.keys(
|
|
877
|
+
const record2 = body;
|
|
878
|
+
const collectionKey = Object.keys(record2).find((key) => Array.isArray(record2[key]));
|
|
143
879
|
if (!collectionKey) return body;
|
|
144
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
145
|
-
const collection =
|
|
880
|
+
if (Object.prototype.hasOwnProperty.call(record2, "nextCursor")) return body;
|
|
881
|
+
const collection = record2[collectionKey];
|
|
146
882
|
const page = collection.slice(offset, offset + requestedLimit);
|
|
147
883
|
const nextCursor = offset + requestedLimit < collection.length ? encodePageCursor(offset + requestedLimit) : void 0;
|
|
148
|
-
return { ...
|
|
884
|
+
return { ...record2, [collectionKey]: page, nextCursor };
|
|
149
885
|
};
|
|
150
|
-
var readFromApi = async (path) => {
|
|
886
|
+
var readFromApi = async (path, query) => {
|
|
151
887
|
const url = new URL(`${baseUrl}${path}`);
|
|
152
888
|
for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
153
|
-
|
|
889
|
+
for (const [key, value] of Object.entries(query ?? {})) if (value !== void 0) url.searchParams.set(key, String(value));
|
|
890
|
+
for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
891
|
+
return (await viraHttpRequest(url, { ...mcpHttpOptions, method: "GET" })).body;
|
|
154
892
|
};
|
|
155
|
-
var
|
|
156
|
-
const path = String(
|
|
157
|
-
|
|
158
|
-
return path;
|
|
893
|
+
var controlRequest = (args, method) => {
|
|
894
|
+
const path = resolveStdioMcpControlOperation(method, String(args.path ?? ""), args.pathParams);
|
|
895
|
+
const query = bindStdioMcpQuery(scope, args.query);
|
|
896
|
+
return { path: path + "?" + query.toString(), method };
|
|
159
897
|
};
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const entries = Object.entries(query).filter(([, value]) => value !== void 0);
|
|
164
|
-
return entries.length ? "?" + entries.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === "string" ? value : JSON.stringify(value))}`).join("&") : "";
|
|
898
|
+
var readControlApi = async (args) => {
|
|
899
|
+
const request = controlRequest(args, "GET");
|
|
900
|
+
return (await viraHttpRequest(baseUrl + request.path, { ...mcpHttpOptions, method: "GET" })).body;
|
|
165
901
|
};
|
|
166
|
-
var readControlApi = async (args) => readFromApi(`${safeControlPath(args.path)}${controlQuery(args.query)}`);
|
|
167
902
|
var writeControlApi = async (args) => {
|
|
168
|
-
const path = safeControlPath(args.path);
|
|
169
903
|
const method = String(args.method ?? "POST");
|
|
170
904
|
if (!["POST", "PUT", "PATCH", "DELETE"].includes(method)) throw new Error("MCP_CONTROL_WRITE_METHOD_INVALID");
|
|
171
|
-
|
|
905
|
+
const request = controlRequest(args, method);
|
|
906
|
+
const body = bindStdioMcpScope(scope, args.body);
|
|
907
|
+
return (await viraHttpRequest(baseUrl + request.path, {
|
|
908
|
+
...mcpHttpOptions,
|
|
909
|
+
method,
|
|
910
|
+
body,
|
|
911
|
+
idempotencyKey: String(args.idempotencyKey ?? newMcpMutationKey("write_control_api"))
|
|
912
|
+
})).body;
|
|
172
913
|
};
|
|
173
914
|
var optimizerRequest = async (path, method, body) => {
|
|
174
915
|
const controlPath = path === "/v1/optimize" ? "/v1/optimization/execute" : path;
|
|
175
916
|
const url = new URL(`${baseUrl}${controlPath}`);
|
|
176
917
|
if (method === "GET") for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
177
|
-
return (await viraHttpRequest(url, {
|
|
918
|
+
return (await viraHttpRequest(url, { ...mcpHttpOptions, method, body: body ? { ...body, scope } : void 0, idempotencyKey: method === "POST" ? newMcpMutationKey("optimizer_request") : void 0 })).body;
|
|
178
919
|
};
|
|
179
920
|
var fullTools = [
|
|
180
921
|
{ name: "get_scope", description: "Read the immutable organization/project/environment scope configured for this MCP session.", inputSchema: input(), run: async () => ({ scope, apiUrl: baseUrl }) },
|
|
181
|
-
{ name: "list_capabilities", description: "
|
|
922
|
+
{ name: "list_capabilities", description: "Show coarse role-based capability groups and the canonical Control API operation inventory. This is not per-operation authorization.", inputSchema: input(), run: () => readFromApi("/v1/capabilities?surface=mcp") },
|
|
923
|
+
{ name: "list_organization_units", description: "List organization units visible to this actor.", inputSchema: input(), run: () => readFromApi("/v1/organization-units") },
|
|
924
|
+
{ name: "list_ai_system_unit_grants", description: "List unit access grants for an AI System. Workspace owner permission is required.", inputSchema: input({ aiSystemId: z.string().min(1) }), run: (args) => readFromApi(`/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants`) },
|
|
925
|
+
{ name: "grant_ai_system_unit_access", description: "Grant scoped capabilities on an AI System to a Project-bound unit. Requires workspace owner permission and human approval.", inputSchema: input({ aiSystemId: z.string().min(1), unitId: z.string().min(1), permissions: z.array(z.enum(["system.read", "system.use", "observation.write", "teach.write", "evaluation.write", "release.approve", "integration.manage", "secret.read", "trace.read"])).min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants`, { ...mcpHttpOptions, method: "POST", body: { ...scope, unitId: String(args.unitId), permissions: args.permissions }, idempotencyKey: newMcpMutationKey("grant_ai_system_unit_access") })).body },
|
|
926
|
+
{ name: "revoke_ai_system_unit_access", description: "Revoke an AI System unit access grant. Requires workspace owner permission and human approval.", inputSchema: input({ aiSystemId: z.string().min(1), unitId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants/${encodeURIComponent(String(args.unitId))}`, { ...mcpHttpOptions, method: "DELETE", body: { ...scope }, idempotencyKey: newMcpMutationKey("revoke_ai_system_unit_access") })).body },
|
|
927
|
+
{ name: "list_organization_billing_admins", description: "List organization Billing Admin memberships. Workspace owner permission is required.", inputSchema: input(), run: () => readFromApi("/v1/organization/billing-admins") },
|
|
928
|
+
{ name: "set_organization_billing_admin", description: "Grant or revoke an organization Billing Admin membership. Workspace owner permission is required.", inputSchema: input({ actorId: z.string().min(1), status: z.enum(["ACTIVE", "REVOKED"]) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization/billing-admins/${encodeURIComponent(String(args.actorId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, status: args.status }, idempotencyKey: newMcpMutationKey("set_organization_billing_admin") })).body },
|
|
929
|
+
{ name: "get_ai_credit_wallet", description: "Read the organization AI credit balance and recent ledger entries. Organization billing admin permission is required.", inputSchema: input(), run: () => readFromApi("/v1/billing/credits") },
|
|
930
|
+
{ name: "list_ai_credit_budgets", description: "Read organization, department, project, and AI System budget caps with consumed and reserved credits. Organization billing admin permission is required.", inputSchema: input(), run: () => readFromApi("/v1/billing/credits/budgets") },
|
|
931
|
+
{ name: "reserve_ai_credits", description: "Reserve an approved upper bound before a managed AI provider call. Requires organization Billing Admin permission and explicit human approval.", inputSchema: input({ amountMicrocredits: z.number().int().positive(), periodStart: z.string(), periodEnd: z.string(), idempotencyKey: z.string().min(1), aiSystemId: z.string().optional() }), effectful: true, run: (args) => client.reserveAICredits({ organizationId: scope.organizationId, projectId: scope.projectId, environmentId: scope.environmentId, amountMicrocredits: Number(args.amountMicrocredits), periodStart: String(args.periodStart), periodEnd: String(args.periodEnd), idempotencyKey: String(args.idempotencyKey), aiSystemId: args.aiSystemId }) },
|
|
932
|
+
{ name: "release_ai_credit_reservation", description: "Release an unused AI credit reservation before any usage receipt is recorded. Requires explicit human approval.", inputSchema: input({ reservationId: z.string().min(1), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.releaseAICreditReservation(String(args.reservationId), { idempotencyKey: typeof args.idempotencyKey === "string" ? args.idempotencyKey : void 0 }) },
|
|
933
|
+
{ name: "list_ai_usage_receipts", description: "Read rated provider usage receipts, optionally filtered to an organization unit. Organization owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: input({ organizationUnitId: z.string().min(1).optional(), limit: z.number().int().positive().max(500).optional() }), run: (args) => readFromApi("/v1/billing/ai-usage", { organizationUnitId: args.organizationUnitId, limit: args.limit }) },
|
|
934
|
+
{ name: "get_ai_usage_summary", description: "Read monthly provider cost and customer credits by provider/model, optionally filtered to an organization unit. Organization owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: input({ organizationUnitId: z.string().min(1).optional() }), run: (args) => readFromApi("/v1/billing/ai-usage/summary", { organizationUnitId: args.organizationUnitId }) },
|
|
935
|
+
{ name: "execute_managed_chat", description: "Run an authorized Vira-managed model completion. This is a billable operation; server-side credit admission and approval remain required.", inputSchema: input({ aiSystemId: z.string().min(1), connectionId: z.string().min(1), operationId: z.string().min(1).max(200), model: z.string().min(1), messages: z.array(z.record(z.string(), z.unknown())).min(1).max(128), max_tokens: z.number().int().positive().max(8192).optional() }), effectful: true, run: (args) => client.executeManagedChat({ aiSystemId: String(args.aiSystemId), connectionId: String(args.connectionId), operationId: String(args.operationId), model: String(args.model), messages: args.messages, max_tokens: args.max_tokens }) },
|
|
936
|
+
{ name: "create_organization_unit", description: "Create an organization unit as a workspace owner.", inputSchema: input({ id: z.string().min(1).optional(), parentUnitId: z.string().min(1).nullable().optional(), name: z.string().min(1), kind: z.enum(["business_unit", "department", "team"]) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:create-unit:${String(args.id ?? args.name)}` })).body },
|
|
937
|
+
{ name: "preview_organization_unit_archive", description: "Preview the affected descendants, memberships, and project ownership before archiving an organization unit. Workspace owner required.", inputSchema: input({ unitId: z.string().min(1) }), run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/archive-preview`, { ...mcpHttpOptions, method: "POST", body: scope })).body },
|
|
938
|
+
{ name: "archive_organization_unit", description: "Archive an organization unit subtree after reviewing its impact. Workspace owner and explicit confirmation required.", inputSchema: input({ unitId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/archive`, { ...mcpHttpOptions, method: "POST", body: { ...scope, confirm: true }, idempotencyKey: `mcp:unit-archive:${String(args.unitId)}` })).body },
|
|
939
|
+
{ name: "list_organization_unit_members", description: "List memberships for a unit managed by this actor.", inputSchema: input({ unitId: z.string().min(1) }), run: (args) => readFromApi(`/v1/organization-units/${encodeURIComponent(String(args.unitId))}/members`) },
|
|
940
|
+
{ name: "set_organization_unit_member", description: "Set a unit membership after the server checks organization membership and role authority.", inputSchema: input({ unitId: z.string().min(1), actorId: z.string().min(1), role: z.enum(["department_admin", "teacher", "reviewer", "billing_admin", "viewer"]), status: z.enum(["ACTIVE", "REVOKED"]).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/members/${encodeURIComponent(String(args.actorId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, role: args.role, status: args.status }, idempotencyKey: newMcpMutationKey("set_organization_unit_member") })).body },
|
|
941
|
+
{ name: "list_project_organization_units", description: "List organization unit bindings for a project in this MCP scope.", inputSchema: input({ targetProjectId: z.string().min(1) }), run: (args) => readFromApi(`/v1/projects/${encodeURIComponent(String(args.targetProjectId))}/organization-units`) },
|
|
942
|
+
{ name: "bind_project_organization_unit", description: "Bind a unit to a project as a workspace owner, or let a Department Admin bind only their active unit as a non-primary owner.", inputSchema: input({ targetProjectId: z.string().min(1), unitId: z.string().min(1), primaryOwner: z.boolean().optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/projects/${encodeURIComponent(String(args.targetProjectId))}/organization-units/${encodeURIComponent(String(args.unitId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, primaryOwner: args.primaryOwner }, idempotencyKey: newMcpMutationKey("bind_project_organization_unit") })).body },
|
|
182
943
|
{ name: "list_inbox", description: "List the authenticated actor\u2019s scoped review notifications.", inputSchema: input({ ...pageFields, search: z.string().min(1).optional() }), run: async (args) => readFromApi(`/v1/notifications/inbox?${new URLSearchParams(Object.entries(args).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString()}`) },
|
|
183
|
-
{ name: "
|
|
184
|
-
{ name: "
|
|
944
|
+
{ name: "list_notification_destinations", description: "List scoped notification destinations. Endpoint secrets are never returned.", inputSchema: input(), run: () => readFromApi("/v1/notification-destinations") },
|
|
945
|
+
{ name: "create_notification_destination", description: "Register an encrypted Slack or Microsoft Teams Workflows destination. The endpoint is a secret and is never returned; owner or integration.write permission is required.", inputSchema: input({ label: z.string().min(1), provider: z.enum(["slack", "microsoft_teams"]), endpoint: z.string().min(1), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notification-destinations`, { ...mcpHttpOptions, method: "POST", body: { ...scope, label: String(args.label), provider: args.provider, endpoint: String(args.endpoint) }, idempotencyKey: String(args.idempotencyKey ?? `mcp:notification-destination:${String(args.label)}`) })).body },
|
|
946
|
+
{ name: "revoke_notification_destination", description: "Revoke a scoped destination so queued deliveries are suppressed. Owner or integration.write permission is required.", inputSchema: input({ destinationId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notification-destinations/${encodeURIComponent(String(args.destinationId))}/revoke`, { ...mcpHttpOptions, method: "POST", body: scope, idempotencyKey: `mcp:notification-destination-revoke:${String(args.destinationId)}` })).body },
|
|
947
|
+
{ name: "mark_inbox_read", description: "Mark one scoped review notification as read.", inputSchema: input({ notificationId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notifications/${encodeURIComponent(String(args.notificationId))}/read`, { ...mcpHttpOptions, method: "POST", body: scope, idempotencyKey: `mcp:inbox:${String(args.notificationId)}` })).body },
|
|
948
|
+
{ name: "inspect_conflicts", description: "Create a scoped conflict inspection for proposed versus active behavior.", inputSchema: input({ id: z.string().optional(), proposed: z.array(z.unknown()), active: z.array(z.unknown()), controls: z.array(z.unknown()) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/conflicts/inspect`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:conflicts:inspect:${String(args.id ?? scope.projectId)}` })).body },
|
|
185
949
|
{ name: "get_conflict_inspection", description: "Read a persisted scoped conflict inspection.", inputSchema: input({ inspectionId: z.string().min(1) }), run: (args) => readFromApi(`/v1/conflicts/${encodeURIComponent(String(args.inspectionId))}`) },
|
|
186
|
-
{ name: "resolve_conflict", description: "Approve or reject a previously inspected scoped conflict set.", inputSchema: input({ inspectionId: z.string().min(1), status: z.enum(["APPROVED", "REJECTED"]), authorityDigest: z.string().optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/conflicts/${encodeURIComponent(String(args.inspectionId))}/resolve`, { method: "POST",
|
|
950
|
+
{ name: "resolve_conflict", description: "Approve or reject a previously inspected scoped conflict set.", inputSchema: input({ inspectionId: z.string().min(1), status: z.enum(["APPROVED", "REJECTED"]), authorityDigest: z.string().optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/conflicts/${encodeURIComponent(String(args.inspectionId))}/resolve`, { ...mcpHttpOptions, method: "POST", body: { ...scope, status: args.status, authorityDigest: args.authorityDigest }, idempotencyKey: `mcp:conflicts:resolve:${String(args.inspectionId)}` })).body },
|
|
187
951
|
{ name: "start_optimization", description: "Start provider-backed scoped optimization with dataset and holdout governance through the authenticated Control API.", inputSchema: input({ request: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => optimizerRequest("/v1/optimize", "POST", args.request) },
|
|
188
952
|
{ name: "get_optimization_run", description: "Read a scoped durable optimization run.", inputSchema: input({ runId: z.string().min(1) }), run: (args) => optimizerRequest(`/v1/optimization/runs/${encodeURIComponent(String(args.runId))}`, "GET") },
|
|
189
953
|
{ name: "cancel_optimization_run", description: "Request cancellation of a scoped optimization run.", inputSchema: input({ runId: z.string().min(1) }), effectful: true, run: (args) => optimizerRequest(`/v1/optimization/runs/${encodeURIComponent(String(args.runId))}/cancel`, "POST", {}) },
|
|
190
954
|
{ name: "connect_ai_system", description: "Connect the customer chatbot/agent and return its capability handshake. Use for an AI System connection; not for a raw adapter probe or behavior authoring.", inputSchema: input({ name: z.string().min(1), systemType: z.string().min(1), adapterType: z.string().min(1), adapterVersion: z.string().min(1), capabilities: z.array(z.string()).optional(), config: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.connectAiSystem({ name: String(args.name), systemType: String(args.systemType), organizationId: scope.organizationId, projectId: scope.projectId, environmentId: scope.environmentId, adapterType: String(args.adapterType), adapterVersion: String(args.adapterVersion), capabilities: args.capabilities, config: args.config, idempotencyKey: args.idempotencyKey }) },
|
|
191
955
|
{ name: "get_job", description: "Read a scope-bound asynchronous job and completion evidence.", inputSchema: input({ jobId: z.string().min(1) }), run: (args) => readFromApi(`/v1/jobs/${encodeURIComponent(String(args.jobId))}`) },
|
|
192
956
|
{ name: "list_semantic_tasks", description: "List Semantic Tasks with bounded cursor pagination.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/semantic-tasks", args) },
|
|
957
|
+
{ name: "delete_semantic_task", description: "Delete an unused scoped Semantic Task after explicit confirmation.", inputSchema: input({ taskId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: (args) => client.deleteSemanticTask(String(args.taskId), { confirm: args.confirm === true }) },
|
|
193
958
|
{ name: "list_behavior_points", description: "List BehaviorPoints with bounded cursor pagination.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/behavior-points", args) },
|
|
959
|
+
{ name: "delete_behavior_point", description: "Delete an unused scoped BehaviorPoint after explicit confirmation.", inputSchema: input({ pointId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: (args) => client.deleteBehaviorPoint(String(args.pointId), { confirm: args.confirm === true }) },
|
|
194
960
|
{ name: "list_behavior_programs", description: "List behavior programs with bounded cursor pagination and search.", inputSchema: input({ ...pageFields, search: z.string().min(1).optional() }), run: (args) => readFromApi(`/v1/behavior-programs?${new URLSearchParams(Object.entries(args).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString()}`) },
|
|
195
961
|
{ name: "list_behavior_strategies", description: "List behavior strategies with bounded cursor pagination and search.", inputSchema: input({ ...pageFields, search: z.string().min(1).optional() }), run: (args) => readFromApi(`/v1/behavior-strategies?${new URLSearchParams(Object.entries(args).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString()}`) },
|
|
962
|
+
{ name: "get_behavior_strategy", description: "Read one scoped Behavior Strategy and its immutable artifact binding.", inputSchema: input({ strategyId: z.string().min(1) }), run: (args) => client.getBehaviorStrategy(String(args.strategyId)) },
|
|
963
|
+
{ name: "delete_behavior_strategy", description: "Delete a non-active scoped Behavior Strategy after explicit confirmation.", inputSchema: input({ strategyId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: (args) => client.deleteBehaviorStrategy(String(args.strategyId), { confirm: args.confirm === true }) },
|
|
964
|
+
{ name: "get_strategy_execution", description: "Read one scoped Strategy execution.", inputSchema: input({ executionId: z.string().min(1) }), run: (args) => client.getStrategyExecution(String(args.executionId)) },
|
|
965
|
+
{ name: "cancel_strategy_execution", description: "Cancel a non-terminal scoped Strategy execution.", inputSchema: input({ executionId: z.string().min(1) }), effectful: true, run: (args) => client.cancelStrategyExecution(String(args.executionId)) },
|
|
196
966
|
{ name: "resolve_semantic", description: "Classify input into registered Semantic Tasks. Use before execution when you need intent candidates; it does not run a behavior, tool, or TaskRun.", inputSchema: input({ input: z.string().min(1), profile: z.record(z.string(), z.unknown()).optional(), sessionId: z.string().optional(), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.string()).optional(), timeoutMs: z.number().positive().optional(), requestId: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), run: (args) => client.resolveSemantic(args) },
|
|
197
967
|
{ name: "resolve_runtime", description: "Resolve a selected BehaviorPoint into released runtime authority. Use after canonical selection; it does not classify text or start a TaskRun.", inputSchema: input({ behaviorPoint: z.string().min(1).optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), semanticContext: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.resolveRuntime(args) },
|
|
198
968
|
{ name: "resolve_task_run", description: "Preview server-owned AUTO mode selection and child plan. Use to inspect routing; it does not execute the TaskRun.", inputSchema: input({ input: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), intentCount: z.number().int().positive().optional(), hostCapabilities: z.array(z.string()).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional() }), run: (args) => client.resolveTaskRun(args) },
|
|
199
|
-
{ name: "start_task_run", description: "Admit a registered TaskRun after server-side scope, release and authority checks; omit mode for AUTO.", inputSchema: input({ taskRunId: z.string().min(1), requestId: z.string().min(1), input: z.unknown(), ownerActorRef: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional(), compoundPlanId: z.string().optional(), conversationId: z.string().optional(), episodeId: z.string().optional(), traceRootRef: z.string().optional(), budget: z.object({ maxChildren: z.number().int().positive().optional(), maxCalls: z.number().int().positive().optional(), maxLatencyMs: z.number().int().positive().optional(), maxCostMicros: z.number().int().positive().optional() }).optional(), hostCapabilities: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
969
|
+
{ name: "start_task_run", description: "Admit a registered TaskRun after server-side scope, AI System permission, release and authority checks; omit mode for AUTO.", inputSchema: input({ taskRunId: z.string().min(1), requestId: z.string().min(1), aiSystemId: z.string().min(1), input: z.unknown(), ownerActorRef: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional(), compoundPlanId: z.string().optional(), conversationId: z.string().optional(), episodeId: z.string().optional(), traceRootRef: z.string().optional(), budget: z.object({ maxChildren: z.number().int().positive().optional(), maxCalls: z.number().int().positive().optional(), maxLatencyMs: z.number().int().positive().optional(), maxCostMicros: z.number().int().positive().optional() }).optional(), hostCapabilities: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
200
970
|
const { idempotencyKey, ...request } = args;
|
|
201
971
|
return client.startTaskRun(request, { idempotencyKey });
|
|
202
972
|
} },
|
|
@@ -204,13 +974,14 @@ var fullTools = [
|
|
|
204
974
|
{ name: "cancel_task_run", description: "Cancel a TaskRun using optimistic state-version fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.cancelTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
205
975
|
{ name: "retry_task_run", description: "Retry a failed, blocked, or partial TaskRun using the same immutable plan and authority fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.retryTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
206
976
|
{ name: "create_semantic_task", description: "Create a Semantic Task for review in the API key scope.", inputSchema: input({ id: z.string().optional(), taskKey: z.string().min(1), description: z.string().optional(), version: z.number().int().positive().optional(), aliases: z.array(z.string()).optional(), examples: z.array(z.string()).optional(), negativeExamples: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
207
|
-
const { id, idempotencyKey, ...task } = args;
|
|
208
|
-
return client.createSemanticTask(task, { id, idempotencyKey });
|
|
977
|
+
const { id: id2, idempotencyKey, ...task } = args;
|
|
978
|
+
return client.createSemanticTask(task, { id: id2, idempotencyKey });
|
|
209
979
|
} },
|
|
210
980
|
{ name: "create_behavior_point", description: "Create a BehaviorPoint in the API key scope.", inputSchema: input({ id: z.string().optional(), key: z.string().min(1), taskId: z.string().optional(), taskIds: z.array(z.string()).optional(), constraints: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
211
|
-
const { id, idempotencyKey, ...point } = args;
|
|
212
|
-
return client.createBehaviorPoint(point, { id, idempotencyKey });
|
|
981
|
+
const { id: id2, idempotencyKey, ...point } = args;
|
|
982
|
+
return client.createBehaviorPoint(point, { id: id2, idempotencyKey });
|
|
213
983
|
} },
|
|
984
|
+
{ name: "create_observation", description: "Submit one scoped observation for discovery without publishing behavior.", inputSchema: input({ id: z.string().min(1), content: z.record(z.string(), z.unknown()), consent: z.boolean() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/observations`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:create_observation:${String(args.id)}` })).body },
|
|
214
985
|
{ name: "submit_teach_evidence", description: "Admit selected consented evidence into Teach analysis. Use after observation; it is not generic observation ingest and does not publish behavior.", inputSchema: input({ evidenceId: z.string().optional(), source: z.string().min(1), content: z.string().min(1), consent: z.literal(true), privacy: z.string().optional(), conversationId: z.string().optional(), controlPointId: z.string().optional(), summary: z.string().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
215
986
|
const { idempotencyKey, ...evidence } = args;
|
|
216
987
|
return client.submitTeachEvidence(evidence, { idempotencyKey });
|
|
@@ -219,12 +990,20 @@ var fullTools = [
|
|
|
219
990
|
const { idempotencyKey, ...proposal } = args;
|
|
220
991
|
return client.createTeachProposal(proposal, { idempotencyKey });
|
|
221
992
|
} },
|
|
993
|
+
{ name: "transition_teach_proposal", description: "Review, evaluate, or promote a scoped Teach proposal.", inputSchema: input({ proposalId: z.string().min(1), transition: z.enum(["review", "evaluate", "promote"]), decision: z.string().optional(), score: z.number().optional(), evaluationId: z.string().optional() }), effectful: true, run: (args) => {
|
|
994
|
+
const { proposalId, transition, ...body } = args;
|
|
995
|
+
return client.transitionTeachProposal(String(proposalId), transition, body);
|
|
996
|
+
} },
|
|
222
997
|
{ name: "list_packs", description: "List Behavior Packs with bounded cursor pagination.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/packs", args) },
|
|
223
998
|
{ name: "get_pack", description: "Read one scoped Behavior Pack including its manifest and materialization metadata.", inputSchema: input({ packId: z.string().min(1) }), run: (args) => client.getPack(String(args.packId)) },
|
|
224
999
|
{ name: "list_evaluations", description: "List scoped evaluations with bounded pagination and optional status filter.", inputSchema: input({ ...pageFields, status: z.string().optional() }), run: (args) => client.listEvaluations(args) },
|
|
225
1000
|
{ name: "import_pack", description: "Import a versioned Pack draft; release remains separately governed.", inputSchema: importPackSchema, effectful: true, run: (args) => client.importPack(args) },
|
|
226
1001
|
{ name: "install_pack", description: "Install and materialize an approved Pack using direct variables.", inputSchema: input({ packId: z.string().min(1), variables: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.installPack(String(args.packId), args.variables ?? {}) },
|
|
227
1002
|
{ name: "release_pack", description: "Release a separately evaluated and approved Pack.", inputSchema: input({ packId: z.string().min(1) }), effectful: true, run: (args) => client.releasePack(String(args.packId)) },
|
|
1003
|
+
{ name: "preview_pack_upgrade", description: "Preview a scoped Behavior Pack upgrade without applying it.", inputSchema: input({ packId: z.string().min(1), incoming: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.previewPackUpgrade(String(args.packId), args.incoming) },
|
|
1004
|
+
{ name: "get_strategy_execution_trace", description: "Read persisted Strategy execution trace and receipts.", inputSchema: input({ executionId: z.string().min(1) }), run: (args) => client.getStrategyExecutionTrace(String(args.executionId)) },
|
|
1005
|
+
{ name: "get_ai_usage_reconciliation", description: "Read exact Strategy provider-request and rated-credit evidence in the authenticated department; does not settle or mutate usage.", inputSchema: input({ executionId: z.string().min(1) }), run: (args) => client.getAIUsageReconciliation(String(args.executionId)) },
|
|
1006
|
+
{ name: "continue_strategy_execution", description: "Continue a waiting Strategy execution under the same immutable authority.", inputSchema: input({ executionId: z.string().min(1), authorityDigest: z.string().optional(), state: z.record(z.string(), z.unknown()).optional(), references: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.continueStrategyExecution(String(args.executionId), { authorityDigest: args.authorityDigest, state: args.state, references: args.references }) },
|
|
228
1007
|
{ name: "start_strategy_execution", description: "Start a server-authorized immutable Strategy execution.", inputSchema: input({ artifactDigest: z.string().min(1), revisionId: z.string().min(1), idempotencyKey: z.string().min(1), nonce: z.string().min(1), expiresAt: z.number().positive(), decisionPlanId: z.string().min(1), candidates: z.array(z.record(z.string(), z.unknown())), policy: z.string().min(1), behaviorPoint: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.startStrategyExecution(args) },
|
|
229
1008
|
{ name: "list_host_tools", description: "List host tools registered dynamically by the host with their ActionDefinition bindings; this MCP server defines no domain tools.", inputSchema: input(), run: async () => ({ tools: hostToolDefinitions }) },
|
|
230
1009
|
{ name: "authorize_host_tool", description: "Request Vira server authorization for one dynamically registered host tool proposal matched to its ActionDefinition.", inputSchema: input({ toolName: z.string().min(1), executionId: z.string().min(1), sessionId: z.string().min(1), dataVersion: z.string().min(1), context: z.record(z.string(), z.unknown()), proposal: z.record(z.string(), z.unknown()), approval: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => {
|
|
@@ -235,9 +1014,12 @@ var fullTools = [
|
|
|
235
1014
|
if (String(proposalRecord.tool_key ?? "") !== registered.name) throw new Error("MCP_HOST_TOOL_DEFINITION_MISMATCH");
|
|
236
1015
|
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), dataVersion: String(dataVersion), scope, context: contextRecord, proposal: proposalRecord, ...approval ? { approval } : {} });
|
|
237
1016
|
} },
|
|
238
|
-
{ name: "list_ai_systems", description: "List
|
|
239
|
-
{ name: "
|
|
1017
|
+
{ name: "list_ai_systems", description: "List AI Systems visible in the selected department with bounded cursor pagination. Results include the canonical ownerUnitId and active consumingUnitGrants when the caller is a Workspace Owner; grants do not replace membership in the selected department.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/ai-systems", args) },
|
|
1018
|
+
{ name: "delete_ai_system", description: "Delete an unused scoped AI System after explicit confirmation.", inputSchema: input({ systemId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: (args) => client.deleteAISystem(String(args.systemId), { confirm: args.confirm === true }) },
|
|
1019
|
+
{ name: "get_ai_system", description: "Read one AI System with its server-resolved ownerUnitId. Workspace Owners also receive active consumingUnitGrants; grants never replace active department membership.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.getAISystem(String(args.systemId)) },
|
|
240
1020
|
{ name: "list_system_connections", description: "List connections for an AI system with bounded cursor pagination and search.", inputSchema: input({ systemId: z.string().min(1), ...pageFields, search: z.string().min(1).optional() }), run: (args) => client.listSystemConnections(String(args.systemId), { limit: args.limit, cursor: args.cursor, search: args.search }) },
|
|
1021
|
+
{ name: "list_discovery_candidates", description: "Read evidence-backed discovery candidates with bounded pagination and search.", inputSchema: input({ reviewState: z.string().optional(), ...pageFields, search: z.string().optional() }), run: (args) => client.discover({ reviewState: args.reviewState, limit: args.limit, cursor: args.cursor, search: args.search }) },
|
|
1022
|
+
{ name: "review_discovery_candidate", description: "Record a human review decision for a scoped discovery candidate.", inputSchema: input({ kind: z.string().min(1), key: z.string().min(1), decision: z.string().min(1), patch: z.record(z.string(), z.unknown()).optional(), payload: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.reviewDiscoveryCandidate(String(args.kind), String(args.key), { decision: String(args.decision), ...args.patch !== void 0 ? { patch: args.patch } : {}, ...args.payload !== void 0 ? { payload: args.payload } : {} }, { idempotencyKey: newMcpMutationKey("review_discovery_candidate") }) },
|
|
241
1023
|
{ name: "get_connection", description: "Read one connection.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.getConnection(String(args.connectionId)) },
|
|
242
1024
|
{ name: "get_connection_health", description: "Read the latest health state for one AI System connection.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.connectionHealth(String(args.connectionId)) },
|
|
243
1025
|
{ name: "list_connection_inventory", description: "List capability inventory for one connected AI System.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.inventory(String(args.systemId)) },
|
|
@@ -248,9 +1030,22 @@ var fullTools = [
|
|
|
248
1030
|
{ name: "validate_behavior_strategy", description: "Validate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.validateBehaviorStrategy(String(args.strategyId)) },
|
|
249
1031
|
{ name: "activate_behavior_strategy", description: "Activate a validated Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.activateBehaviorStrategy(String(args.strategyId)) },
|
|
250
1032
|
{ name: "simulate_behavior_strategy", description: "Simulate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1), initialState: z.record(z.string(), z.unknown()).optional() }), run: (args) => client.simulateBehaviorStrategy(String(args.strategyId), args.initialState ?? {}) },
|
|
1033
|
+
{ name: "get_task_run_evidence", description: "Read authorized TaskRun evidence, including SINGLE host completion.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => readFromApi(`/v1/task-runs/${encodeURIComponent(String(args.taskRunId))}/evidence`) },
|
|
1034
|
+
{ name: "queue_task_run_host_dispatch", description: "Queue a previously human-approved SINGLE host dispatch, not local execution.", inputSchema: input({ organizationUnitId: z.string().min(1), taskRunId: z.string().min(1), childRunId: z.string().min(1), aiSystemId: z.string().min(1), sessionId: z.string().min(1), approvalId: z.string().min(1), context: z.record(z.string(), z.unknown()), proposal: z.record(z.string(), z.unknown()) }), effectful: true, run: async (args) => {
|
|
1035
|
+
const body = buildMcpTaskRunHostDispatch(args, scope);
|
|
1036
|
+
const response = await viraHttpRequest(`${baseUrl}/v1/runtime/actions/authorize`, { ...mcpHttpOptions, retries: 0, method: "POST", body });
|
|
1037
|
+
if (response.status !== 202) throw Error("MCP_SINGLE_HOST_QUEUE_PROOF_REQUIRED");
|
|
1038
|
+
return assertMcpTaskRunHostQueued(response.body);
|
|
1039
|
+
} },
|
|
251
1040
|
{ name: "get_task_run", description: "Read TaskRun state and final result.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.getTaskRun(String(args.taskRunId)) },
|
|
1041
|
+
{ name: "list_compound_task_plans", description: "List persisted compound execution plans in the authenticated scope with bounded cursor pagination.", inputSchema: input({ limit: z.number().int().positive().max(500).optional(), cursor: z.string().min(1).optional() }), run: (args) => client.listCompoundTaskPlans(args) },
|
|
1042
|
+
{ name: "save_compound_task_plan", description: "Persist a validated immutable compound execution plan in the authenticated scope. This does not execute the plan.", inputSchema: input({ plan: z.record(z.string(), z.unknown()), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.saveCompoundTaskPlan(args.plan, { idempotencyKey: args.idempotencyKey }) },
|
|
1043
|
+
{ name: "get_compound_task_plan", description: "Read one persisted compound execution plan in the authenticated scope.", inputSchema: input({ planId: z.string().min(1) }), run: (args) => client.getCompoundTaskPlan(String(args.planId)) },
|
|
252
1044
|
{ name: "list_task_run_events", description: "Read TaskRun lifecycle events and child lineage.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.listTaskRunEvents(String(args.taskRunId)) },
|
|
253
|
-
{ name: "observe", description: "Ingest a scoped observation.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) =>
|
|
1045
|
+
{ name: "observe", description: "Ingest a scoped observation. Conversation output events derive the same event ID as OpenCode from conversationId and requestId.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => {
|
|
1046
|
+
const normalized = normalizeMcpObservationEvent(args.event);
|
|
1047
|
+
return client.observe(normalized.event, { idempotencyKey: normalized.idempotencyKey });
|
|
1048
|
+
} },
|
|
254
1049
|
{ name: "list_observations", description: "List admitted observations in the current environment with bounded pagination.", inputSchema: input(pageFields), run: (args) => client.listObservations(args) },
|
|
255
1050
|
{ name: "get_observation", description: "Read one admitted observation by event ID in the current environment.", inputSchema: input({ eventId: z.string().min(1) }), run: (args) => client.getObservation(String(args.eventId)) },
|
|
256
1051
|
{ name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.recordUserFeedback(args.event) },
|
|
@@ -283,6 +1078,7 @@ var fullTools = [
|
|
|
283
1078
|
{ name: "create_behavior_revision_candidate", description: "Create an immutable behavior revision candidate.", inputSchema: input({ candidate: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createBehaviorRevisionCandidate(args.candidate) },
|
|
284
1079
|
{ name: "evaluate_behavior_revision_candidate", description: "Evaluate exactly one immutable Behavior Revision Candidate with a real dataset. It does not evaluate or release the parent Pack.", inputSchema: input({ candidateId: z.string().min(1), evaluation: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.evaluateBehaviorRevisionCandidate(String(args.candidateId), args.evaluation) },
|
|
285
1080
|
{ name: "transition_behavior_revision_candidate", description: "Accept, reject, or promote a candidate revision.", inputSchema: input({ candidateId: z.string().min(1), transition: z.enum(["evaluate", "accept", "reject", "pack"]), input: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.transitionBehaviorRevisionCandidate(String(args.candidateId), args.transition, args.input ?? {}) },
|
|
1081
|
+
{ name: "accept_behavior_revision_candidate", description: "Accept a candidate only when its evaluation is bound to the immutable digest.", inputSchema: input({ candidateId: z.string().min(1), candidateEvaluationId: z.string().min(1) }), effectful: true, run: (args) => client.transitionBehaviorRevisionCandidate(String(args.candidateId), "accept", { candidateEvaluationId: String(args.candidateEvaluationId) }) },
|
|
286
1082
|
{ name: "create_pack_revision", description: "Create a Pack Revision from an accepted candidate.", inputSchema: input({ revision: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createPackRevision(args.revision) },
|
|
287
1083
|
{ name: "get_pack_revision", description: "Read Pack Revision status and lineage.", inputSchema: input({ revisionId: z.string().min(1) }), run: (args) => client.getPackRevision(String(args.revisionId)) },
|
|
288
1084
|
{ name: "get_pack_revision_diff", description: "Read Pack Revision diff.", inputSchema: input({ revisionId: z.string().min(1) }), run: (args) => client.getPackRevisionDiff(String(args.revisionId)) },
|
|
@@ -293,110 +1089,46 @@ var fullTools = [
|
|
|
293
1089
|
{ name: "approve_pack", description: "Approve a passed Pack evaluation.", inputSchema: input({ packId: z.string().min(1), reason: z.string().optional() }), effectful: true, run: (args) => client.approvePack(String(args.packId), { manualApproval: true, reason: args.reason }) },
|
|
294
1090
|
{ name: "compile_behavior_capsule", description: "Compile a Behavior Program capsule.", inputSchema: input({ programId: z.string().min(1), input: z.string().min(1), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.unknown()).optional() }), effectful: true, run: (args) => client.compileBehaviorCapsule(args) },
|
|
295
1091
|
{ name: "serve_behavior_projection", description: "Serve the active behavior projection for verification. Use only after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. Do not use this tool to create, install, evaluate, approve, or release a Pack, to classify input, to call the model, or to execute a host action; it does not call the model or execute tools. Use compile_behavior_capsule when you need pre-model context, resolve_runtime/executeRuntime when you need enforcement, and evaluate_behavior_revision_candidate when testing an unreleased candidate.", inputSchema: input({ input: z.string().min(1), provider: z.string().min(1), programId: z.string().optional() }), effectful: true, run: (args) => client.serveBehaviorProjection(args) },
|
|
296
|
-
{ name: "create_release", description: "Create a governed release for an approved immutable artifact.", inputSchema: input({ release: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createRelease(args.release) }
|
|
1092
|
+
{ name: "create_release", description: "Create a governed release for an approved immutable artifact.", inputSchema: input({ release: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createRelease(args.release) },
|
|
1093
|
+
{ name: "retire_program_pointer", description: "Retire the current scoped program pointer with a version fence. Irreversible for the active pointer; requires release.approve permission and explicit human confirmation.", inputSchema: input({ pointerKey: z.string().min(1), confirm: z.literal(true), expectedVersion: z.number().int().positive(), reason: z.string().min(1).max(500), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/promotions/program-pointers/${encodeURIComponent(String(args.pointerKey))}/retire`, { ...mcpHttpOptions, method: "POST", body: { ...scope, confirm: true, expectedVersion: Number(args.expectedVersion), reason: String(args.reason).trim() }, idempotencyKey: String(args.idempotencyKey ?? `mcp:program-pointer-retire:${String(args.pointerKey)}:${String(args.expectedVersion)}`) })).body }
|
|
297
1094
|
];
|
|
298
|
-
var promotedNames = /* @__PURE__ */ new Set([
|
|
299
|
-
"get_scope",
|
|
300
|
-
"list_capabilities",
|
|
301
|
-
"connect_ai_system",
|
|
302
|
-
"get_job",
|
|
303
|
-
"list_semantic_tasks",
|
|
304
|
-
"list_behavior_points",
|
|
305
|
-
"resolve_semantic",
|
|
306
|
-
"resolve_task_run",
|
|
307
|
-
"start_task_run",
|
|
308
|
-
"get_task_run",
|
|
309
|
-
"list_task_run_events",
|
|
310
|
-
"continue_task_run",
|
|
311
|
-
"cancel_task_run",
|
|
312
|
-
"retry_task_run",
|
|
313
|
-
"resolve_runtime",
|
|
314
|
-
"create_observation",
|
|
315
|
-
"record_user_feedback",
|
|
316
|
-
"record_business_outcome",
|
|
317
|
-
"submit_teach_evidence",
|
|
318
|
-
"get_teach_behavior_set",
|
|
319
|
-
"create_teach_proposal",
|
|
320
|
-
"accept_teach_recommendation",
|
|
321
|
-
"start_evaluation",
|
|
322
|
-
"get_evaluation",
|
|
323
|
-
"get_evaluation_comparison",
|
|
324
|
-
"create_behavior_revision_candidate",
|
|
325
|
-
"evaluate_behavior_revision_candidate",
|
|
326
|
-
"accept_behavior_revision_candidate",
|
|
327
|
-
"create_pack_revision",
|
|
328
|
-
"transition_pack_revision",
|
|
329
|
-
"materialize_pack_revision",
|
|
330
|
-
"diagnose_pack",
|
|
331
|
-
"get_pack",
|
|
332
|
-
"list_evaluations",
|
|
333
|
-
"evaluate_pack",
|
|
334
|
-
"import_pack",
|
|
335
|
-
"install_pack",
|
|
336
|
-
"approve_pack",
|
|
337
|
-
"release_pack",
|
|
338
|
-
"serve_behavior_projection",
|
|
339
|
-
"list_behavior_strategies",
|
|
340
|
-
"get_behavior_strategy",
|
|
341
|
-
"simulate_behavior_strategy",
|
|
342
|
-
"get_strategy_execution_trace",
|
|
343
|
-
"continue_strategy_execution",
|
|
344
|
-
"list_inbox",
|
|
345
|
-
"mark_inbox_read",
|
|
346
|
-
"inspect_conflicts",
|
|
347
|
-
"get_conflict_inspection",
|
|
348
|
-
"resolve_conflict"
|
|
349
|
-
]);
|
|
350
1095
|
var genericTools = [
|
|
351
|
-
{ name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: input({ path: z.string().
|
|
352
|
-
{ name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", inputSchema: input({ path: z.string().
|
|
1096
|
+
{ name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: input({ path: z.string().min(4), pathParams: z.record(z.string(), z.string()).optional(), query: z.record(z.string(), z.unknown()).optional() }), run: readControlApi },
|
|
1097
|
+
{ name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", inputSchema: input({ path: z.string().min(4), method: z.enum(["POST", "PUT", "PATCH", "DELETE"]).default("POST"), pathParams: z.record(z.string(), z.string()).optional(), query: z.record(z.string(), z.unknown()).optional(), body: z.record(z.string(), z.unknown()), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: writeControlApi }
|
|
353
1098
|
];
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
get_pack: "PACK DETAIL READ: inspect one Pack\u2019s manifest, digest, status, conflicts, and materialization metadata. Required: packId. Read-only; it never releases.",
|
|
363
|
-
list_evaluations: "EVALUATION READ: list scoped evaluation records. Pagination and status are optional; use start_evaluation to run one and get_evaluation for full provenance.",
|
|
364
|
-
mark_inbox_read: "REVIEW STATE: mark one notification returned by list_inbox as read after reviewing it. Required: notificationId. Repeated calls are safe and change only that notification\u2019s read state; use list_inbox first to discover IDs.",
|
|
365
|
-
serve_behavior_projection: "RUNTIME PROJECTION: use after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. Required: input and provider; programId is optional when the active pointer is unambiguous. Do not use this tool for authoring, classification, candidate evaluation, model calls, or host actions. Use compile_behavior_capsule for pre-model context, resolve_runtime/executeRuntime for enforcement, and evaluate_behavior_revision_candidate for unreleased candidate testing.",
|
|
366
|
-
resolve_semantic: "ROUTING 1/3: classify input into registered Semantic Tasks and intent candidates. It never resolves runtime authority or executes; follow with resolve_runtime for one selected BehaviorPoint or resolve_task_run for AUTO/multi-task planning.",
|
|
367
|
-
resolve_runtime: "ROUTING 2/3: resolve one already-selected BehaviorPoint into released runtime authority. It does not classify text or execute; use resolve_task_run/start_task_run for TaskRun execution.",
|
|
368
|
-
resolve_task_run: "ROUTING 2/3 FOR TASKRUN: preview server-owned AUTO mode and the SINGLE/STRATEGY/COMPOUND/HYBRID child plan. It never executes; call start_task_run after inspection.",
|
|
369
|
-
start_evaluation: "EVALUATION ENTRYPOINT: start a standalone dataset/evaluation-plan run, including comparative execution. Use evaluate_pack for an imported Pack and evaluate_behavior_revision_candidate for one immutable candidate.",
|
|
370
|
-
evaluate_pack: "PACK LIFECYCLE EVALUATION: evaluate one imported/installed Pack before approve_pack/release_pack. It is not start_evaluation and not evaluate_behavior_revision_candidate.",
|
|
371
|
-
evaluate_behavior_revision_candidate: "CANDIDATE EVALUATION ONLY: execute a real dataset against exactly one immutable candidate. It does not evaluate/release the parent Pack or grant human approval.",
|
|
372
|
-
approve_pack: "PACK APPROVAL: record human approval for a passed imported/installed Pack evaluation; use before release_pack. For a Pack Revision use transition_pack_revision approve.",
|
|
373
|
-
release_pack: "PACK FINAL STEP: release an already evaluated and approved imported/installed Pack. For a Pack Revision use transition_pack_revision release.",
|
|
374
|
-
transition_pack_revision: "PACK REVISION STATE MACHINE: validate, request approval, approve, release, or reject a Pack Revision. Do not substitute approve_pack/release_pack; those operate on imported Pack records."
|
|
375
|
-
};
|
|
376
|
-
var tools = Object.freeze([...fullTools.filter((tool) => promotedNames.has(tool.name)), ...genericTools].map((tool) => descriptionOverrides[tool.name] ? { ...tool, description: descriptionOverrides[tool.name] } : tool));
|
|
1099
|
+
var handlerDefinitions = [...fullTools, ...genericTools];
|
|
1100
|
+
if (new Set(handlerDefinitions.map((tool) => tool.name)).size !== handlerDefinitions.length) throw new Error("MCP_TOOL_HANDLER_DUPLICATE");
|
|
1101
|
+
var handlers = new Map(handlerDefinitions.map((tool) => [tool.name, tool]));
|
|
1102
|
+
var tools = Object.freeze(MCP_PUBLIC_TOOL_CATALOG.map((definition) => {
|
|
1103
|
+
const handler = handlers.get(definition.name);
|
|
1104
|
+
if (!handler) throw new Error("MCP_TOOL_HANDLER_MISSING:" + definition.name);
|
|
1105
|
+
return { ...handler, description: definition.description ?? handler.description, effectful: definition.effectful === true, annotations: definition.annotations, inputSchema: z.fromJSONSchema(definition.inputSchema) };
|
|
1106
|
+
}));
|
|
377
1107
|
if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
|
|
378
1108
|
var authorize = async (tool, args) => {
|
|
379
1109
|
if (!tool.effectful) return;
|
|
1110
|
+
const authorityArguments = sanitizeMcpAuthorityArguments(tool.name, args);
|
|
380
1111
|
const decision = (await viraHttpRequest(authorityUrl, {
|
|
1112
|
+
...mcpHttpOptions,
|
|
381
1113
|
method: "POST",
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
idempotencyKey: `mcp:authorize:${tool.name}`
|
|
1114
|
+
body: { tool: tool.name, arguments: authorityArguments, scope },
|
|
1115
|
+
idempotencyKey: newMcpAuthorizationKey(tool.name)
|
|
385
1116
|
})).body;
|
|
386
|
-
|
|
1117
|
+
assertMcpAuthorityDecisionReceipt(decision);
|
|
387
1118
|
};
|
|
388
|
-
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.
|
|
1119
|
+
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.90" }, { capabilities: { tools: {} } });
|
|
389
1120
|
for (const tool of tools) {
|
|
390
|
-
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
|
|
1121
|
+
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema, outputSchema: z.fromJSONSchema(MCP_PUBLIC_TOOL_CATALOG.find((item) => item.name === tool.name).outputSchema), annotations: tool.annotations }, async (raw) => {
|
|
391
1122
|
const args = raw;
|
|
392
|
-
scopeQuery(args);
|
|
1123
|
+
scopeQuery(args, ["list_ai_usage_receipts", "get_ai_usage_summary"].includes(tool.name));
|
|
393
1124
|
try {
|
|
394
1125
|
await authorize(tool, args);
|
|
395
1126
|
const apiArgs = Object.fromEntries(Object.entries(args).filter(([key]) => !(key in scope)));
|
|
396
|
-
const result = await tool.run(apiArgs);
|
|
397
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
1127
|
+
const result = unwrapMcpClientResponse(await tool.run(apiArgs));
|
|
1128
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }], structuredContent: { result } };
|
|
398
1129
|
} catch (error) {
|
|
399
|
-
|
|
1130
|
+
const message = error instanceof Error ? error.message : "VIRA_MCP_REQUEST_FAILED";
|
|
1131
|
+
return { isError: true, content: [{ type: "text", text: message }], structuredContent: { result: message } };
|
|
400
1132
|
}
|
|
401
1133
|
});
|
|
402
1134
|
}
|