@rudderhq/cli 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ var init_chat_work_manifest = __esm({
43
43
  });
44
44
 
45
45
  // ../packages/shared/dist/constants.js
46
- var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_OREO_ICON_PREFIX, AGENT_OREO_SHAPE_IDS, AGENT_OREO_PALETTE_IDS, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, AGENT_INTEGRATION_PROVIDERS, AGENT_INTEGRATION_STATUSES, AGENT_INTEGRATION_TRANSPORTS, AGENT_INTEGRATION_PROVIDER_REGIONS, AGENT_INTEGRATION_CHAT_TYPES, AGENT_INTEGRATION_DROP_REASONS, AGENT_INTEGRATION_OUTBOUND_STATUSES, RUDDER_AGENT_V1_MCP_TOOL_NAMES, RUDDER_BROWSER_MCP_TOOL_NAMES2, RUDDER_CORE_MCP_TOOL_NAMES2, CUSTOM_INTEGRATION_KINDS, CUSTOM_INTEGRATION_SCOPES, CUSTOM_INTEGRATION_STATUSES, CUSTOM_INTEGRATION_TOOL_STATUSES, CUSTOM_INTEGRATION_BINDING_STATUSES, CUSTOM_INTEGRATION_TOOL_CALL_STATUSES, MCP_CONNECTION_PROVIDERS, MCP_CONNECTION_TRANSPORTS, MCP_CONNECTION_ACCESS_MODES, MCP_AGENT_ACCESS_MODES, MCP_CONNECTION_CANONICAL_STATES, MCP_PROVIDER_SCOPE_MODES, MCP_PROVIDER_ORGANIZATION_STATES, MCP_TOOL_CAPABILITY_CLASSES, MCP_CONNECTION_STATUSES, MCP_OAUTH_GRANT_STATUSES, MCP_AGENT_BINDING_STATUSES, MCP_OAUTH_SESSION_TTL_MS, MCP_PROVIDER_CATALOG, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, ORGANIZATION_RESOURCE_SOURCE_TYPES, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, PROJECT_ICONS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
46
+ var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_OREO_ICON_PREFIX, AGENT_OREO_SHAPE_IDS, AGENT_OREO_PALETTE_IDS, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, AGENT_INTEGRATION_PROVIDERS, AGENT_INTEGRATION_STATUSES, AGENT_INTEGRATION_TRANSPORTS, AGENT_INTEGRATION_PROVIDER_REGIONS, AGENT_INTEGRATION_CHAT_TYPES, AGENT_INTEGRATION_DROP_REASONS, AGENT_INTEGRATION_OUTBOUND_STATUSES, RUDDER_AGENT_V1_MCP_TOOL_NAMES, RUDDER_BROWSER_MCP_TOOL_NAMES2, RUDDER_CORE_MCP_TOOL_NAMES2, CUSTOM_INTEGRATION_KINDS, CUSTOM_INTEGRATION_SCOPES, CUSTOM_INTEGRATION_STATUSES, CUSTOM_INTEGRATION_TOOL_STATUSES, CUSTOM_INTEGRATION_BINDING_STATUSES, CUSTOM_INTEGRATION_TOOL_CALL_STATUSES, MCP_CONNECTION_PROVIDERS, MCP_CONNECTION_TRANSPORTS, MCP_CONNECTION_SCOPES, MCP_CONNECTION_ACCESS_MODES, MCP_AGENT_ACCESS_MODES, MCP_CONNECTION_CANONICAL_STATES, MCP_PROVIDER_SCOPE_MODES, MCP_PROVIDER_ORGANIZATION_STATES, MCP_TOOL_CAPABILITY_CLASSES, MCP_CONNECTION_STATUSES, MCP_OAUTH_GRANT_STATUSES, MCP_AGENT_BINDING_STATUSES, MCP_OAUTH_SESSION_TTL_MS, MCP_PROVIDER_CATALOG, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, ORGANIZATION_RESOURCE_SOURCE_TYPES, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, PROJECT_ICONS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
47
47
  var init_constants = __esm({
48
48
  "../packages/shared/dist/constants.js"() {
49
49
  "use strict";
@@ -225,6 +225,7 @@ var init_constants = __esm({
225
225
  "rudder_agent_skills_enable",
226
226
  "rudder_agent_skills_sync",
227
227
  "rudder_issue_get",
228
+ "rudder_issue_list",
228
229
  "rudder_issue_search",
229
230
  "rudder_issue_context",
230
231
  "rudder_issue_checkout",
@@ -322,6 +323,7 @@ var init_constants = __esm({
322
323
  CUSTOM_INTEGRATION_TOOL_CALL_STATUSES = ["success", "error", "blocked"];
323
324
  MCP_CONNECTION_PROVIDERS = ["supabase", "linear", "notion", "custom"];
324
325
  MCP_CONNECTION_TRANSPORTS = ["stdio", "streamable_http", "legacy_manual"];
326
+ MCP_CONNECTION_SCOPES = ["organization", "agent"];
325
327
  MCP_CONNECTION_ACCESS_MODES = ["provider_default", "read_only", "read_write"];
326
328
  MCP_AGENT_ACCESS_MODES = [
327
329
  "none",
@@ -365,11 +367,11 @@ var init_constants = __esm({
365
367
  label: "Supabase",
366
368
  curated: true,
367
369
  requiresOAuth: true,
368
- requiresScopeSelection: true,
369
- scopeLabel: "Project",
370
+ requiresScopeSelection: false,
371
+ scopeLabel: "Account",
370
372
  transports: ["streamable_http"],
371
373
  accessModes: ["read_only", "read_write"],
372
- defaultAccessMode: "read_only"
374
+ defaultAccessMode: "read_write"
373
375
  },
374
376
  {
375
377
  id: "linear",
@@ -870,7 +872,7 @@ var init_custom_integration = __esm({
870
872
  import { z as z2 } from "zod";
871
873
  function defaultAccessMode(provider) {
872
874
  if (provider === "supabase")
873
- return "read_only";
875
+ return "read_write";
874
876
  if (provider === "linear")
875
877
  return "read_write";
876
878
  return "provider_default";
@@ -1020,7 +1022,7 @@ function validateConnectionSecretMutation(value, ctx) {
1020
1022
  }
1021
1023
  }
1022
1024
  }
1023
- var uuidSchema, timestampSchema, connectionNameSchema, reservedMcpConnectionNames, environmentNameSchema, externalMcpToolNameSchema, externalMcpToolFilterSchema, mcpConnectionProviderSchema, mcpConnectionTransportSchema, mcpConnectionAccessModeSchema, mcpAgentAccessModeSchema, mcpConnectionCanonicalStateSchema, mcpProviderScopeModeSchema, mcpProviderOrganizationStateSchema, mcpToolCapabilityClassSchema, mcpProviderMaxAccessSchema, mcpConnectionStatusSchema, mcpOAuthGrantStatusSchema, mcpAgentBindingStatusSchema, stringMapSchema, environmentValueMapSchema, safeHeaderSchema, mcpStdioSafeConfigSchema, mcpStreamableHttpSafeConfigSchema, mcpConnectionSecretsMutationSchema, mcpLegacyManualSafeConfigSchema, mcpCuratedSafeConfigSchema, mcpConnectionSafeConfigSchema, mcpConnectionInputFields, providerAccessModes, createMcpConnectionSchema, updateMcpConnectionSchema, mcpConnectionMergedConfigFields, mcpConnectionMergedConfigSchema, mcpConnectionMutationConfigSchema, mcpConnectionSummarySchema, mcpProviderCatalogEntrySchema, mcpProviderCatalogSchema, mcpOAuthStartSchema, mcpOAuthStartResponseSchema, mcpOAuthCallbackSchema, mcpScopeSelectionSchema, mcpExternalScopeOptionSchema, mcpOAuthGrantSummarySchema, mcpDiscoveredToolSchema, mcpAgentBindingSchema, mcpAgentConnectionSummarySchema, upsertMcpAgentBindingSchema, updateMcpAgentBindingSchema, managedExternalMcpBindingSchema, managedExternalMcpBindingsSchema, mcpProviderAvailabilitySchema;
1025
+ var uuidSchema, timestampSchema, connectionNameSchema, reservedMcpConnectionNames, environmentNameSchema, externalMcpToolNameSchema, externalMcpToolFilterSchema, mcpConnectionProviderSchema, mcpConnectionScopeSchema, mcpConnectionTransportSchema, mcpConnectionAccessModeSchema, mcpAgentAccessModeSchema, mcpConnectionCanonicalStateSchema, mcpProviderScopeModeSchema, mcpProviderOrganizationStateSchema, mcpToolCapabilityClassSchema, mcpProviderMaxAccessSchema, mcpConnectionStatusSchema, mcpOAuthGrantStatusSchema, mcpAgentBindingStatusSchema, stringMapSchema, environmentValueMapSchema, safeHeaderSchema, mcpStdioSafeConfigSchema, mcpStreamableHttpSafeConfigSchema, mcpConnectionSecretsMutationSchema, mcpLegacyManualSafeConfigSchema, mcpCuratedSafeConfigSchema, mcpConnectionSafeConfigSchema, mcpConnectionInputFields, providerAccessModes, createMcpConnectionSchema, updateMcpConnectionSchema, mcpConnectionMergedConfigFields, mcpConnectionMergedConfigSchema, mcpConnectionMutationConfigSchema, mcpConnectionSummarySchema, mcpProviderCatalogEntrySchema, mcpProviderCatalogSchema, mcpOAuthStartSchema, mcpOAuthStartResponseSchema, mcpOAuthCallbackSchema, mcpScopeSelectionSchema, mcpExternalScopeOptionSchema, mcpOAuthGrantSummarySchema, mcpDiscoveredToolSchema, mcpAgentBindingSchema, mcpAgentConnectionSummarySchema, upsertMcpAgentBindingSchema, updateMcpAgentBindingSchema, managedExternalMcpBindingSchema, managedExternalMcpBindingsSchema, mcpProviderAvailabilitySchema;
1024
1026
  var init_mcp = __esm({
1025
1027
  "../packages/shared/dist/validators/mcp.js"() {
1026
1028
  "use strict";
@@ -1033,6 +1035,7 @@ var init_mcp = __esm({
1033
1035
  externalMcpToolNameSchema = z2.string().min(1).max(128).regex(/^[A-Za-z0-9_.-]+$/, "Use an exact MCP tool name");
1034
1036
  externalMcpToolFilterSchema = z2.array(externalMcpToolNameSchema).max(500);
1035
1037
  mcpConnectionProviderSchema = z2.enum(MCP_CONNECTION_PROVIDERS);
1038
+ mcpConnectionScopeSchema = z2.enum(MCP_CONNECTION_SCOPES);
1036
1039
  mcpConnectionTransportSchema = z2.enum(MCP_CONNECTION_TRANSPORTS);
1037
1040
  mcpConnectionAccessModeSchema = z2.enum(MCP_CONNECTION_ACCESS_MODES);
1038
1041
  mcpAgentAccessModeSchema = z2.enum(MCP_AGENT_ACCESS_MODES);
@@ -1146,6 +1149,8 @@ var init_mcp = __esm({
1146
1149
  name: connectionNameSchema,
1147
1150
  displayName: z2.string().trim().min(1).max(120),
1148
1151
  provider: mcpConnectionProviderSchema,
1152
+ scope: mcpConnectionScopeSchema,
1153
+ ownerAgentId: uuidSchema.optional().nullable(),
1149
1154
  transport: mcpConnectionTransportSchema,
1150
1155
  externalScope: z2.string().trim().min(1).max(512).optional().nullable(),
1151
1156
  accessMode: mcpConnectionAccessModeSchema.optional(),
@@ -1163,6 +1168,21 @@ var init_mcp = __esm({
1163
1168
  custom: ["provider_default", "read_only", "read_write"]
1164
1169
  };
1165
1170
  createMcpConnectionSchema = z2.object(mcpConnectionInputFields).strict().superRefine((value, ctx) => {
1171
+ if (value.scope === "organization" && value.ownerAgentId) {
1172
+ ctx.addIssue({
1173
+ code: z2.ZodIssueCode.custom,
1174
+ path: ["ownerAgentId"],
1175
+ message: "Organization MCP connections cannot have an owner agent"
1176
+ });
1177
+ }
1178
+ if (value.scope === "agent" && !value.ownerAgentId) {
1179
+ ctx.addIssue({
1180
+ code: z2.ZodIssueCode.custom,
1181
+ path: ["ownerAgentId"],
1182
+ message: "Agent MCP connections require an owner agent"
1183
+ });
1184
+ }
1185
+ }).superRefine((value, ctx) => {
1166
1186
  if (reservedMcpConnectionNames.has(value.name)) {
1167
1187
  ctx.addIssue({
1168
1188
  code: z2.ZodIssueCode.custom,
@@ -1206,6 +1226,8 @@ var init_mcp = __esm({
1206
1226
  mcpConnectionSummarySchema = z2.object({
1207
1227
  id: uuidSchema,
1208
1228
  orgId: uuidSchema,
1229
+ scope: mcpConnectionScopeSchema,
1230
+ ownerAgentId: uuidSchema.nullable(),
1209
1231
  name: connectionNameSchema,
1210
1232
  displayName: z2.string().min(1).max(120),
1211
1233
  provider: mcpConnectionProviderSchema,
@@ -1356,11 +1378,21 @@ var init_mcp = __esm({
1356
1378
  scopeMode: mcpProviderScopeModeSchema.nullable(),
1357
1379
  revision: z2.number().int().positive().nullable(),
1358
1380
  affectedAgentCount: z2.number().int().nonnegative().optional(),
1381
+ agentConnectionCount: z2.number().int().nonnegative().optional(),
1359
1382
  historicalGrantConnectionIds: z2.array(uuidSchema).max(100).optional()
1360
1383
  }).strict(),
1361
1384
  agent: z2.object({
1362
1385
  access: mcpAgentAccessModeSchema,
1363
- activeRunUsesOlderPolicy: z2.boolean()
1386
+ activeRunUsesOlderPolicy: z2.boolean(),
1387
+ connection: z2.object({
1388
+ state: mcpProviderOrganizationStateSchema,
1389
+ connectionId: uuidSchema,
1390
+ maxAccess: mcpProviderMaxAccessSchema,
1391
+ revision: z2.number().int().positive()
1392
+ }).strict().nullable().default(null),
1393
+ effectiveSource: z2.enum(["agent", "organization", "none"]).default("none"),
1394
+ effectiveConnectionId: uuidSchema.nullable().default(null),
1395
+ explicitlyDisabled: z2.boolean().default(false)
1364
1396
  }).strict().optional()
1365
1397
  }).strict().superRefine((value, ctx) => {
1366
1398
  const connectedState = value.organization.state === "connected";
@@ -8894,6 +8926,15 @@ var RUDDER_MCP_TOOL_DESCRIPTORS = [
8894
8926
  "requiresAgentId": false,
8895
8927
  "attachesRunIdWhenAvailable": false
8896
8928
  },
8929
+ {
8930
+ "capabilityId": "issue.list",
8931
+ "name": "rudder_issue_list",
8932
+ "description": "List issues with optional status, assignee, and project filters without requiring a search query.",
8933
+ "mutating": false,
8934
+ "requiresOrgId": true,
8935
+ "requiresAgentId": false,
8936
+ "attachesRunIdWhenAvailable": false
8937
+ },
8897
8938
  {
8898
8939
  "capabilityId": "issue.search",
8899
8940
  "name": "rudder_issue_search",
@@ -9672,18 +9713,6 @@ var RUDDER_MCP_TOOL_DESCRIPTORS = [
9672
9713
 
9673
9714
  // ../packages/agent-runtime-utils/dist/rudder-mcp-contract.js
9674
9715
  var RUDDER_MCP_CONTRACT_VERSION = "rudder.agent-mcp-tools/v1";
9675
- function mcpString(description) {
9676
- return { type: "string", description };
9677
- }
9678
- function mcpBoolean(description) {
9679
- return { type: "boolean", description };
9680
- }
9681
- function mcpNumber(description) {
9682
- return { type: "number", description };
9683
- }
9684
- function mcpStringArray(description) {
9685
- return { type: "array", items: { type: "string" }, description };
9686
- }
9687
9716
  function browserMcpInputSchema(id) {
9688
9717
  const string = (description, extra = {}) => ({ type: "string", description, ...extra });
9689
9718
  const number = (description, extra = {}) => ({ type: "number", description, ...extra });
@@ -9866,229 +9895,444 @@ function browserMcpInputSchema(id) {
9866
9895
  function rudderMcpInputSchemaForCapability(id) {
9867
9896
  if (id.startsWith("browser."))
9868
9897
  return browserMcpInputSchema(id);
9869
- const properties = {};
9870
- const add = (key, value) => {
9871
- properties[key] = value;
9872
- };
9873
- if (id.startsWith("runs.")) {
9874
- const addString = (key, description) => add(key, mcpString(description));
9875
- const addNumber = (key, description) => add(key, mcpNumber(description));
9876
- const addBoolean = (key, description) => add(key, mcpBoolean(description));
9877
- switch (id) {
9878
- case "runs.list":
9879
- addString("updatedAfter", "Only runs updated after this timestamp.");
9880
- addString("runIdPrefix", "Run id prefix filter.");
9881
- addString("relatedAgentId", "Agent id filter.");
9882
- addString("status", "Run status filter.");
9883
- addString("runtime", "Runtime type filter.");
9884
- addString("issueId", "Linked issue id filter.");
9885
- addString("usedSkill", "Used skill filter.");
9886
- addString("loadedSkill", "Loaded skill filter.");
9887
- addString("createdBefore", "Only runs created before this timestamp.");
9888
- addString("cursor", "Stable summary cursor.");
9889
- addNumber("limit", "Summary page size, capped by the server.");
9890
- break;
9891
- case "runs.by-skill":
9892
- addString("skill", "Skill key or display name.");
9893
- addString("evidence", "Evidence type: used or loaded.");
9894
- addString("relatedAgentId", "Agent id filter.");
9895
- addString("status", "Run status filter.");
9896
- addString("runtime", "Runtime type filter.");
9897
- addString("issueId", "Linked issue id filter.");
9898
- addString("createdBefore", "Only runs created before this timestamp.");
9899
- addString("cursor", "Stable summary cursor.");
9900
- addNumber("limit", "Summary page size, capped by the server.");
9901
- break;
9902
- case "runs.events":
9903
- addString("run", "Run id or short run id.");
9904
- addString("cursor", "Opaque total-order event cursor.");
9905
- addNumber("afterSeq", "Legacy sequence-only cursor.");
9906
- addNumber("limit", "Event page size, capped by the server.");
9907
- addNumber("maxChars", "Maximum payload preview characters per event.");
9908
- break;
9909
- case "runs.log":
9910
- addString("run", "Run id or short run id.");
9911
- addNumber("maxChars", "Maximum log characters for display.");
9912
- addNumber("offset", "Byte offset for the ranged read.");
9913
- addNumber("limitBytes", "Maximum bytes for the ranged read.");
9914
- break;
9915
- case "runs.transcript":
9916
- addString("run", "Run id or short run id.");
9917
- addBoolean("errorsOnly", "Return only error rows.");
9918
- addString("aroundError", "Transcript error step id.");
9919
- addNumber("contextTurns", "Turns around the selected error.");
9920
- addString("cursor", "Stable transcript cursor.");
9921
- addNumber("turnLimit", "Maximum turns to return.");
9922
- addBoolean("chronological", "Return oldest-first rows.");
9923
- addBoolean("narrative", "Use narrative row formatting.");
9924
- addNumber("maxChars", "Maximum output characters per row.");
9925
- addBoolean("includeOutput", "Include clipped row output.");
9926
- break;
9927
- case "runs.errors":
9928
- addString("run", "Run id or short run id.");
9929
- addString("cursor", "Error page cursor.");
9930
- addNumber("maxChars", "Maximum output characters per error.");
9931
- break;
9932
- default:
9933
- addString("run", "Run id or short run id.");
9934
- break;
9935
- }
9936
- return { type: "object", additionalProperties: false, properties };
9937
- }
9938
- if (id.startsWith("issue.")) {
9939
- add("issue", mcpString("Issue UUID, identifier, or short reference."));
9940
- add("body", mcpString("Direct Markdown body for issue comments or close-out notes."));
9941
- add("comment", mcpString("Direct Markdown review, blocker, or completion comment."));
9942
- add("images", { type: "array", items: { type: "string" }, description: "Local image paths to attach when supported." });
9943
- }
9944
- if (id.startsWith("project."))
9945
- add("project", mcpString("Project UUID or shortname."));
9946
- if (id.startsWith("library.file.")) {
9947
- add("path", mcpString("Library-relative file or directory path."));
9948
- if (id === "library.file.list") {
9949
- add("directory", mcpString("Library-relative directory path. Defaults to the run's project Library path when available."));
9950
- }
9951
- add("body", mcpString("Direct file content for put operations."));
9952
- }
9953
- if (id.startsWith("approval.")) {
9954
- add("approval", mcpString("Approval UUID or short reference."));
9955
- add("body", mcpString("Direct Markdown approval comment body."));
9956
- }
9957
- if (id.startsWith("skill.")) {
9958
- add("skill", mcpString("Organization skill id."));
9959
- add("path", mcpString("Skill package file path, such as SKILL.md."));
9960
- }
9961
- if (id.startsWith("browser.")) {
9962
- add("url", mcpString("HTTP or HTTPS URL."));
9963
- add("tabId", mcpString("Run-owned Rudder Browser tab id."));
9964
- add("ref", mcpString("Element reference returned by rudder_browser_read."));
9965
- add("text", mcpString("Text to enter into the referenced element."));
9966
- }
9967
- if (id.startsWith("automation.")) {
9968
- add("automation", mcpString("Automation id."));
9969
- add("trigger", mcpString("Automation trigger id."));
9970
- add("payload", { type: ["object", "string"], description: "JSON payload object or JSON string." });
9971
- }
9972
- if (id.startsWith("chat.")) {
9973
- add("chat", mcpString("Chat conversation id."));
9974
- add("body", mcpString("Agent-authored chat message body."));
9975
- }
9976
- if (id.startsWith("agent.skills.")) {
9977
- add("selectionRefs", { type: "array", items: { type: "string" }, description: "Skill selection refs." });
9978
- add("skills", { type: "array", items: { type: "string" }, description: "Skill selection refs alias." });
9979
- add("desiredSkills", mcpString("Comma-separated desired skill refs for sync."));
9980
- }
9981
- for (const [key, description] of Object.entries({
9982
- query: "Search query.",
9983
- decision: "Structured review decision.",
9984
- title: "Title.",
9985
- name: "Name.",
9986
- description: "Description or summary text.",
9987
- status: "Status filter or new status.",
9988
- cursor: "Pagination cursor.",
9989
- source: "Source path or source label.",
9990
- kind: "Trigger kind.",
9991
- label: "Trigger label.",
9992
- skill: "Skill key, id, or display name.",
9993
- slug: "Slug.",
9994
- markdown: "Direct Markdown content.",
9995
- role: "Agent role.",
9996
- capabilities: "Agent capability summary.",
9997
- wakeCommentId: "Issue comment id that triggered the wake.",
9998
- expectedStatuses: "Comma-separated checkout precondition statuses.",
9999
- after: "Pagination anchor or lower bound.",
10000
- order: "Sort order.",
10001
- priority: "Issue or automation priority.",
10002
- assigneeAgentId: "Target assignee agent id or reference.",
10003
- projectId: "Project id or reference.",
10004
- goalId: "Goal id or reference.",
10005
- parentId: "Parent issue id or reference.",
10006
- parentIssueId: "Parent issue id or reference.",
10007
- requestDepth: "Requested issue depth.",
10008
- billingCode: "Billing code.",
10009
- hiddenAt: "Hidden timestamp.",
10010
- archivedAt: "Archived timestamp.",
10011
- targetDate: "Target date.",
10012
- color: "Display color.",
10013
- scope: "Search or visibility scope.",
10014
- sha: "Git commit SHA.",
10015
- message: "Commit or status message.",
10016
- branch: "Git branch name.",
10017
- repoPath: "Repository path.",
10018
- workspacePath: "Workspace path.",
10019
- relatedAgentId: "Agent id used as a filter or related principal.",
10020
- leadAgentId: "Lead agent id or reference.",
10021
- approvalId: "Approval id or short approval id alias.",
10022
- automationId: "Automation id alias.",
10023
- chatId: "Chat conversation id alias.",
10024
- commentId: "Issue comment id alias.",
10025
- skillId: "Skill id alias.",
10026
- user: "User id, reference, or self.",
10027
- since: "Activity start timestamp.",
10028
- until: "Activity end timestamp.",
10029
- include: "Comma-separated optional data sections.",
10030
- content: "Direct content alias for body.",
10031
- roots: "Comma-separated local roots.",
10032
- projectIds: "Comma-separated project ids.",
10033
- workspaceIds: "Comma-separated workspace ids.",
10034
- cronExpression: "Cron expression.",
10035
- timezone: "Timezone.",
10036
- signingMode: "Webhook signing mode.",
10037
- replayWindowSec: "Webhook replay window in seconds.",
10038
- instructions: "Automation instructions.",
10039
- outputMode: "Automation output mode.",
10040
- concurrencyPolicy: "Automation concurrency policy.",
10041
- catchUpPolicy: "Automation catch-up policy.",
10042
- triggerId: "Automation trigger id.",
10043
- idempotencyKey: "Idempotency key.",
10044
- summary: "Chat summary.",
10045
- preferredAgentId: "Preferred responding agent id or reference.",
10046
- issueCreationMode: "Chat issue creation mode.",
10047
- editUserMessageId: "User message id to edit.",
10048
- updatedAfter: "Run updated-after timestamp.",
10049
- runIdPrefix: "Run id prefix filter.",
10050
- runtime: "Runtime type filter.",
10051
- issueId: "Issue id filter.",
10052
- usedSkill: "Used skill filter.",
10053
- loadedSkill: "Loaded skill filter.",
10054
- createdBefore: "Created-before timestamp.",
10055
- evidence: "Skill evidence type.",
10056
- aroundError: "Transcript error step id.",
10057
- maxOutputChars: "Maximum output characters."
10058
- })) {
10059
- add(key, mcpString(description));
10060
- }
10061
- for (const [key, description] of Object.entries({
10062
- limit: "Page size or result limit.",
10063
- count: "Count represented by a report.",
10064
- turnLimit: "Maximum turns to return.",
10065
- contextTurns: "Number of context turns.",
10066
- maxChars: "Maximum characters.",
10067
- snippetChars: "Maximum snippet characters.",
10068
- afterSeq: "Return events after this sequence number.",
10069
- offset: "Byte offset for ranged reads.",
10070
- limitBytes: "Maximum bytes for ranged reads."
10071
- })) {
10072
- add(key, mcpNumber(description));
10073
- }
10074
- for (const [key, description] of Object.entries({
10075
- selectionRefs: "Skill selection refs.",
10076
- selections: "Skill selection refs alias.",
10077
- skills: "Skill selection refs alias.",
10078
- images: "Local image paths to attach when supported.",
10079
- goalIds: "Goal ids."
10080
- })) {
10081
- add(key, mcpStringArray(description));
10082
- }
10083
- for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit", "full"]) {
10084
- add(key, mcpBoolean(`Boolean option ${key}.`));
10085
- }
10086
- return {
9898
+ return coreMcpInputSchema(id);
9899
+ }
9900
+ function coreMcpInputSchema(id) {
9901
+ const string = (description, extra = {}) => ({
9902
+ type: "string",
9903
+ description,
9904
+ minLength: 1,
9905
+ maxLength: 1e5,
9906
+ ...extra
9907
+ });
9908
+ const number = (description, minimum = 0, maximum = 1e4) => ({
9909
+ type: "number",
9910
+ description,
9911
+ minimum,
9912
+ maximum
9913
+ });
9914
+ const boolean = (description) => ({ type: "boolean", description });
9915
+ const strings = (description, maxItems = 100) => ({
9916
+ type: "array",
9917
+ description,
9918
+ maxItems,
9919
+ items: string(description, { maxLength: 8192 })
9920
+ });
9921
+ const payload = { type: ["object", "string"], description: "JSON payload object or JSON string." };
9922
+ const schema = (properties, required = []) => ({
10087
9923
  type: "object",
10088
9924
  additionalProperties: false,
10089
9925
  properties,
10090
- ...id === "chat.create" ? { required: ["body"] } : {}
10091
- };
9926
+ ...required.length > 0 ? { required } : {}
9927
+ });
9928
+ const issue = string("Issue UUID, identifier, or short reference.", { maxLength: 200 });
9929
+ const project = string("Project UUID or shortname.", { maxLength: 200 });
9930
+ const approval = string("Approval UUID or short reference.", { maxLength: 200 });
9931
+ const automation = string("Automation UUID or short reference.", { maxLength: 200 });
9932
+ const trigger = string("Automation trigger UUID or short reference.", { maxLength: 200 });
9933
+ const chat = string("Chat conversation UUID or short reference.", { maxLength: 200 });
9934
+ const run = string("Run UUID or short reference.", { maxLength: 200 });
9935
+ const cursor = string("Opaque pagination cursor.", { maxLength: 2e3 });
9936
+ const body = string("Direct Markdown body.", { maxLength: 5e5 });
9937
+ const images = strings("Local image paths to attach.", 20);
9938
+ switch (id) {
9939
+ case "agent.me":
9940
+ case "agent.inbox":
9941
+ case "agent.capabilities":
9942
+ case "project.list":
9943
+ case "skill.list":
9944
+ return schema({});
9945
+ case "agent.update":
9946
+ return schema({
9947
+ name: string("Agent name.", { maxLength: 200 }),
9948
+ role: string("Agent role.", { maxLength: 100 }),
9949
+ title: string("Agent title.", { maxLength: 300 }),
9950
+ capabilities: string("Agent capability summary."),
9951
+ description: string("Compatibility alias for capabilities."),
9952
+ clearTitle: boolean("Clear the current title."),
9953
+ clearCapabilities: boolean("Clear the current capability summary."),
9954
+ clearDescription: boolean("Compatibility alias for clearCapabilities.")
9955
+ });
9956
+ case "agent.skills.create":
9957
+ return schema({
9958
+ name: string("Skill display name.", { maxLength: 200 }),
9959
+ slug: string("Skill slug.", { maxLength: 200 }),
9960
+ description: string("Skill description."),
9961
+ markdown: string("SKILL.md content.", { maxLength: 5e5 }),
9962
+ body: string("Compatibility alias for markdown.", { maxLength: 5e5 }),
9963
+ enable: boolean("Enable the created skill for the runtime agent.")
9964
+ }, ["name"]);
9965
+ case "agent.skills.enable":
9966
+ return schema({ selectionRefs: strings("Skill selection references.", 100) }, ["selectionRefs"]);
9967
+ case "agent.skills.sync":
9968
+ return schema({ desiredSkills: string("Comma-separated desired skill references.", { maxLength: 2e4 }) }, ["desiredSkills"]);
9969
+ case "issue.list":
9970
+ return schema({
9971
+ status: string("Comma-separated issue statuses.", { maxLength: 500 }),
9972
+ assigneeAgentId: string("Assignee agent id or reference.", { maxLength: 200 }),
9973
+ projectId: string("Project id or reference.", { maxLength: 200 })
9974
+ });
9975
+ case "issue.get":
9976
+ return schema({ issue }, ["issue"]);
9977
+ case "issue.search":
9978
+ return schema({
9979
+ query: string("Non-empty server-side issue search query.", { maxLength: 2e3 }),
9980
+ status: string("Comma-separated issue statuses.", { maxLength: 500 }),
9981
+ assigneeAgentId: string("Assignee agent id or reference.", { maxLength: 200 }),
9982
+ projectId: string("Project id or reference.", { maxLength: 200 })
9983
+ }, ["query"]);
9984
+ case "issue.context":
9985
+ return schema({ issue, wakeCommentId: string("Wake comment id or short reference.", { maxLength: 200 }) }, ["issue"]);
9986
+ case "issue.checkout":
9987
+ return schema({ issue, expectedStatuses: string("Comma-separated allowed prior statuses.", { maxLength: 500 }) }, ["issue"]);
9988
+ case "issue.comment":
9989
+ return {
9990
+ ...schema({ issue, body, comment: body, images, reopen: boolean("Reopen the issue while commenting.") }, ["issue"]),
9991
+ anyOf: [{ required: ["body"] }, { required: ["comment"] }]
9992
+ };
9993
+ case "issue.comments.list":
9994
+ return schema({
9995
+ issue,
9996
+ after: string("Return comments after this comment id or short reference.", { maxLength: 200 }),
9997
+ order: string("Comment order.", { enum: ["asc", "desc"], maxLength: 10 })
9998
+ }, ["issue"]);
9999
+ case "issue.comments.get":
10000
+ return schema({ issue, comment: string("Comment id or short reference.", { maxLength: 200 }) }, ["issue", "comment"]);
10001
+ case "issue.update":
10002
+ return schema({
10003
+ issue,
10004
+ title: string("Issue title.", { maxLength: 500 }),
10005
+ description: string("Issue description.", { maxLength: 5e5 }),
10006
+ status: string("New issue status.", { maxLength: 100 }),
10007
+ priority: string("New issue priority.", { maxLength: 100 }),
10008
+ assigneeAgentId: string("Assignee agent id or reference.", { maxLength: 200 }),
10009
+ projectId: string("Project id or reference.", { maxLength: 200 }),
10010
+ goalId: string("Goal id or reference.", { maxLength: 200 }),
10011
+ parentId: string("Parent issue id or reference.", { maxLength: 200 }),
10012
+ requestDepth: string("Requested issue depth.", { maxLength: 30 }),
10013
+ billingCode: string("Billing code.", { maxLength: 200 }),
10014
+ hiddenAt: string("Hidden timestamp.", { maxLength: 100 }),
10015
+ comment: body,
10016
+ body,
10017
+ images
10018
+ }, ["issue"]);
10019
+ case "issue.review":
10020
+ return {
10021
+ ...schema({
10022
+ issue,
10023
+ decision: string("Structured review decision.", { enum: ["approve", "request_changes", "needs_followup", "blocked"], maxLength: 30 }),
10024
+ comment: body,
10025
+ body
10026
+ }, ["issue", "decision"]),
10027
+ anyOf: [{ required: ["comment"] }, { required: ["body"] }]
10028
+ };
10029
+ case "issue.commit":
10030
+ return schema({
10031
+ issue,
10032
+ sha: string("Git commit SHA.", { maxLength: 100 }),
10033
+ message: string("Commit subject or status message.", { maxLength: 2e3 }),
10034
+ branch: string("Git branch name.", { maxLength: 500 }),
10035
+ repoPath: string("Repository path.", { maxLength: 8192 }),
10036
+ workspacePath: string("Workspace path.", { maxLength: 8192 }),
10037
+ count: number("Number of commits represented.", 1, 1e4)
10038
+ }, ["issue", "sha", "message"]);
10039
+ case "issue.done":
10040
+ case "issue.block":
10041
+ return {
10042
+ ...schema({ issue, comment: body, body, images }, ["issue"]),
10043
+ anyOf: [{ required: ["comment"] }, { required: ["body"] }]
10044
+ };
10045
+ case "project.get":
10046
+ return schema({ project }, ["project"]);
10047
+ case "project.create":
10048
+ return schema({
10049
+ name: string("Project name.", { maxLength: 300 }),
10050
+ description: string("Project description.", { maxLength: 5e5 }),
10051
+ status: string("Project status.", { maxLength: 100 }),
10052
+ goalId: string("Goal id or reference.", { maxLength: 200 }),
10053
+ goalIds: strings("Goal ids.", 100),
10054
+ leadAgentId: string("Lead agent id or reference.", { maxLength: 200 }),
10055
+ targetDate: string("Target date.", { maxLength: 100 }),
10056
+ color: string("Display color.", { maxLength: 100 })
10057
+ }, ["name"]);
10058
+ case "project.update":
10059
+ return schema({
10060
+ project,
10061
+ name: string("Project name.", { maxLength: 300 }),
10062
+ description: string("Project description.", { maxLength: 5e5 }),
10063
+ status: string("Project status.", { maxLength: 100 }),
10064
+ goalId: string("Goal id or reference.", { maxLength: 200 }),
10065
+ goalIds: strings("Goal ids.", 100),
10066
+ leadAgentId: string("Lead agent id or reference.", { maxLength: 200 }),
10067
+ targetDate: string("Target date.", { maxLength: 100 }),
10068
+ color: string("Display color.", { maxLength: 100 }),
10069
+ archivedAt: string("Archive timestamp.", { maxLength: 100 })
10070
+ }, ["project"]);
10071
+ case "user.activity":
10072
+ return schema({
10073
+ user: string("User id, reference, or self.", { maxLength: 200 }),
10074
+ since: string("Activity start timestamp.", { maxLength: 100 }),
10075
+ until: string("Activity end timestamp.", { maxLength: 100 }),
10076
+ include: string("Comma-separated optional sections.", { maxLength: 500 }),
10077
+ relatedAgentId: string("Related agent id.", { maxLength: 200 }),
10078
+ projectId: string("Project id.", { maxLength: 200 }),
10079
+ issueId: string("Issue id.", { maxLength: 200 }),
10080
+ limit: number("Page size.", 1, 100),
10081
+ cursor
10082
+ });
10083
+ case "library.file.list":
10084
+ return schema({
10085
+ directory: string("Library-relative directory path.", { maxLength: 8192 }),
10086
+ path: string("Compatibility alias for directory.", { maxLength: 8192 })
10087
+ });
10088
+ case "library.file.get":
10089
+ case "library.file.ref":
10090
+ case "library.file.link":
10091
+ return schema({ path: string("Library-relative file path.", { maxLength: 8192 }) }, ["path"]);
10092
+ case "library.file.put":
10093
+ return {
10094
+ ...schema({
10095
+ path: string("Library-relative file path.", { maxLength: 8192 }),
10096
+ body: string("Direct file content.", { maxLength: 1e6 }),
10097
+ content: string("Compatibility alias for body.", { maxLength: 1e6 })
10098
+ }, ["path"]),
10099
+ anyOf: [{ required: ["body"] }, { required: ["content"] }]
10100
+ };
10101
+ case "approval.get":
10102
+ case "approval.issues":
10103
+ return schema({ approval }, ["approval"]);
10104
+ case "approval.comment":
10105
+ return {
10106
+ ...schema({ approval, body, comment: body }, ["approval"]),
10107
+ anyOf: [{ required: ["body"] }, { required: ["comment"] }]
10108
+ };
10109
+ case "skill.get":
10110
+ return schema({ skill: string("Organization skill id.", { maxLength: 200 }) }, ["skill"]);
10111
+ case "skill.file":
10112
+ return schema({
10113
+ skill: string("Organization skill id.", { maxLength: 200 }),
10114
+ path: string("Skill package file path.", { maxLength: 8192 })
10115
+ }, ["skill"]);
10116
+ case "skill.import":
10117
+ return schema({ source: string("Local path, URL, or repository reference.", { maxLength: 8192 }) }, ["source"]);
10118
+ case "skill.scan-local":
10119
+ return schema({ roots: string("Comma-separated local roots.", { maxLength: 2e4 }) });
10120
+ case "skill.scan-projects":
10121
+ return schema({
10122
+ projectIds: string("Comma-separated project ids.", { maxLength: 2e4 }),
10123
+ workspaceIds: string("Comma-separated workspace ids.", { maxLength: 2e4 })
10124
+ });
10125
+ case "automation.list":
10126
+ return schema({
10127
+ status: string("Automation status filter.", { maxLength: 100 }),
10128
+ assigneeAgentId: string("Assignee agent id.", { maxLength: 200 }),
10129
+ projectId: string("Project id.", { maxLength: 200 }),
10130
+ outputMode: string("Output mode filter.", { maxLength: 100 })
10131
+ });
10132
+ case "automation.get":
10133
+ case "automation.triggers.list":
10134
+ case "automation.enable":
10135
+ case "automation.disable":
10136
+ return schema({ automation }, ["automation"]);
10137
+ case "automation.runs":
10138
+ return schema({ automation, limit: number("Maximum run rows.", 1, 100) }, ["automation"]);
10139
+ case "automation.triggers.create":
10140
+ return schema({
10141
+ automation,
10142
+ payload,
10143
+ kind: string("Trigger kind.", { maxLength: 100 }),
10144
+ label: string("Trigger label.", { maxLength: 300 }),
10145
+ enabled: boolean("Create the trigger enabled."),
10146
+ disabled: boolean("Create the trigger disabled."),
10147
+ cronExpression: string("Cron expression.", { maxLength: 500 }),
10148
+ timezone: string("IANA timezone.", { maxLength: 200 }),
10149
+ signingMode: string("Webhook signing mode.", { maxLength: 100 }),
10150
+ replayWindowSec: string("Webhook replay window in seconds.", { maxLength: 30 })
10151
+ }, ["automation"]);
10152
+ case "automation.triggers.update":
10153
+ return schema({
10154
+ trigger,
10155
+ payload,
10156
+ label: string("Trigger label.", { maxLength: 300 }),
10157
+ enabled: boolean("Enable the trigger."),
10158
+ disabled: boolean("Disable the trigger."),
10159
+ cronExpression: string("Cron expression.", { maxLength: 500 }),
10160
+ timezone: string("IANA timezone.", { maxLength: 200 }),
10161
+ signingMode: string("Webhook signing mode.", { maxLength: 100 }),
10162
+ replayWindowSec: string("Webhook replay window in seconds.", { maxLength: 30 })
10163
+ }, ["trigger"]);
10164
+ case "automation.triggers.delete":
10165
+ case "automation.triggers.rotate-secret":
10166
+ return schema({ trigger }, ["trigger"]);
10167
+ case "automation.create":
10168
+ return schema({
10169
+ payload,
10170
+ title: string("Automation title.", { maxLength: 500 }),
10171
+ instructions: string("Automation instructions.", { maxLength: 5e5 }),
10172
+ description: string("Compatibility alias for instructions.", { maxLength: 5e5 }),
10173
+ assigneeAgentId: string("Assignee agent id.", { maxLength: 200 }),
10174
+ projectId: string("Project id.", { maxLength: 200 }),
10175
+ goalId: string("Goal id.", { maxLength: 200 }),
10176
+ parentIssueId: string("Parent issue id.", { maxLength: 200 }),
10177
+ priority: string("Issue priority.", { maxLength: 100 }),
10178
+ status: string("Automation status.", { maxLength: 100 }),
10179
+ outputMode: string("Automation output mode.", { maxLength: 100 }),
10180
+ concurrencyPolicy: string("Concurrency policy.", { maxLength: 100 }),
10181
+ catchUpPolicy: string("Catch-up policy.", { maxLength: 100 }),
10182
+ notifyOnIssueCreated: boolean("Notify when an issue is created.")
10183
+ });
10184
+ case "automation.update":
10185
+ return schema({
10186
+ automation,
10187
+ payload,
10188
+ title: string("Automation title.", { maxLength: 500 }),
10189
+ instructions: string("Automation instructions.", { maxLength: 5e5 }),
10190
+ description: string("Compatibility alias for instructions.", { maxLength: 5e5 }),
10191
+ assigneeAgentId: string("Assignee agent id.", { maxLength: 200 }),
10192
+ projectId: string("Project id.", { maxLength: 200 }),
10193
+ goalId: string("Goal id.", { maxLength: 200 }),
10194
+ parentIssueId: string("Parent issue id.", { maxLength: 200 }),
10195
+ priority: string("Issue priority.", { maxLength: 100 }),
10196
+ status: string("Automation status.", { maxLength: 100 }),
10197
+ outputMode: string("Automation output mode.", { maxLength: 100 }),
10198
+ concurrencyPolicy: string("Concurrency policy.", { maxLength: 100 }),
10199
+ catchUpPolicy: string("Catch-up policy.", { maxLength: 100 }),
10200
+ notifyOnIssueCreated: boolean("Notify when an issue is created.")
10201
+ }, ["automation"]);
10202
+ case "automation.run":
10203
+ return schema({
10204
+ automation,
10205
+ triggerId: string("Trigger id.", { maxLength: 200 }),
10206
+ payload,
10207
+ idempotencyKey: string("Idempotency key.", { maxLength: 500 }),
10208
+ source: string("Invocation source.", { maxLength: 500 })
10209
+ }, ["automation"]);
10210
+ case "chat.list":
10211
+ return schema({
10212
+ status: string("Chat status filter.", { maxLength: 100 }),
10213
+ query: string("Optional chat query.", { maxLength: 2e3 }),
10214
+ limit: number("Maximum chat rows.", 1, 100)
10215
+ });
10216
+ case "chat.search":
10217
+ return schema({
10218
+ query: string("Non-empty chat search query.", { maxLength: 2e3 }),
10219
+ status: string("Chat status filter.", { maxLength: 100 }),
10220
+ scope: string("Search scope.", { maxLength: 100 }),
10221
+ limit: number("Maximum matches.", 1, 100),
10222
+ snippetChars: number("Maximum snippet characters.", 100, 1e4)
10223
+ }, ["query"]);
10224
+ case "chat.get":
10225
+ case "chat.archive":
10226
+ return schema({ chat }, ["chat"]);
10227
+ case "chat.messages":
10228
+ return schema({
10229
+ chat,
10230
+ limit: number("Maximum message rows.", 1, 100),
10231
+ cursor,
10232
+ maxOutputChars: number("Maximum output characters per row.", 100, 2e4),
10233
+ includeTranscript: boolean("Include bounded transcript data."),
10234
+ includeOutput: boolean("Compatibility alias for includeTranscript.")
10235
+ }, ["chat"]);
10236
+ case "chat.transcript":
10237
+ return schema({
10238
+ chat,
10239
+ limit: number("Maximum transcript rows.", 1, 100),
10240
+ cursor,
10241
+ maxOutputChars: number("Maximum output characters per row.", 100, 2e4)
10242
+ }, ["chat"]);
10243
+ case "chat.read":
10244
+ return schema({
10245
+ chat,
10246
+ limit: number("Maximum message rows.", 1, 100),
10247
+ turnLimit: number("Maximum transcript turns.", 1, 100),
10248
+ cursor,
10249
+ maxOutputChars: number("Maximum output characters per row.", 100, 2e4),
10250
+ includeTranscript: boolean("Include bounded transcript data."),
10251
+ includeOutput: boolean("Compatibility alias for includeTranscript.")
10252
+ }, ["chat"]);
10253
+ case "chat.create":
10254
+ return schema({
10255
+ body: string("Initial agent-authored chat message.", { maxLength: 5e5 }),
10256
+ payload,
10257
+ title: string("Chat title.", { maxLength: 500 }),
10258
+ summary: string("Chat summary.", { maxLength: 1e4 }),
10259
+ preferredAgentId: string("Preferred responding agent id.", { maxLength: 200 }),
10260
+ issueCreationMode: string("Issue creation mode.", { maxLength: 100 }),
10261
+ planMode: boolean("Start the chat in plan mode.")
10262
+ }, ["body"]);
10263
+ case "chat.send":
10264
+ return schema({
10265
+ chat,
10266
+ body: string("Agent-authored chat message.", { maxLength: 5e5 }),
10267
+ editUserMessageId: string("User message id to edit.", { maxLength: 200 })
10268
+ }, ["chat", "body"]);
10269
+ case "runs.list":
10270
+ return schema({
10271
+ updatedAfter: string("Only runs updated after this timestamp.", { maxLength: 100 }),
10272
+ runIdPrefix: string("Run id prefix filter.", { maxLength: 200 }),
10273
+ relatedAgentId: string("Agent id filter.", { maxLength: 200 }),
10274
+ status: string("Run status filter.", { maxLength: 100 }),
10275
+ runtime: string("Runtime type filter.", { maxLength: 100 }),
10276
+ issueId: string("Linked issue id filter.", { maxLength: 200 }),
10277
+ usedSkill: string("Used skill filter.", { maxLength: 500 }),
10278
+ loadedSkill: string("Loaded skill filter.", { maxLength: 500 }),
10279
+ createdBefore: string("Only runs created before this timestamp.", { maxLength: 100 }),
10280
+ cursor,
10281
+ limit: number("Summary page size.", 1, 100)
10282
+ });
10283
+ case "runs.by-skill":
10284
+ return schema({
10285
+ skill: string("Skill key or display name.", { maxLength: 500 }),
10286
+ evidence: string("Skill evidence type.", { enum: ["used", "loaded"], maxLength: 20 }),
10287
+ relatedAgentId: string("Agent id filter.", { maxLength: 200 }),
10288
+ status: string("Run status filter.", { maxLength: 100 }),
10289
+ runtime: string("Runtime type filter.", { maxLength: 100 }),
10290
+ issueId: string("Linked issue id filter.", { maxLength: 200 }),
10291
+ createdBefore: string("Only runs created before this timestamp.", { maxLength: 100 }),
10292
+ cursor,
10293
+ limit: number("Summary page size.", 1, 100)
10294
+ }, ["skill"]);
10295
+ case "runs.get":
10296
+ case "runs.cancel":
10297
+ case "runs.retry":
10298
+ return schema({ run }, ["run"]);
10299
+ case "runs.events":
10300
+ return schema({
10301
+ run,
10302
+ cursor,
10303
+ afterSeq: number("Legacy sequence-only cursor.", 0, 1e7),
10304
+ limit: number("Event page size.", 1, 500),
10305
+ maxChars: number("Maximum preview characters per event.", 100, 2e4)
10306
+ }, ["run"]);
10307
+ case "runs.log":
10308
+ return schema({
10309
+ run,
10310
+ maxChars: number("Maximum displayed log characters.", 100, 1e5),
10311
+ offset: number("Byte offset for ranged read.", 0, 1e9),
10312
+ limitBytes: number("Maximum bytes for ranged read.", 1, 1e6)
10313
+ }, ["run"]);
10314
+ case "runs.transcript":
10315
+ return schema({
10316
+ run,
10317
+ errorsOnly: boolean("Return only error rows."),
10318
+ aroundError: string("Transcript error step id.", { maxLength: 200 }),
10319
+ contextTurns: number("Turns around the selected error.", 1, 20),
10320
+ cursor,
10321
+ turnLimit: number("Maximum turns.", 1, 100),
10322
+ chronological: boolean("Return oldest-first rows."),
10323
+ narrative: boolean("Use narrative row formatting."),
10324
+ maxChars: number("Maximum output characters per row.", 100, 2e4),
10325
+ includeOutput: boolean("Include clipped row output.")
10326
+ }, ["run"]);
10327
+ case "runs.errors":
10328
+ return schema({
10329
+ run,
10330
+ cursor,
10331
+ maxChars: number("Maximum output characters per error.", 100, 2e4)
10332
+ }, ["run"]);
10333
+ default:
10334
+ throw new Error(`Missing exact Rudder MCP input schema for capability: ${id}`);
10335
+ }
10092
10336
  }
10093
10337
  var RUDDER_MCP_CANONICAL_TOOL_DEFINITIONS = RUDDER_MCP_TOOL_DESCRIPTORS.map((tool) => ({
10094
10338
  ...tool,
@@ -10340,6 +10584,18 @@ var AGENT_CLI_CAPABILITIES = [
10340
10584
  requiresRunId: false,
10341
10585
  attachesRunIdWhenAvailable: false
10342
10586
  },
10587
+ {
10588
+ id: "issue.list",
10589
+ command: "rudder issue list --org-id <id>",
10590
+ category: "issue",
10591
+ description: "List issues with optional status, assignee, and project filters without requiring a search query.",
10592
+ mutating: false,
10593
+ contract: "agent-v1",
10594
+ requiresOrgId: true,
10595
+ requiresAgentId: false,
10596
+ requiresRunId: false,
10597
+ attachesRunIdWhenAvailable: false
10598
+ },
10343
10599
  {
10344
10600
  id: "issue.search",
10345
10601
  command: "rudder issue search <query> [--org-id <id>]",
@@ -11709,6 +11965,48 @@ var NORMALIZED_RESERVED_MODEL_ARGUMENTS = /* @__PURE__ */ new Set([
11709
11965
  "apikey",
11710
11966
  "authorization"
11711
11967
  ]);
11968
+ var LEGACY_ARGUMENT_ALIASES = {
11969
+ "agent.skills.enable": {
11970
+ selections: "selectionRefs",
11971
+ skills: "selectionRefs"
11972
+ },
11973
+ "issue.get": { issueId: "issue" },
11974
+ "issue.context": { issueId: "issue" },
11975
+ "issue.checkout": { issueId: "issue" },
11976
+ "issue.comment": { issueId: "issue" },
11977
+ "issue.comments.list": { issueId: "issue" },
11978
+ "issue.comments.get": { issueId: "issue", commentId: "comment" },
11979
+ "issue.update": { issueId: "issue" },
11980
+ "issue.review": { issueId: "issue" },
11981
+ "issue.commit": { issueId: "issue" },
11982
+ "issue.done": { issueId: "issue" },
11983
+ "issue.block": { issueId: "issue" },
11984
+ "project.get": { projectId: "project" },
11985
+ "project.update": { projectId: "project" },
11986
+ "approval.get": { approvalId: "approval" },
11987
+ "approval.issues": { approvalId: "approval" },
11988
+ "approval.comment": { approvalId: "approval" },
11989
+ "skill.get": { skillId: "skill" },
11990
+ "skill.file": { skillId: "skill" },
11991
+ "automation.get": { automationId: "automation" },
11992
+ "automation.runs": { automationId: "automation" },
11993
+ "automation.triggers.list": { automationId: "automation" },
11994
+ "automation.triggers.create": { automationId: "automation" },
11995
+ "automation.triggers.update": { triggerId: "trigger" },
11996
+ "automation.triggers.delete": { triggerId: "trigger" },
11997
+ "automation.triggers.rotate-secret": { triggerId: "trigger" },
11998
+ "automation.update": { automationId: "automation" },
11999
+ "automation.enable": { automationId: "automation" },
12000
+ "automation.disable": { automationId: "automation" },
12001
+ "automation.run": { automationId: "automation" },
12002
+ "runs.transcript": { maxOutputChars: "maxChars" },
12003
+ "chat.get": { chatId: "chat" },
12004
+ "chat.messages": { chatId: "chat" },
12005
+ "chat.transcript": { chatId: "chat" },
12006
+ "chat.read": { chatId: "chat" },
12007
+ "chat.send": { chatId: "chat" },
12008
+ "chat.archive": { chatId: "chat" }
12009
+ };
11712
12010
  function buildMcpServerEnv(env = process.env) {
11713
12011
  return {
11714
12012
  ...process.env,
@@ -11724,14 +12022,18 @@ function buildMcpServerEnv(env = process.env) {
11724
12022
  };
11725
12023
  }
11726
12024
  function buildAgentV1ToolCallPlan(toolName, rawArgs, env = buildMcpServerEnv()) {
11727
- const input = isRecord2(rawArgs) ? rawArgs : {};
11728
12025
  const capabilityId = toolNameToCapabilityId(toolName);
11729
12026
  if (!capabilityId) {
11730
12027
  throw new Error(`Unknown Rudder MCP tool: ${toolName}`);
11731
12028
  }
12029
+ if (rawArgs !== void 0 && rawArgs !== null && !isRecord2(rawArgs)) {
12030
+ throwInvalidMcpArgument(toolName, "arguments", "must be object");
12031
+ }
12032
+ const input = normalizeLegacyToolArguments(capabilityId, isRecord2(rawArgs) ? rawArgs : {});
11732
12033
  const capability = getAgentCliCapabilityById(capabilityId);
11733
12034
  rejectModelProvidedRuntimeIdentity(input);
11734
12035
  rejectUnsupportedToolArguments(toolName, input);
12036
+ validateMcpToolArguments(toolName, input);
11735
12037
  rejectUnsupportedBrowserLocatorAction(toolName, input);
11736
12038
  assertBrowserCapabilityEnabled(capabilityId, env);
11737
12039
  assertRuntimeMcpContext(capability, env);
@@ -11951,7 +12253,8 @@ async function callTool(params, env, surface, signal) {
11951
12253
  err.code = "rudder_mcp_tool_not_available";
11952
12254
  throw err;
11953
12255
  }
11954
- const args = record.arguments;
12256
+ const rawArgs = record.arguments;
12257
+ const args = isRecord2(rawArgs) ? normalizeLegacyToolArguments(toolNameToCapabilityId(toolName) ?? "", rawArgs) : rawArgs;
11955
12258
  const plan = buildAgentV1ToolCallPlan(toolName, args, env);
11956
12259
  const directResult = await callToolDirectlyIfSupported(toolName, args, env, signal);
11957
12260
  if (directResult) return directResult;
@@ -12046,6 +12349,30 @@ async function callToolDirectlyIfSupported(toolName, rawArgs, env, signal) {
12046
12349
  { status: "done", comment }
12047
12350
  ));
12048
12351
  }
12352
+ case "runs.list":
12353
+ return success(await api.get(
12354
+ `/api/run-intelligence/orgs/${encodeURIComponent(requiredRuntimeString(env, "RUDDER_ORG_ID"))}/runs?${buildDirectRunsListQuery(input)}`
12355
+ ));
12356
+ case "runs.get":
12357
+ return success(await api.get(
12358
+ `/api/run-intelligence/runs/${encodeURIComponent(requiredString(input, "run"))}?projection=summary`
12359
+ ));
12360
+ case "runs.events":
12361
+ return success(await api.get(
12362
+ `/api/run-intelligence/runs/${encodeURIComponent(requiredString(input, "run"))}/events?${buildDirectRunEventsQuery(input)}`
12363
+ ));
12364
+ case "runs.log":
12365
+ return success(await api.get(
12366
+ `/api/run-intelligence/runs/${encodeURIComponent(requiredString(input, "run"))}/log?${buildDirectRunLogQuery(input)}`
12367
+ ));
12368
+ case "runs.transcript":
12369
+ return success(await api.get(
12370
+ `/api/run-intelligence/runs/${encodeURIComponent(requiredString(input, "run"))}/transcript?${buildDirectRunTranscriptQuery(input)}`
12371
+ ));
12372
+ case "runs.errors":
12373
+ return success(await api.get(
12374
+ `/api/run-intelligence/runs/${encodeURIComponent(requiredString(input, "run"))}/errors?${buildDirectRunErrorsQuery(input)}`
12375
+ ));
12049
12376
  case "browser.tabs":
12050
12377
  return success(await api.post("/api/browser/tabs", {}));
12051
12378
  case "browser.user-tabs":
@@ -12114,6 +12441,81 @@ async function callToolDirectlyIfSupported(toolName, rawArgs, env, signal) {
12114
12441
  return null;
12115
12442
  }
12116
12443
  }
12444
+ function buildDirectRunsListQuery(input) {
12445
+ const params = new URLSearchParams({ projection: "summary" });
12446
+ appendOptionalQuery(params, "updatedAfter", input.updatedAfter);
12447
+ appendOptionalQuery(params, "runIdPrefix", input.runIdPrefix);
12448
+ appendOptionalQuery(params, "agentId", input.relatedAgentId);
12449
+ appendOptionalQuery(params, "status", input.status);
12450
+ appendOptionalQuery(params, "runtime", input.runtime);
12451
+ appendOptionalQuery(params, "issueId", input.issueId);
12452
+ appendOptionalQuery(params, "usedSkill", input.usedSkill);
12453
+ appendOptionalQuery(params, "loadedSkill", input.loadedSkill);
12454
+ appendOptionalQuery(params, "createdBefore", input.createdBefore);
12455
+ appendOptionalQuery(params, "cursor", input.cursor);
12456
+ params.set("limit", String(parsePositiveInteger(input.limit, 50)));
12457
+ return params.toString();
12458
+ }
12459
+ function buildDirectRunEventsQuery(input) {
12460
+ const params = new URLSearchParams({
12461
+ afterSeq: String(parseNonNegativeInteger(input.afterSeq, 0)),
12462
+ limit: String(parsePositiveInteger(input.limit, 200)),
12463
+ maxChars: String(parsePositiveInteger(input.maxChars, 1200)),
12464
+ projection: "compact"
12465
+ });
12466
+ appendOptionalQuery(params, "cursor", input.cursor);
12467
+ return params.toString();
12468
+ }
12469
+ function buildDirectRunLogQuery(input) {
12470
+ return new URLSearchParams({
12471
+ offset: String(parseNonNegativeInteger(input.offset, 0)),
12472
+ limitBytes: String(parsePositiveInteger(input.limitBytes, 256e3))
12473
+ }).toString();
12474
+ }
12475
+ function buildDirectRunTranscriptQuery(input) {
12476
+ const params = new URLSearchParams({
12477
+ contextTurns: String(parsePositiveInteger(input.contextTurns, 1)),
12478
+ order: input.chronological === true || input.narrative === true ? "oldest" : "newest",
12479
+ output: "compact",
12480
+ includeOutputs: input.includeOutput === true || input.narrative === true ? "true" : "false",
12481
+ maxChars: String(parsePositiveInteger(input.maxChars ?? input.maxOutputChars, 1200))
12482
+ });
12483
+ if (input.errorsOnly === true) params.set("errorsOnly", "true");
12484
+ appendOptionalQuery(params, "aroundError", input.aroundError);
12485
+ appendOptionalQuery(params, "cursor", input.cursor);
12486
+ if (input.turnLimit !== void 0) {
12487
+ params.set("turnLimit", String(parsePositiveInteger(input.turnLimit, 20)));
12488
+ }
12489
+ return params.toString();
12490
+ }
12491
+ function buildDirectRunErrorsQuery(input) {
12492
+ const params = new URLSearchParams({
12493
+ maxChars: String(parsePositiveInteger(input.maxChars, 1200))
12494
+ });
12495
+ appendOptionalQuery(params, "cursor", input.cursor);
12496
+ return params.toString();
12497
+ }
12498
+ function appendOptionalQuery(params, key, value) {
12499
+ const rendered = optionalString(value);
12500
+ if (rendered) params.set(key, rendered);
12501
+ }
12502
+ function parsePositiveInteger(value, fallback) {
12503
+ const parsed = Number(value ?? fallback);
12504
+ if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
12505
+ return Math.floor(parsed);
12506
+ }
12507
+ function parseNonNegativeInteger(value, fallback) {
12508
+ const parsed = Number(value ?? fallback);
12509
+ if (!Number.isFinite(parsed) || parsed < 0) return fallback;
12510
+ return Math.floor(parsed);
12511
+ }
12512
+ function requiredRuntimeString(env, key) {
12513
+ const value = optionalString(env[key]);
12514
+ if (value) return value;
12515
+ const err = new Error(`Rudder MCP runtime context is incomplete. Missing ${String(key)}.`);
12516
+ err.code = "rudder_mcp_missing_runtime_context";
12517
+ throw err;
12518
+ }
12117
12519
  function hasLocalImageInputs(value) {
12118
12520
  return Array.isArray(value) && value.some((entry) => typeof entry === "string" && entry.trim().length > 0);
12119
12521
  }
@@ -12232,6 +12634,13 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
12232
12634
  }
12233
12635
  case "issue.get":
12234
12636
  return ["issue", "get", requiredAnyString(input, ["issue", "issueId"])];
12637
+ case "issue.list": {
12638
+ const args = ["issue", "list"];
12639
+ pushOptional(args, "--status", input.status);
12640
+ pushOptional(args, "--assignee-agent-id", input.assigneeAgentId);
12641
+ pushOptional(args, "--project-id", input.projectId);
12642
+ return args;
12643
+ }
12235
12644
  case "issue.search": {
12236
12645
  const args = ["issue", "search", requiredString(input, "query")];
12237
12646
  pushOptional(args, "--status", input.status);
@@ -12734,6 +13143,17 @@ function pushImages(args, value) {
12734
13143
  if (typeof image === "string" && image.trim().length > 0) args.push("--image", image.trim());
12735
13144
  }
12736
13145
  }
13146
+ function normalizeLegacyToolArguments(capabilityId, input) {
13147
+ const aliases = LEGACY_ARGUMENT_ALIASES[capabilityId];
13148
+ if (!aliases) return input;
13149
+ const normalized = { ...input };
13150
+ for (const [alias, canonical] of Object.entries(aliases)) {
13151
+ if (!(alias in normalized)) continue;
13152
+ if (!(canonical in normalized)) normalized[canonical] = normalized[alias];
13153
+ delete normalized[alias];
13154
+ }
13155
+ return normalized;
13156
+ }
12737
13157
  function pushStringListArgs(args, value, key) {
12738
13158
  const values = Array.isArray(value) ? value.map((entry) => optionalString(entry)).filter((entry) => Boolean(entry)) : optionalString(value)?.split(",").map((entry) => entry.trim()).filter(Boolean) ?? [];
12739
13159
  if (values.length === 0) {
@@ -12770,6 +13190,105 @@ function rejectUnsupportedToolArguments(toolName, input) {
12770
13190
  err.code = "rudder_mcp_invalid_arguments";
12771
13191
  throw err;
12772
13192
  }
13193
+ function validateMcpToolArguments(toolName, input) {
13194
+ const tool = buildAgentV1McpToolsManifest("agent-v1", { surface: "all" }).tools.find((entry) => entry.name === toolName);
13195
+ if (!tool) return;
13196
+ const schema = tool.inputSchema;
13197
+ const required = Array.isArray(schema.required) ? schema.required : [];
13198
+ for (const key of required) {
13199
+ const value = input[key];
13200
+ const missing = value === void 0 || value === null || typeof value === "string" && value.trim().length === 0 || Array.isArray(value) && value.length === 0;
13201
+ if (missing) throwInvalidMcpArgument(toolName, key, "is required");
13202
+ }
13203
+ if (Array.isArray(schema.anyOf)) {
13204
+ const matches = schema.anyOf.some((candidate) => {
13205
+ if (!isRecord2(candidate) || !Array.isArray(candidate.required)) return false;
13206
+ return candidate.required.every((key) => {
13207
+ const value = input[String(key)];
13208
+ return value !== void 0 && value !== null && !(typeof value === "string" && value.trim().length === 0) && !(Array.isArray(value) && value.length === 0);
13209
+ });
13210
+ });
13211
+ if (!matches) {
13212
+ const alternatives = schema.anyOf.flatMap((candidate) => isRecord2(candidate) && Array.isArray(candidate.required) ? candidate.required : []).map(String);
13213
+ throwInvalidMcpArgument(toolName, alternatives.join(" or "), "is required");
13214
+ }
13215
+ }
13216
+ for (const [key, value] of Object.entries(input)) {
13217
+ const property = schema.properties[key];
13218
+ if (!isRecord2(property) || value === void 0) continue;
13219
+ const violation = jsonSchemaViolation(value, property);
13220
+ if (violation) throwInvalidMcpArgument(toolName, key, violation);
13221
+ }
13222
+ }
13223
+ function jsonSchemaViolation(value, schema) {
13224
+ if (Array.isArray(schema.oneOf)) {
13225
+ const matches = schema.oneOf.some(
13226
+ (candidate) => isRecord2(candidate) && jsonSchemaViolation(value, candidate) === null
13227
+ );
13228
+ if (!matches) return "does not match any allowed shape";
13229
+ }
13230
+ const types = Array.isArray(schema.type) ? schema.type : schema.type === void 0 ? [] : [schema.type];
13231
+ if (types.length > 0) {
13232
+ const validType = types.some((type) => type === "string" ? typeof value === "string" : type === "number" ? typeof value === "number" && Number.isFinite(value) : type === "boolean" ? typeof value === "boolean" : type === "array" ? Array.isArray(value) : type === "object" ? isRecord2(value) : false);
13233
+ if (!validType) return `must be ${types.join(" or ")}`;
13234
+ }
13235
+ if (typeof value === "string") {
13236
+ if (typeof schema.minLength === "number" && value.length < schema.minLength) {
13237
+ return `must contain at least ${schema.minLength} character(s)`;
13238
+ }
13239
+ if (typeof schema.maxLength === "number" && value.length > schema.maxLength) {
13240
+ return `must contain at most ${schema.maxLength} characters`;
13241
+ }
13242
+ if (Array.isArray(schema.enum) && !schema.enum.includes(value)) {
13243
+ return `must be one of: ${schema.enum.join(", ")}`;
13244
+ }
13245
+ }
13246
+ if (typeof value === "number") {
13247
+ if (typeof schema.minimum === "number" && value < schema.minimum) {
13248
+ return `must be at least ${schema.minimum}`;
13249
+ }
13250
+ if (typeof schema.maximum === "number" && value > schema.maximum) {
13251
+ return `must be at most ${schema.maximum}`;
13252
+ }
13253
+ }
13254
+ if (Array.isArray(value)) {
13255
+ if (typeof schema.minItems === "number" && value.length < schema.minItems) {
13256
+ return `must contain at least ${schema.minItems} items`;
13257
+ }
13258
+ if (typeof schema.maxItems === "number" && value.length > schema.maxItems) {
13259
+ return `must contain at most ${schema.maxItems} items`;
13260
+ }
13261
+ if (isRecord2(schema.items)) {
13262
+ for (const [index, item] of value.entries()) {
13263
+ const violation = jsonSchemaViolation(item, schema.items);
13264
+ if (violation) return `item ${index} ${violation}`;
13265
+ }
13266
+ }
13267
+ }
13268
+ if (isRecord2(value) && schema.type === "object") {
13269
+ const properties = isRecord2(schema.properties) ? schema.properties : {};
13270
+ const required = Array.isArray(schema.required) ? schema.required.map(String) : [];
13271
+ for (const key of required) {
13272
+ if (!(key in value)) return `field ${key} is required`;
13273
+ }
13274
+ if (schema.additionalProperties === false) {
13275
+ const unsupported = Object.keys(value).filter((key) => !(key in properties));
13276
+ if (unsupported.length > 0) return `contains unsupported field(s): ${unsupported.sort().join(", ")}`;
13277
+ }
13278
+ for (const [key, child] of Object.entries(value)) {
13279
+ const childSchema = properties[key];
13280
+ if (!isRecord2(childSchema)) continue;
13281
+ const violation = jsonSchemaViolation(child, childSchema);
13282
+ if (violation) return `field ${key} ${violation}`;
13283
+ }
13284
+ }
13285
+ return null;
13286
+ }
13287
+ function throwInvalidMcpArgument(toolName, key, reason) {
13288
+ const err = new Error(`Invalid argument for ${toolName}: ${key} ${reason}. Consult tools/list for the exact schema.`);
13289
+ err.code = "rudder_mcp_invalid_arguments";
13290
+ throw err;
13291
+ }
12773
13292
  var READ_ONLY_BROWSER_LOCATOR_ACTIONS = /* @__PURE__ */ new Set([
12774
13293
  "count",
12775
13294
  "allTextContents",
@@ -17940,7 +18459,7 @@ function registerRunsCommands(program) {
17940
18459
  try {
17941
18460
  const ctx = resolveCommandContext(opts);
17942
18461
  const params = new URLSearchParams({
17943
- afterSeq: String(parseNonNegativeInteger(opts.afterSeq, 0)),
18462
+ afterSeq: String(parseNonNegativeInteger2(opts.afterSeq, 0)),
17944
18463
  limit: String(parseLimit2(opts.limit, 200)),
17945
18464
  maxChars: String(parseLimit2(opts.maxChars, 1200)),
17946
18465
  projection: opts.full ? "full" : "compact"
@@ -17960,7 +18479,7 @@ function registerRunsCommands(program) {
17960
18479
  try {
17961
18480
  const ctx = resolveCommandContext(opts);
17962
18481
  const params = new URLSearchParams({
17963
- offset: String(parseNonNegativeInteger(opts.offset, 0)),
18482
+ offset: String(parseNonNegativeInteger2(opts.offset, 0)),
17964
18483
  limitBytes: String(parseLimit2(opts.limitBytes, 256e3))
17965
18484
  });
17966
18485
  const row = await ctx.api.get(
@@ -18301,7 +18820,7 @@ function parseLimit2(value, fallback) {
18301
18820
  if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
18302
18821
  return Math.floor(parsed);
18303
18822
  }
18304
- function parseNonNegativeInteger(value, fallback) {
18823
+ function parseNonNegativeInteger2(value, fallback) {
18305
18824
  const parsed = Number(value ?? fallback);
18306
18825
  if (!Number.isFinite(parsed) || parsed < 0) return fallback;
18307
18826
  return Math.floor(parsed);