From cdb0aba51d2932a4346ea12682b35c6f19aefe92 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 16:41:16 -0800 Subject: [PATCH 1/7] =?UTF-8?q?fix(integrations):=20sweep2=20v1=20?= =?UTF-8?q?=E2=80=94=20read=20the=20mapper=20operation=20from=20the=20tool?= =?UTF-8?q?-call=20context=20and=20validate=20integrations=20against=20ven?= =?UTF-8?q?dor=20specs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sim/blocks/blocks/datadog.test.ts | 45 + apps/sim/blocks/blocks/datadog.ts | 330 ++++--- apps/sim/blocks/blocks/github.ts | 95 +- apps/sim/blocks/blocks/gitlab.test.ts | 212 ++++ apps/sim/blocks/blocks/gitlab.ts | 932 +++++++++++------- apps/sim/blocks/blocks/incidentio.test.ts | 108 ++ apps/sim/blocks/blocks/incidentio.ts | 130 ++- apps/sim/blocks/blocks/linear.test.ts | 138 +++ apps/sim/blocks/blocks/linear.ts | 493 +++++---- apps/sim/blocks/blocks/pagerduty.ts | 60 +- apps/sim/blocks/blocks/sentry.ts | 24 +- .../blocks/slack-workflow-operations.ts | 20 +- apps/sim/blocks/blocks/slack.test.ts | 106 +- apps/sim/blocks/blocks/slack.ts | 261 +++-- apps/sim/lib/internal/github/operations.ts | 73 +- .../sim/lib/internal/slack/operations.test.ts | 19 + apps/sim/tools/datadog/create_event.ts | 23 +- apps/sim/tools/datadog/create_monitor.ts | 15 +- apps/sim/tools/datadog/datadog.test.ts | 83 +- apps/sim/tools/datadog/get_incident.ts | 6 + apps/sim/tools/datadog/get_slo_history.ts | 7 + apps/sim/tools/datadog/query_logs.ts | 2 +- apps/sim/tools/datadog/submit_metrics.ts | 20 +- apps/sim/tools/datadog/types.ts | 16 +- apps/sim/tools/datadog/update_incident.ts | 2 +- apps/sim/tools/datadog/update_slo.ts | 2 +- ...ranch_protection_and_workflow_runs.test.ts | 46 + apps/sim/tools/github/check_star.ts | 43 +- apps/sim/tools/github/close_issue.ts | 2 +- apps/sim/tools/github/comment.ts | 6 +- apps/sim/tools/github/compare_commits.ts | 10 +- apps/sim/tools/github/content-path.ts | 8 + apps/sim/tools/github/create_file.ts | 3 +- apps/sim/tools/github/delete_file.ts | 3 +- apps/sim/tools/github/get_commit.ts | 3 +- apps/sim/tools/github/get_file_content.ts | 5 +- apps/sim/tools/github/get_pr_files.ts | 7 +- apps/sim/tools/github/get_project.ts | 14 +- apps/sim/tools/github/get_tree.ts | 5 +- apps/sim/tools/github/get_workflow.ts | 6 +- apps/sim/tools/github/latest_commit.ts | 4 + apps/sim/tools/github/list_issue_comments.ts | 4 +- apps/sim/tools/github/list_pr_comments.ts | 4 +- apps/sim/tools/github/list_workflow_runs.ts | 6 +- apps/sim/tools/github/list_workflows.ts | 6 +- apps/sim/tools/github/pr.ts | 32 +- .../tools/github/request-coercions.test.ts | 186 ++++ apps/sim/tools/github/search_code.ts | 8 +- apps/sim/tools/github/trigger_workflow.ts | 39 +- apps/sim/tools/github/types.ts | 39 +- apps/sim/tools/github/update_file.ts | 3 +- apps/sim/tools/github/update_issue.ts | 2 +- apps/sim/tools/github/update_pr.ts | 2 +- apps/sim/tools/github/update_project.ts | 30 +- apps/sim/tools/gitlab/add_member.ts | 2 +- apps/sim/tools/gitlab/add_saml_group_link.ts | 6 +- .../tools/gitlab/approve_access_request.ts | 3 +- .../sim/tools/gitlab/approve_merge_request.ts | 7 +- apps/sim/tools/gitlab/cancel_pipeline.ts | 7 +- apps/sim/tools/gitlab/compare_branches.ts | 4 +- apps/sim/tools/gitlab/create_branch.ts | 4 +- apps/sim/tools/gitlab/create_file.ts | 4 +- apps/sim/tools/gitlab/create_issue.ts | 6 +- apps/sim/tools/gitlab/create_issue_note.ts | 7 +- apps/sim/tools/gitlab/create_merge_request.ts | 6 +- .../tools/gitlab/create_merge_request_note.ts | 7 +- apps/sim/tools/gitlab/create_pipeline.ts | 6 +- apps/sim/tools/gitlab/create_release.ts | 4 +- apps/sim/tools/gitlab/delete_branch.ts | 7 +- apps/sim/tools/gitlab/delete_issue.ts | 7 +- .../tools/gitlab/delete_saml_group_link.ts | 9 +- apps/sim/tools/gitlab/delete_user.ts | 3 +- apps/sim/tools/gitlab/delete_user_identity.ts | 7 +- apps/sim/tools/gitlab/deny_access_request.ts | 3 +- apps/sim/tools/gitlab/get_file.ts | 4 +- apps/sim/tools/gitlab/get_issue.ts | 7 +- apps/sim/tools/gitlab/get_job_log.ts | 7 +- apps/sim/tools/gitlab/get_merge_request.ts | 7 +- .../tools/gitlab/get_merge_request_changes.ts | 7 +- apps/sim/tools/gitlab/get_pipeline.ts | 7 +- apps/sim/tools/gitlab/get_project.ts | 4 +- apps/sim/tools/gitlab/invite_member.ts | 2 +- apps/sim/tools/gitlab/list_branches.ts | 4 +- apps/sim/tools/gitlab/list_commits.ts | 4 +- apps/sim/tools/gitlab/list_issues.ts | 4 +- apps/sim/tools/gitlab/list_merge_requests.ts | 4 +- apps/sim/tools/gitlab/list_pipeline_jobs.ts | 7 +- apps/sim/tools/gitlab/list_pipelines.ts | 4 +- apps/sim/tools/gitlab/list_releases.ts | 4 +- apps/sim/tools/gitlab/list_repository_tree.ts | 4 +- .../sim/tools/gitlab/list_saml_group_links.ts | 4 +- apps/sim/tools/gitlab/merge_merge_request.ts | 17 +- apps/sim/tools/gitlab/play_job.ts | 7 +- apps/sim/tools/gitlab/remove_member.ts | 3 +- apps/sim/tools/gitlab/request-paths.test.ts | 64 ++ apps/sim/tools/gitlab/retry_pipeline.ts | 7 +- apps/sim/tools/gitlab/revoke_invitation.ts | 3 +- apps/sim/tools/gitlab/types.ts | 1 + apps/sim/tools/gitlab/update_file.ts | 4 +- apps/sim/tools/gitlab/update_invitation.ts | 3 +- apps/sim/tools/gitlab/update_issue.ts | 9 +- apps/sim/tools/gitlab/update_member.ts | 5 +- apps/sim/tools/gitlab/update_merge_request.ts | 9 +- apps/sim/tools/gitlab/update_user.ts | 4 +- apps/sim/tools/gitlab/user_status_actions.ts | 4 +- apps/sim/tools/gitlab/utils.ts | 9 +- apps/sim/tools/incidentio/actions_create.ts | 2 +- apps/sim/tools/incidentio/actions_list.ts | 143 ++- apps/sim/tools/incidentio/actions_show.ts | 85 +- apps/sim/tools/incidentio/actions_update.ts | 3 +- apps/sim/tools/incidentio/alerts_list.ts | 2 +- .../tools/incidentio/catalog_entries_list.ts | 2 +- .../tools/incidentio/custom_fields_create.ts | 1 - .../tools/incidentio/custom_fields_delete.ts | 4 +- .../tools/incidentio/custom_fields_list.ts | 1 - .../tools/incidentio/custom_fields_show.ts | 5 +- .../tools/incidentio/custom_fields_update.ts | 5 +- .../incidentio/escalation_paths_create.ts | 65 +- .../incidentio/escalation_paths_delete.ts | 4 +- .../tools/incidentio/escalation_paths_list.ts | 20 +- .../tools/incidentio/escalation_paths_show.ts | 64 +- .../incidentio/escalation_paths_update.ts | 69 +- .../tools/incidentio/escalations_create.ts | 26 +- apps/sim/tools/incidentio/escalations_list.ts | 5 +- apps/sim/tools/incidentio/escalations_show.ts | 9 +- .../sim/tools/incidentio/follow_ups_create.ts | 10 +- apps/sim/tools/incidentio/follow_ups_list.ts | 166 ++-- apps/sim/tools/incidentio/follow_ups_show.ts | 106 +- .../sim/tools/incidentio/follow_ups_update.ts | 12 +- .../tools/incidentio/incident_alerts_list.ts | 2 +- .../tools/incidentio/incident_roles_create.ts | 6 +- .../tools/incidentio/incident_roles_delete.ts | 4 +- .../tools/incidentio/incident_roles_list.ts | 6 +- .../tools/incidentio/incident_roles_show.ts | 10 +- .../tools/incidentio/incident_roles_update.ts | 10 +- .../incidentio/incident_timestamps_list.ts | 12 +- .../incidentio/incident_timestamps_show.ts | 16 +- apps/sim/tools/incidentio/incidents_create.ts | 8 +- apps/sim/tools/incidentio/incidents_show.ts | 16 +- apps/sim/tools/incidentio/incidents_update.ts | 14 +- apps/sim/tools/incidentio/requests.test.ts | 168 ++++ apps/sim/tools/incidentio/schedules_delete.ts | 3 +- apps/sim/tools/incidentio/schedules_list.ts | 6 + apps/sim/tools/incidentio/schedules_show.ts | 3 +- apps/sim/tools/incidentio/schedules_update.ts | 5 +- apps/sim/tools/incidentio/types.ts | 418 ++++++-- apps/sim/tools/incidentio/users_list.ts | 19 + apps/sim/tools/incidentio/users_show.ts | 11 +- apps/sim/tools/incidentio/utils.ts | 182 +++- apps/sim/tools/incidentio/workflows_delete.ts | 3 +- apps/sim/tools/incidentio/workflows_show.ts | 5 +- apps/sim/tools/incidentio/workflows_update.ts | 3 +- apps/sim/tools/linear/archive_label.ts | 11 +- .../tools/linear/create_customer_request.ts | 11 +- apps/sim/tools/linear/create_customer_tier.ts | 4 +- apps/sim/tools/linear/create_cycle.ts | 3 +- apps/sim/tools/linear/create_issue.ts | 13 +- apps/sim/tools/linear/create_project.ts | 6 + .../sim/tools/linear/create_project_status.ts | 3 +- .../sim/tools/linear/create_workflow_state.ts | 4 +- .../sim/tools/linear/delete_project_status.ts | 17 +- apps/sim/tools/linear/get_issue.ts | 2 + apps/sim/tools/linear/get_project.ts | 10 +- apps/sim/tools/linear/list_comments.ts | 4 + apps/sim/tools/linear/list_projects.ts | 39 +- apps/sim/tools/linear/requests.test.ts | 170 ++++ apps/sim/tools/linear/types.ts | 27 +- .../tools/linear/update_customer_request.ts | 6 +- .../tools/linear/update_customer_status.ts | 4 +- apps/sim/tools/linear/update_customer_tier.ts | 4 +- apps/sim/tools/linear/update_notification.ts | 20 +- apps/sim/tools/linear/update_project.ts | 24 +- apps/sim/tools/pagerduty/add_note.ts | 4 +- apps/sim/tools/pagerduty/get_incident.ts | 3 +- apps/sim/tools/pagerduty/get_service.ts | 3 +- .../pagerduty/list_escalation_policies.ts | 9 + .../tools/pagerduty/list_incident_alerts.ts | 12 +- apps/sim/tools/pagerduty/list_incidents.ts | 9 + apps/sim/tools/pagerduty/list_oncalls.ts | 9 + apps/sim/tools/pagerduty/list_schedules.ts | 9 + apps/sim/tools/pagerduty/list_services.ts | 9 + apps/sim/tools/pagerduty/list_users.ts | 9 + apps/sim/tools/pagerduty/merge_incidents.ts | 4 +- apps/sim/tools/pagerduty/requests.test.ts | 107 ++ apps/sim/tools/pagerduty/send_event.ts | 39 + apps/sim/tools/pagerduty/snooze_incident.ts | 4 +- apps/sim/tools/pagerduty/types.ts | 9 + apps/sim/tools/pagerduty/update_incident.ts | 9 +- apps/sim/tools/sentry/events_get.ts | 3 +- apps/sim/tools/sentry/events_list.ts | 20 +- apps/sim/tools/sentry/issues_get.ts | 3 +- apps/sim/tools/sentry/issues_list.ts | 20 +- apps/sim/tools/sentry/issues_update.ts | 13 +- apps/sim/tools/sentry/projects_create.ts | 26 +- apps/sim/tools/sentry/projects_get.ts | 3 +- apps/sim/tools/sentry/projects_list.ts | 32 +- apps/sim/tools/sentry/projects_update.ts | 3 +- apps/sim/tools/sentry/releases_create.ts | 38 +- apps/sim/tools/sentry/releases_deploy.ts | 3 +- apps/sim/tools/sentry/releases_list.ts | 18 +- apps/sim/tools/sentry/requests.test.ts | 56 ++ apps/sim/tools/sentry/teams_list.ts | 15 +- apps/sim/tools/sentry/types.ts | 17 +- apps/sim/tools/slack/agent_sessions.test.ts | 11 + apps/sim/tools/slack/close_conversation.ts | 3 +- apps/sim/tools/slack/create_user_group.ts | 12 +- apps/sim/tools/slack/ephemeral_message.ts | 13 +- apps/sim/tools/slack/get_channel_history.ts | 2 +- apps/sim/tools/slack/get_team_dnd_info.ts | 12 +- apps/sim/tools/slack/get_thread_replies.ts | 2 +- apps/sim/tools/slack/open_conversation.ts | 12 +- apps/sim/tools/slack/open_view.ts | 8 +- apps/sim/tools/slack/push_view.ts | 8 +- .../tools/slack/rename_agent_session_v2.ts | 8 +- apps/sim/tools/slack/revoke_canvas_access.ts | 15 +- .../slack/set_agent_session_status_v2.ts | 8 +- apps/sim/tools/slack/set_status.ts | 2 +- apps/sim/tools/slack/set_suggested_prompts.ts | 2 +- apps/sim/tools/slack/share_canvas.ts | 17 +- apps/sim/tools/slack/types.ts | 8 +- .../sim/tools/slack/unarchive_conversation.ts | 3 +- apps/sim/tools/slack/update_user_group.ts | 12 +- .../tools/slack/update_user_group_members.ts | 14 +- apps/sim/tools/slack/utils.ts | 38 +- apps/sim/tools/slack/web-api.ts | 30 +- .../tools/slack/workflow-operations.test.ts | 45 + 226 files changed, 5074 insertions(+), 1940 deletions(-) create mode 100644 apps/sim/blocks/blocks/incidentio.test.ts create mode 100644 apps/sim/blocks/blocks/linear.test.ts create mode 100644 apps/sim/tools/github/content-path.ts create mode 100644 apps/sim/tools/github/request-coercions.test.ts create mode 100644 apps/sim/tools/gitlab/request-paths.test.ts create mode 100644 apps/sim/tools/incidentio/requests.test.ts create mode 100644 apps/sim/tools/linear/requests.test.ts create mode 100644 apps/sim/tools/pagerduty/requests.test.ts create mode 100644 apps/sim/tools/sentry/requests.test.ts diff --git a/apps/sim/blocks/blocks/datadog.test.ts b/apps/sim/blocks/blocks/datadog.test.ts index 53a1794df82..57c4c18702a 100644 --- a/apps/sim/blocks/blocks/datadog.test.ts +++ b/apps/sim/blocks/blocks/datadog.test.ts @@ -99,3 +99,48 @@ describe('datadog numeric coercion', () => { expect(params[key]).toBe(0) }) }) + +/** + * On a tool call (Agent tool row, Pi, Human-in-the-loop) the operation arrives only in + * `context`, and the model's args are keyed by the tool's param names. The mapper's result is + * spread over those args, so a branch that renames a block field onto a tool param must keep + * the model's value when the block field is blank. + */ +function toolCallParams( + operation: string, + modelArgs: Record +): Record { + const params = { ...baseInputs, ...modelArgs } + return { ...params, ...(mapParams?.(params, { operation }) as Record) } +} + +describe('datadog tool-call params', () => { + it.each([ + ['datadog_create_monitor', { query: 'avg:cpu{*} > 90', tags: 'team:a', priority: 2 }], + ['datadog_mute_monitor', { monitorId: '123' }], + ['datadog_query_logs', { query: 'status:error', from: 'now-1h', to: 'now', limit: 20 }], + ['datadog_create_incident', { title: 'DB down', customerImpacted: true }], + ['datadog_update_security_signal_state', { signalId: 's1', state: 'archived' }], + ['datadog_trigger_synthetics_tests', { publicIds: 'abc-def-ghi' }], + ['datadog_list_monitors', { name: 'cpu', monitorTags: 'env:prod', page: 0 }], + ])('keeps the model args for %s', (operation, modelArgs) => { + const params = toolCallParams(operation, modelArgs) + + expect(params).toMatchObject(modelArgs) + }) + + it('drops a non-numeric model page size instead of sending it to Datadog', () => { + const params = toolCallParams('datadog_list_monitors', { pageSize: 'fifty' }) + + expect(params.pageSize).toBeUndefined() + }) + + it('reads a model switch value sent as a string', () => { + const params = toolCallParams('datadog_unmute_monitor', { + monitorId: '123', + allScopes: 'false', + }) + + expect(params.allScopes).toBe(false) + }) +}) diff --git a/apps/sim/blocks/blocks/datadog.ts b/apps/sim/blocks/blocks/datadog.ts index e9f6fae27c2..ed9de2ae8ef 100644 --- a/apps/sim/blocks/blocks/datadog.ts +++ b/apps/sim/blocks/blocks/datadog.ts @@ -1,7 +1,7 @@ import { DatadogIcon } from '@/components/icons' -import type { BlockConfig, BlockMeta } from '@/blocks/types' +import type { BlockConfig, BlockMeta, BlockToolParamsContext } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' -import { withSavedCredential } from '@/blocks/utils' +import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils' import { DATADOG_SITE_LABELS, DATADOG_SITES } from '@/tools/datadog/types' /** @@ -33,6 +33,21 @@ function datadogNumber(value: unknown): number | undefined { return Number.isFinite(parsed) ? parsed : undefined } +/** + * A block field stored under its own id, or, on a tool call where that field is blank, the + * model's argument under the tool's param name. Model args are keyed by the tool's params, so + * a block field renamed onto one would otherwise overwrite the model's value. On the canvas + * (no context) the field is returned unchanged, so a saved workflow's request is the same. + */ +function fieldOrToolArg( + context: BlockToolParamsContext | undefined, + blockValue: unknown, + toolArg: unknown +): unknown { + if (blockValue != null && blockValue !== '') return blockValue + return toolCallArg(context, toolArg) ?? blockValue +} + export const DatadogBlock: BlockConfig = { type: 'datadog', hideFromToolbar: true, @@ -1961,14 +1976,26 @@ Return ONLY the search query string - no explanations.`, ], config: { tool: (params) => params.operation, - params: (params) => { + params: (params, context) => { const baseParams: { apiKey: string; applicationKey: string; site: string } = { apiKey: params.apiKey, applicationKey: params.applicationKey, site: params.site, } - - switch (params.operation) { + /** The block field, or on a tool call the model's arg under the tool's param name. */ + const field = (blockValue: unknown, toolParam: string) => + fieldOrToolArg(context, blockValue, params[toolParam]) + /** Like {@link field} for numeric fields, coercing both values. */ + const numberField = (blockValue: unknown, toolParam: string) => + datadogNumber(blockValue) ?? toolCallArg(context, datadogNumber(params[toolParam])) + /** Like {@link field} for switches, coercing both values. */ + const switchField = (blockValue: unknown, toolParam: string) => + toSwitchBoolean(blockValue) ?? toolCallArg(context, toSwitchBoolean(params[toolParam])) + /** Like {@link field} for optional fields whose blank value is omitted. */ + const optionalField = (blockValue: unknown, toolParam: string) => + blockValue || toolCallArg(context, params[toolParam]) || undefined + + switch (mapperOperation(params, context)) { case 'datadog_submit_metrics': return { ...baseParams, series: params.series } @@ -1995,10 +2022,10 @@ Return ONLY the search query string - no explanations.`, ...baseParams, name: params.name, type: params.type, - query: params.monitorQuery, + query: field(params.monitorQuery, 'query'), message: params.message, - tags: params.monitorTags, - priority: datadogNumber(params.monitorPriority), + tags: field(params.monitorTags, 'tags'), + priority: numberField(params.monitorPriority, 'priority'), options: params.options, } @@ -2008,22 +2035,23 @@ Return ONLY the search query string - no explanations.`, case 'datadog_list_monitors': return { ...baseParams, - name: params.listMonitorName || undefined, - tags: params.listMonitorTags || undefined, + name: optionalField(params.listMonitorName, 'name'), + tags: optionalField(params.listMonitorTags, 'tags'), /** * `monitorTags` belongs to Create Monitor but serializes for every operation, and * the block merges these params over the raw inputs. Without an explicit clear, a - * leftover value would filter this list while presenting it as complete. + * leftover value would filter this list while presenting it as complete. A tool + * call carries only this tool's args, so there it is the model's filter. */ - monitorTags: undefined, - pageSize: datadogNumber(params.listMonitorPageSize), - page: datadogNumber(params.listMonitorPage), + monitorTags: toolCallArg(context, params.monitorTags), + pageSize: numberField(params.listMonitorPageSize, 'pageSize'), + page: numberField(params.listMonitorPage, 'page'), } case 'datadog_mute_monitor': return { ...baseParams, - monitorId: params.muteMonitorId, + monitorId: field(params.muteMonitorId, 'monitorId'), scope: params.scope || undefined, end: datadogNumber(params.end), } @@ -2031,19 +2059,19 @@ Return ONLY the search query string - no explanations.`, case 'datadog_unmute_monitor': return { ...baseParams, - monitorId: params.muteMonitorId, + monitorId: field(params.muteMonitorId, 'monitorId'), scope: params.scope || undefined, - allScopes: toSwitchBoolean(params.unmuteAllScopes), + allScopes: switchField(params.unmuteAllScopes, 'allScopes'), } case 'datadog_query_logs': return { ...baseParams, - query: params.logQuery, - from: params.logFrom, - to: params.logTo, - limit: datadogNumber(params.logLimit), - cursor: params.logCursor || undefined, + query: field(params.logQuery, 'query'), + from: field(params.logFrom, 'from'), + to: field(params.logTo, 'to'), + limit: numberField(params.logLimit, 'limit'), + cursor: optionalField(params.logCursor, 'cursor'), } case 'datadog_send_logs': @@ -2052,22 +2080,25 @@ Return ONLY the search query string - no explanations.`, case 'datadog_create_downtime': return { ...baseParams, - scope: params.downtimeScope, - message: params.downtimeMessage, - start: datadogNumber(params.downtimeStart), - end: datadogNumber(params.downtimeEnd), - monitorId: params.downtimeMonitorId, - monitorTags: params.downtimeMonitorTags || undefined, - timezone: params.downtimeTimezone || undefined, - muteFirstRecoveryNotification: toSwitchBoolean(params.downtimeMuteFirstRecovery), + scope: field(params.downtimeScope, 'scope'), + message: field(params.downtimeMessage, 'message'), + start: numberField(params.downtimeStart, 'start'), + end: numberField(params.downtimeEnd, 'end'), + monitorId: field(params.downtimeMonitorId, 'monitorId'), + monitorTags: optionalField(params.downtimeMonitorTags, 'monitorTags'), + timezone: optionalField(params.downtimeTimezone, 'timezone'), + muteFirstRecoveryNotification: switchField( + params.downtimeMuteFirstRecovery, + 'muteFirstRecoveryNotification' + ), } case 'datadog_list_downtimes': return { ...baseParams, currentOnly: toSwitchBoolean(params.currentOnly), - limit: datadogNumber(params.downtimeLimit), - offset: datadogNumber(params.downtimeOffset), + limit: numberField(params.downtimeLimit, 'limit'), + offset: numberField(params.downtimeOffset, 'offset'), } case 'datadog_cancel_downtime': @@ -2076,130 +2107,152 @@ Return ONLY the search query string - no explanations.`, case 'datadog_list_incidents': return { ...baseParams, - include: params.incidentInclude || undefined, - pageSize: datadogNumber(params.incidentPageSize), - pageOffset: datadogNumber(params.incidentPageOffset), + include: optionalField(params.incidentInclude, 'include'), + pageSize: numberField(params.incidentPageSize, 'pageSize'), + pageOffset: numberField(params.incidentPageOffset, 'pageOffset'), } case 'datadog_get_incident': return { ...baseParams, incidentId: params.incidentId, - include: params.incidentInclude || undefined, + include: optionalField(params.incidentInclude, 'include'), } case 'datadog_create_incident': return { ...baseParams, - title: params.incidentTitle, - customerImpacted: toSwitchBoolean(params.incidentCustomerImpacted) ?? false, - severity: params.incidentSeverity || undefined, - customerImpactScope: params.incidentCustomerImpactScope || undefined, + title: field(params.incidentTitle, 'title'), + customerImpacted: + switchField(params.incidentCustomerImpacted, 'customerImpacted') ?? false, + severity: optionalField(params.incidentSeverity, 'severity'), + customerImpactScope: optionalField( + params.incidentCustomerImpactScope, + 'customerImpactScope' + ), incidentTypeUuid: params.incidentTypeUuid || undefined, - isTest: toSwitchBoolean(params.incidentIsTest), - fields: params.incidentFields || undefined, - notificationHandles: params.incidentNotificationHandles || undefined, + isTest: switchField(params.incidentIsTest, 'isTest'), + fields: optionalField(params.incidentFields, 'fields'), + notificationHandles: optionalField( + params.incidentNotificationHandles, + 'notificationHandles' + ), } case 'datadog_update_incident': return { ...baseParams, incidentId: params.incidentId, - title: params.incidentTitle || undefined, - severity: params.incidentSeverity || undefined, - customerImpacted: toSwitchBoolean(params.incidentCustomerImpacted), - customerImpactScope: params.incidentCustomerImpactScope || undefined, - customerImpactStart: params.incidentCustomerImpactStart || undefined, - customerImpactEnd: params.incidentCustomerImpactEnd || undefined, - detected: params.incidentDetected || undefined, - fields: params.incidentFields || undefined, - notificationHandles: params.incidentNotificationHandles || undefined, + title: optionalField(params.incidentTitle, 'title'), + severity: optionalField(params.incidentSeverity, 'severity'), + customerImpacted: switchField(params.incidentCustomerImpacted, 'customerImpacted'), + customerImpactScope: optionalField( + params.incidentCustomerImpactScope, + 'customerImpactScope' + ), + customerImpactStart: optionalField( + params.incidentCustomerImpactStart, + 'customerImpactStart' + ), + customerImpactEnd: optionalField( + params.incidentCustomerImpactEnd, + 'customerImpactEnd' + ), + detected: optionalField(params.incidentDetected, 'detected'), + fields: optionalField(params.incidentFields, 'fields'), + notificationHandles: optionalField( + params.incidentNotificationHandles, + 'notificationHandles' + ), } case 'datadog_add_incident_todo': return { ...baseParams, incidentId: params.incidentId, - content: params.todoContent, - assignees: params.todoAssignees, - dueDate: params.todoDueDate || undefined, + content: field(params.todoContent, 'content'), + assignees: field(params.todoAssignees, 'assignees'), + dueDate: optionalField(params.todoDueDate, 'dueDate'), } case 'datadog_list_slos': return { ...baseParams, - ids: params.sloIds || undefined, - query: params.sloQuery || undefined, - tagsQuery: params.sloTagsQuery || undefined, - metricsQuery: params.sloMetricsQuery || undefined, - limit: datadogNumber(params.sloLimit), - offset: datadogNumber(params.sloOffset), + ids: optionalField(params.sloIds, 'ids'), + query: optionalField(params.sloQuery, 'query'), + tagsQuery: optionalField(params.sloTagsQuery, 'tagsQuery'), + metricsQuery: optionalField(params.sloMetricsQuery, 'metricsQuery'), + limit: numberField(params.sloLimit, 'limit'), + offset: numberField(params.sloOffset, 'offset'), } case 'datadog_get_slo': return { ...baseParams, sloId: params.sloId, - withConfiguredAlertIds: toSwitchBoolean(params.sloWithConfiguredAlertIds), + withConfiguredAlertIds: switchField( + params.sloWithConfiguredAlertIds, + 'withConfiguredAlertIds' + ), } case 'datadog_create_slo': return { ...baseParams, - name: params.sloName, - type: params.sloType, - thresholds: params.sloThresholds, - description: params.sloDescription || undefined, - tags: params.sloTags || undefined, - query: params.sloMetricQuery || undefined, - monitorIds: params.sloMonitorIds || undefined, - groups: params.sloGroups || undefined, - targetThreshold: datadogNumber(params.sloTargetThreshold), - warningThreshold: datadogNumber(params.sloWarningThreshold), - timeframe: params.sloTimeframe || undefined, + name: field(params.sloName, 'name'), + type: field(params.sloType, 'type'), + thresholds: field(params.sloThresholds, 'thresholds'), + description: optionalField(params.sloDescription, 'description'), + tags: optionalField(params.sloTags, 'tags'), + query: optionalField(params.sloMetricQuery, 'query'), + monitorIds: optionalField(params.sloMonitorIds, 'monitorIds'), + groups: optionalField(params.sloGroups, 'groups'), + targetThreshold: numberField(params.sloTargetThreshold, 'targetThreshold'), + warningThreshold: numberField(params.sloWarningThreshold, 'warningThreshold'), + timeframe: optionalField(params.sloTimeframe, 'timeframe'), } case 'datadog_update_slo': return { ...baseParams, sloId: params.sloId, - name: params.sloName || undefined, - type: params.sloUpdateType || undefined, - thresholds: params.sloThresholds || undefined, - description: params.sloDescription || undefined, - tags: params.sloTags || undefined, - query: params.sloMetricQuery || undefined, - monitorIds: params.sloMonitorIds || undefined, - groups: params.sloGroups || undefined, - targetThreshold: datadogNumber(params.sloTargetThreshold), - warningThreshold: datadogNumber(params.sloWarningThreshold), - timeframe: params.sloTimeframe || undefined, + name: optionalField(params.sloName, 'name'), + type: optionalField(params.sloUpdateType, 'type'), + thresholds: optionalField(params.sloThresholds, 'thresholds'), + description: optionalField(params.sloDescription, 'description'), + tags: optionalField(params.sloTags, 'tags'), + query: optionalField(params.sloMetricQuery, 'query'), + monitorIds: optionalField(params.sloMonitorIds, 'monitorIds'), + groups: optionalField(params.sloGroups, 'groups'), + targetThreshold: numberField(params.sloTargetThreshold, 'targetThreshold'), + warningThreshold: numberField(params.sloWarningThreshold, 'warningThreshold'), + timeframe: optionalField(params.sloTimeframe, 'timeframe'), } case 'datadog_delete_slo': return { ...baseParams, sloId: params.sloId, - force: toSwitchBoolean(params.sloForce), + force: switchField(params.sloForce, 'force'), } case 'datadog_get_slo_history': return { ...baseParams, sloId: params.sloId, - fromTs: datadogNumber(params.sloFromTs), - toTs: datadogNumber(params.sloToTs), - target: datadogNumber(params.sloTarget), - applyCorrection: toSwitchBoolean(params.sloApplyCorrection), + fromTs: numberField(params.sloFromTs, 'fromTs'), + toTs: numberField(params.sloToTs, 'toTs'), + target: numberField(params.sloTarget, 'target'), + applyCorrection: switchField(params.sloApplyCorrection, 'applyCorrection'), } case 'datadog_list_dashboards': return { ...baseParams, - filterShared: toSwitchBoolean(params.dashboardFilterShared), - filterDeleted: toSwitchBoolean(params.dashboardFilterDeleted), - count: datadogNumber(params.dashboardCount), - start: datadogNumber(params.dashboardStart), + filterShared: switchField(params.dashboardFilterShared, 'filterShared'), + filterDeleted: switchField(params.dashboardFilterDeleted, 'filterDeleted'), + count: numberField(params.dashboardCount, 'count'), + start: numberField(params.dashboardStart, 'start'), } case 'datadog_get_dashboard': @@ -2208,14 +2261,17 @@ Return ONLY the search query string - no explanations.`, case 'datadog_create_dashboard': return { ...baseParams, - title: params.dashboardTitle, - layoutType: params.dashboardLayoutType, - widgets: params.dashboardWidgets, - description: params.dashboardDescription || undefined, - notifyList: params.dashboardNotifyList || undefined, - templateVariables: params.dashboardTemplateVariables || undefined, - tags: params.dashboardTags || undefined, - reflowType: params.dashboardReflowType || undefined, + title: field(params.dashboardTitle, 'title'), + layoutType: field(params.dashboardLayoutType, 'layoutType'), + widgets: field(params.dashboardWidgets, 'widgets'), + description: optionalField(params.dashboardDescription, 'description'), + notifyList: optionalField(params.dashboardNotifyList, 'notifyList'), + templateVariables: optionalField( + params.dashboardTemplateVariables, + 'templateVariables' + ), + tags: optionalField(params.dashboardTags, 'tags'), + reflowType: optionalField(params.dashboardReflowType, 'reflowType'), } case 'datadog_delete_dashboard': @@ -2224,42 +2280,42 @@ Return ONLY the search query string - no explanations.`, case 'datadog_list_synthetics_tests': return { ...baseParams, - pageSize: datadogNumber(params.syntheticsPageSize), - pageNumber: datadogNumber(params.syntheticsPageNumber), + pageSize: numberField(params.syntheticsPageSize, 'pageSize'), + pageNumber: numberField(params.syntheticsPageNumber, 'pageNumber'), } case 'datadog_get_synthetics_test': - return { ...baseParams, publicId: params.syntheticsPublicId } + return { ...baseParams, publicId: field(params.syntheticsPublicId, 'publicId') } case 'datadog_get_synthetics_results': case 'datadog_get_browser_synthetics_results': return { ...baseParams, - publicId: params.syntheticsPublicId, - fromTs: datadogNumber(params.syntheticsFromTs), - toTs: datadogNumber(params.syntheticsToTs), - probeDc: params.syntheticsProbeDc || undefined, + publicId: field(params.syntheticsPublicId, 'publicId'), + fromTs: numberField(params.syntheticsFromTs, 'fromTs'), + toTs: numberField(params.syntheticsToTs, 'toTs'), + probeDc: optionalField(params.syntheticsProbeDc, 'probeDc'), } case 'datadog_trigger_synthetics_tests': - return { ...baseParams, publicIds: params.syntheticsPublicIds } + return { ...baseParams, publicIds: field(params.syntheticsPublicIds, 'publicIds') } case 'datadog_update_synthetics_status': return { ...baseParams, - publicId: params.syntheticsPublicId, - newStatus: params.syntheticsNewStatus, + publicId: field(params.syntheticsPublicId, 'publicId'), + newStatus: field(params.syntheticsNewStatus, 'newStatus'), } case 'datadog_list_security_signals': return { ...baseParams, - query: params.signalQuery || undefined, - from: params.signalFrom || undefined, - to: params.signalTo || undefined, - sort: params.signalSort || undefined, - cursor: params.signalCursor || undefined, - limit: datadogNumber(params.signalLimit), + query: optionalField(params.signalQuery, 'query'), + from: optionalField(params.signalFrom, 'from'), + to: optionalField(params.signalTo, 'to'), + sort: optionalField(params.signalSort, 'sort'), + cursor: optionalField(params.signalCursor, 'cursor'), + limit: numberField(params.signalLimit, 'limit'), } case 'datadog_get_security_signal': @@ -2269,44 +2325,44 @@ Return ONLY the search query string - no explanations.`, return { ...baseParams, signalId: params.signalId, - state: params.signalState, - archiveReason: params.signalArchiveReason || undefined, - archiveComment: params.signalArchiveComment || undefined, + state: field(params.signalState, 'state'), + archiveReason: optionalField(params.signalArchiveReason, 'archiveReason'), + archiveComment: optionalField(params.signalArchiveComment, 'archiveComment'), } case 'datadog_update_security_signal_assignee': return { ...baseParams, signalId: params.signalId, - assigneeUuid: params.signalAssigneeUuid, + assigneeUuid: field(params.signalAssigneeUuid, 'assigneeUuid'), } case 'datadog_list_security_rules': return { ...baseParams, - query: params.ruleQuery || undefined, - sort: params.ruleSort || undefined, - pageSize: datadogNumber(params.rulePageSize), - pageNumber: datadogNumber(params.rulePageNumber), + query: optionalField(params.ruleQuery, 'query'), + sort: optionalField(params.ruleSort, 'sort'), + pageSize: numberField(params.rulePageSize, 'pageSize'), + pageNumber: numberField(params.rulePageNumber, 'pageNumber'), } case 'datadog_search_spans': return { ...baseParams, - query: params.spanQuery || undefined, - from: params.spanFrom || undefined, - to: params.spanTo || undefined, - sort: params.spanSort || undefined, - cursor: params.spanCursor || undefined, - limit: datadogNumber(params.spanLimit), + query: optionalField(params.spanQuery, 'query'), + from: optionalField(params.spanFrom, 'from'), + to: optionalField(params.spanTo, 'to'), + sort: optionalField(params.spanSort, 'sort'), + cursor: optionalField(params.spanCursor, 'cursor'), + limit: numberField(params.spanLimit, 'limit'), } case 'datadog_list_services': return { ...baseParams, - pageSize: datadogNumber(params.servicePageSize), - pageNumber: datadogNumber(params.servicePageNumber), - schemaVersion: params.serviceSchemaVersion || undefined, + pageSize: numberField(params.servicePageSize, 'pageSize'), + pageNumber: numberField(params.servicePageNumber, 'pageNumber'), + schemaVersion: optionalField(params.serviceSchemaVersion, 'schemaVersion'), } default: @@ -2473,7 +2529,10 @@ Return ONLY the search query string - no explanations.`, success: { type: 'boolean', description: 'Whether the operation succeeded' }, series: { type: 'json', description: 'Timeseries data' }, status: { type: 'string', description: 'Query status' }, - errors: { type: 'json', description: 'Metric series rejected during submission' }, + errors: { + type: 'json', + description: 'Metric series rejected during submission, or SLO history query errors', + }, event: { type: 'json', description: 'Event data' }, monitor: { type: 'json', description: 'Monitor data' }, monitors: { type: 'json', description: 'List of monitors' }, @@ -2486,6 +2545,7 @@ Return ONLY the search query string - no explanations.`, downtimes: { type: 'json', description: 'List of downtimes' }, totalCount: { type: 'number', description: 'Total downtimes matching the filter' }, incident: { type: 'json', description: 'Incident data' }, + included: { type: 'json', description: 'Related incident resources requested via include' }, incidents: { type: 'json', description: 'List of incidents' }, nextOffset: { type: 'number', description: 'Offset for the next page of incidents' }, todo: { type: 'json', description: 'Incident follow-up task' }, diff --git a/apps/sim/blocks/blocks/github.ts b/apps/sim/blocks/blocks/github.ts index a40fcf32d95..24e589f502a 100644 --- a/apps/sim/blocks/blocks/github.ts +++ b/apps/sim/blocks/blocks/github.ts @@ -2,7 +2,7 @@ import { Calendar } from '@sim/emcn/icons' import { GithubIcon } from '@/components/icons' import type { BlockConfig, BlockMeta } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' -import { createVersionedToolSelector, withSavedCredential } from '@/blocks/utils' +import { createVersionedToolSelector, mapperOperation, withSavedCredential } from '@/blocks/utils' import { getTrigger } from '@/triggers' /** Reviewers can be named individually or by team slug; either identifies the request. */ @@ -16,7 +16,9 @@ const REVIEWER_FIELD = ['reviewers', 'team_reviewers'] as const * * `toBoolean` marks a dropdown feeding a boolean tool param: a dropdown stores * its option id, so the value arrives as the string 'true'/'false' and the - * generic handler only JSON-parses `json`/`array` inputs. + * generic handler only JSON-parses `json`/`array` inputs. An entry whose + * `from` equals `to` only coerces; scoping it to the operation whose subBlock + * owns the field keeps a stale value left from another operation raw. */ const GITHUB_PARAM_ALIASES: ReadonlyArray<{ from: string @@ -44,6 +46,44 @@ const GITHUB_PARAM_ALIASES: ReadonlyArray<{ { from: 'fork_name', to: 'name', operations: ['github_fork_repo'] }, { from: 'fork_sort', to: 'sort', operations: ['github_list_forks'] }, { from: 'gist_public', to: 'public', operations: ['github_create_gist'], toBoolean: true }, + { + from: 'draft', + to: 'draft', + operations: ['github_create_pr', 'github_create_release'], + toBoolean: true, + }, + { from: 'prerelease', to: 'prerelease', operations: ['github_create_release'], toBoolean: true }, + { + from: 'default_branch_only', + to: 'default_branch_only', + operations: ['github_fork_repo'], + toBoolean: true, + }, +] + +/** + * Operations whose tools take no `owner`/`repo`: projects are addressed by owner + * login or node ID, gists by gist ID, and searches by query alone. + */ +const OPERATIONS_WITHOUT_REPOSITORY = [ + 'github_list_projects', + 'github_get_project', + 'github_create_project', + 'github_update_project', + 'github_delete_project', + 'github_search_code', + 'github_search_commits', + 'github_search_issues', + 'github_search_repos', + 'github_search_users', + 'github_create_gist', + 'github_get_gist', + 'github_list_gists', + 'github_update_gist', + 'github_delete_gist', + 'github_fork_gist', + 'github_star_gist', + 'github_unstar_gist', ] export const GitHubBlock: BlockConfig = { @@ -472,6 +512,7 @@ export const GitHubBlock: BlockConfig = { type: 'short-input', placeholder: 'e.g., microsoft', required: true, + condition: { field: 'operation', value: OPERATIONS_WITHOUT_REPOSITORY, not: true }, }, { id: 'repo', @@ -479,6 +520,7 @@ export const GitHubBlock: BlockConfig = { type: 'short-input', placeholder: 'e.g., vscode', required: true, + condition: { field: 'operation', value: OPERATIONS_WITHOUT_REPOSITORY, not: true }, }, { id: 'pullNumber', @@ -656,6 +698,7 @@ export const GitHubBlock: BlockConfig = { title: 'State', type: 'dropdown', options: [ + { label: 'No change', id: '' }, { label: 'Open', id: 'open' }, { label: 'Closed', id: 'closed' }, ], @@ -740,7 +783,6 @@ export const GitHubBlock: BlockConfig = { type: 'short-input', placeholder: 'Comma-separated: user1,user2', condition: { field: 'operation', value: 'github_request_reviewers' }, - mode: 'advanced', }, { id: 'team_reviewers', @@ -1042,6 +1084,7 @@ export const GitHubBlock: BlockConfig = { title: 'State', type: 'dropdown', options: [ + { label: 'No change', id: '' }, { label: 'Open', id: 'open' }, { label: 'Closed', id: 'closed' }, ], @@ -1410,6 +1453,7 @@ export const GitHubBlock: BlockConfig = { title: 'Public', type: 'dropdown', options: [ + { label: 'No change', id: '' }, { label: 'Private', id: 'false' }, { label: 'Public', id: 'true' }, ], @@ -1867,6 +1911,8 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, 'github_list_forks', 'github_list_milestones', 'github_list_stargazers', + 'github_list_branches', + 'github_get_pr_files', ], }, mode: 'advanced', @@ -1987,7 +2033,31 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, title: 'Page Number', type: 'short-input', placeholder: 'e.g., 1', - condition: { field: 'operation', value: 'github_list_tags' }, + condition: { + field: 'operation', + value: [ + 'github_list_tags', + 'github_list_branches', + 'github_list_commits', + 'github_list_forks', + 'github_list_gists', + 'github_list_issue_comments', + 'github_list_issues', + 'github_list_milestones', + 'github_list_pr_comments', + 'github_list_prs', + 'github_list_releases', + 'github_list_stargazers', + 'github_list_workflow_runs', + 'github_list_workflows', + 'github_get_pr_files', + 'github_search_code', + 'github_search_commits', + 'github_search_issues', + 'github_search_repos', + 'github_search_users', + ], + }, mode: 'advanced', }, ], @@ -2289,19 +2359,14 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, * block did not supply would clobber a model-supplied value on the agent * path. * - * On the agent tool-calling path `operation` is not part of the params - * this receives: `providers/utils.ts` spreads it in for the tool-selection - * call (`:736-739`) but builds the transform's input from `block.params` - * alone (`:776`). Every alias therefore skips there, which is the same - * behaviour as before this mapper existed - the agent path already works - * because a model supplies `content`/`title`/`sort` by their real names. - * That gap is shared by every block whose mapper branches on - * `params.operation`, so closing it belongs in the provider layer rather - * than here. + * On a tool call (Agent tool row, Pi, Human-in-the-loop) the operation + * arrives only in `context`, so it is read through `mapperOperation`. A + * value the user stored under a block-only id then reaches its tool param, + * and an unset one emits nothing, leaving the model's own argument intact. */ - params: (params) => { + params: (params, context) => { const result: Record = {} - const operation = typeof params.operation === 'string' ? params.operation : '' + const operation = mapperOperation(params, context) const isSet = (value: unknown) => value !== undefined && value !== null && value !== '' diff --git a/apps/sim/blocks/blocks/gitlab.test.ts b/apps/sim/blocks/blocks/gitlab.test.ts index 1d64a625926..fdd3abafd8a 100644 --- a/apps/sim/blocks/blocks/gitlab.test.ts +++ b/apps/sim/blocks/blocks/gitlab.test.ts @@ -94,3 +94,215 @@ describe('GitLabBlock access operations', () => { expect(untouched?.admin).toBeUndefined() }) }) + +/** Runs the mapper the way a tool call does: model/stored args with no operation, which arrives in context. */ +function mapToolCall(operation: string, args: Record) { + return block.tools.config.params?.({ accessToken: 'pat', ...args }, { operation }) +} + +describe('GitLabBlock mapper on tool calls', () => { + it('maps values a tool row stored under block-only fields to the tool params', () => { + expect( + mapToolCall('gitlab_compare_branches', { + projectId: 'g/p', + compareFrom: 'main', + compareTo: 'dev', + }) + ).toMatchObject({ from: 'main', to: 'dev' }) + expect(mapToolCall('gitlab_search_users', { userSearch: 'jdoe' })).toMatchObject({ + search: 'jdoe', + }) + expect( + mapToolCall('gitlab_update_member', { + resourceId: '42', + userId: 7, + memberAccessLevel: 'Maintainer', + }) + ).toMatchObject({ accessLevel: 40, userId: 7 }) + }) + + it("keeps the model's tool-named args when no block field is stored", () => { + expect( + mapToolCall('gitlab_compare_branches', { projectId: 42, from: 'v1', to: 'v2' }) + ).toMatchObject({ projectId: '42', from: 'v1', to: 'v2' }) + expect( + mapToolCall('gitlab_create_user', { + email: 'a@b.com', + username: 'ab', + name: 'A B', + resetPassword: true, + }) + ).toMatchObject({ email: 'a@b.com', username: 'ab', name: 'A B' }) + expect( + mapToolCall('gitlab_update_member', { resourceId: '42', userId: 7, accessLevel: 30 }) + ).toMatchObject({ accessLevel: 30 }) + expect( + mapToolCall('gitlab_list_issues', { projectId: '1', issueState: 'all', state: 'closed' }) + ).toMatchObject({ state: 'closed' }) + }) + + it('accepts the typed arrays and booleans a model sends', () => { + expect( + mapToolCall('gitlab_create_issue', { projectId: '1', title: 'Bug', assigneeIds: [3, 4] }) + ).toMatchObject({ assigneeIds: [3, 4] }) + expect( + mapToolCall('gitlab_create_release', { + projectId: '1', + tagName: 'v1', + milestones: ['M1', 'M2'], + }) + ).toMatchObject({ milestones: ['M1', 'M2'] }) + expect( + mapToolCall('gitlab_create_pipeline', { + projectId: '1', + ref: 'main', + variables: { FOO: 1 }, + }) + ).toMatchObject({ variables: [{ key: 'FOO', value: '1' }] }) + expect( + mapToolCall('gitlab_create_merge_request', { + projectId: '1', + title: 'T', + sourceBranch: 'a', + targetBranch: 'b', + squash: false, + })?.squash + ).toBe(false) + }) + + it('does not apply tool-named fallbacks on the canvas', () => { + const canvas = block.tools.config.params?.({ + accessToken: 'pat', + operation: 'gitlab_list_merge_requests', + projectId: '1', + sourceBranch: 'stale-create-mr-value', + }) + expect(canvas?.sourceBranch).toBeUndefined() + }) + + it('keeps create-only advanced values saved under another operation off update and merge requests', () => { + const canvas = (operation: string, extra: Record) => + block.tools.config.params?.({ + accessToken: 'pat', + operation, + projectId: '1', + issueIid: '2', + mergeRequestIid: '3', + ...extra, + }) + const updateIssue = canvas('gitlab_update_issue', { confidential: true, dueDate: '2026-12-31' }) + expect(updateIssue).toHaveProperty('confidential', undefined) + expect(updateIssue).toHaveProperty('dueDate', undefined) + expect(canvas('gitlab_update_merge_request', { draft: false })).toHaveProperty( + 'draft', + undefined + ) + expect(canvas('gitlab_merge_merge_request', { sha: 'stale-approve-sha' })).toHaveProperty( + 'sha', + undefined + ) + expect(canvas('gitlab_merge_merge_request', { mergeSha: 'abc123' })).toMatchObject({ + sha: 'abc123', + }) + }) + + it("passes the model's update and merge values through on tool calls", () => { + expect( + mapToolCall('gitlab_update_issue', { + projectId: '1', + issueIid: 2, + confidential: false, + dueDate: '2026-12-31', + }) + ).toMatchObject({ confidential: false, dueDate: '2026-12-31' }) + expect( + mapToolCall('gitlab_update_merge_request', { + projectId: '1', + mergeRequestIid: 3, + draft: true, + }) + ).toMatchObject({ draft: true }) + expect( + mapToolCall('gitlab_merge_merge_request', { projectId: '1', mergeRequestIid: 3, sha: 'abc' }) + ).toMatchObject({ sha: 'abc' }) + }) + + it("keeps the model's explicit opt-outs and milestone unassign on tool calls", () => { + expect( + mapToolCall('gitlab_merge_merge_request', { + projectId: '1', + mergeRequestIid: 3, + squash: false, + shouldRemoveSourceBranch: false, + }) + ).toMatchObject({ squash: false, shouldRemoveSourceBranch: false }) + expect( + mapToolCall('gitlab_update_issue', { projectId: '1', issueIid: 2, milestoneId: 0 }) + ).toMatchObject({ milestoneId: 0 }) + expect( + mapToolCall('gitlab_update_merge_request', { + projectId: '1', + mergeRequestIid: 3, + milestoneId: 0, + }) + ).toMatchObject({ milestoneId: 0 }) + expect(mapToolCall('gitlab_list_groups', { allAvailable: false })).toMatchObject({ + allAvailable: false, + }) + }) + + it("keeps the model's empty string that clears a field on tool calls", () => { + expect( + mapToolCall('gitlab_update_issue', { + projectId: '1', + issueIid: 2, + labels: '', + description: '', + }) + ).toMatchObject({ labels: '', description: '' }) + expect( + mapToolCall('gitlab_update_merge_request', { + projectId: '1', + mergeRequestIid: 3, + labels: '', + assigneeIds: '', + }) + ).toMatchObject({ labels: '', assigneeIds: '' }) + expect( + mapToolCall('gitlab_update_member', { + resourceId: '1', + userId: 7, + accessLevel: 30, + expiresAt: '', + }) + ).toMatchObject({ expiresAt: '' }) + expect( + mapToolCall('gitlab_update_invitation', { + resourceId: '1', + email: 'a@b.c', + accessLevel: 30, + expiresAt: '', + }) + ).toMatchObject({ accessLevel: 30, expiresAt: '' }) + expect( + mapToolCall('gitlab_update_invitation', { + resourceId: '1', + email: 'a@b.c', + expiresAt: '', + }) + ).toMatchObject({ expiresAt: '' }) + }) + + it('leaves a blank canvas field unsent on update operations', () => { + const result = block.tools.config.params?.({ + accessToken: 'pat', + operation: 'gitlab_update_issue', + projectId: '1', + issueIid: 2, + labels: '', + description: '', + }) + expect(result?.labels).toBeUndefined() + expect(result?.description).toBeUndefined() + }) +}) diff --git a/apps/sim/blocks/blocks/gitlab.ts b/apps/sim/blocks/blocks/gitlab.ts index a2f5520eb2d..4cf652e5093 100644 --- a/apps/sim/blocks/blocks/gitlab.ts +++ b/apps/sim/blocks/blocks/gitlab.ts @@ -1,7 +1,7 @@ import { GitLabIcon } from '@/components/icons' -import type { BlockConfig, BlockMeta } from '@/blocks/types' +import type { BlockConfig, BlockMeta, BlockToolParamsContext } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' -import { withSavedCredential } from '@/blocks/utils' +import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils' import { coerceGitLabAccessLevel, GITLAB_ACCESS_LEVEL_OPTIONS, @@ -104,11 +104,15 @@ const USER_ID_REQUIRED_OPS = USER_ID_OPS.filter((op) => op !== 'gitlab_add_membe /** * Parses an optional JSON text field at execution time. Returns undefined for - * blank input and throws a field-specific error for malformed JSON. + * blank input and throws a field-specific error for malformed JSON. A tool call + * may already carry the parsed object or array, which passes through. */ -function parseJsonParam(raw: unknown, label: string): any { +function parseJsonParam( + raw: unknown, + label: string +): Record | unknown[] | undefined { if (raw === undefined || raw === null || raw === '') return undefined - let parsed = raw + let parsed: unknown = raw if (typeof raw === 'string') { try { parsed = JSON.parse(raw) @@ -120,7 +124,18 @@ function parseJsonParam(raw: unknown, label: string): any { if (typeof parsed !== 'object') { throw new Error(`${label} must be a JSON object or array.`) } - return parsed + return Array.isArray(parsed) ? parsed : (parsed as Record) +} + +/** + * Parses CI variables (pipeline or job) and normalizes the `{KEY: value}` + * shorthand to GitLab's `[{ key, value }]` array form. + */ +function parseCiVariables(raw: unknown, label: string): unknown[] | undefined { + const parsed = parseJsonParam(raw, label) + if (parsed === undefined) return undefined + if (Array.isArray(parsed)) return parsed + return Object.entries(parsed).map(([key, value]) => ({ key, value: String(value) })) } /** Maps a "Leave unchanged / Yes / No" dropdown value to true, false, or undefined. */ @@ -130,6 +145,62 @@ function parseTriState(raw: unknown): boolean | undefined { return undefined } +/** + * Trimmed text of a string or finite-number input, `''` for anything else. The + * canvas sends text, while a tool call can carry a numeric id (`projectId: 42`). + */ +function inputText(value: unknown): string { + if (typeof value === 'string') return value.trim() + if (typeof value === 'number' && Number.isFinite(value)) return String(value) + return '' +} + +/** {@link inputText}, or `undefined` when blank. */ +function optionalText(value: unknown): string | undefined { + return inputText(value) || undefined +} + +/** + * A model's explicit `''` on a tool call, which GitLab update endpoints read as + * "clear this field". The canvas never forwards a blank field, so this is + * `undefined` there. + */ +function toolCallClear( + value: unknown, + context: BlockToolParamsContext | undefined +): '' | undefined { + return toolCallArg(context, value === '' ? '' : undefined) +} + +/** + * Numeric ids from a comma-separated string (canvas) or the array or number a + * tool call sends. + */ +function parseIdList(value: unknown): number[] | undefined { + if (Array.isArray(value)) return value.map((id) => Number(id)) + if (typeof value === 'number') return [value] + if (typeof value !== 'string' || !value) return undefined + return value.split(',').map((id) => Number(id.trim())) +} + +/** Titles from a comma-separated string (canvas) or the array a tool call sends. */ +function parseTitleList(value: unknown): string[] | undefined { + const items = Array.isArray(value) + ? value.map((title) => String(title)) + : typeof value === 'string' && value + ? value.split(',') + : undefined + return items?.map((title) => title.trim()).filter(Boolean) +} + +/** + * A switch input: the canvas drops an off switch as before, while a tool call + * keeps the model's explicit `false`. + */ +function switchInput(value: unknown, context: BlockToolParamsContext | undefined): unknown { + return value || toolCallArg(context, value === false ? false : undefined) +} + export const GitLabBlock: BlockConfig = { type: 'gitlab', hideFromToolbar: true, @@ -605,6 +676,16 @@ Return ONLY the title - no explanations, no extra text.`, placeholder: 'Describe the issue or merge request...', }, }, + { + id: 'updateTitle', + title: 'Title', + type: 'short-input', + placeholder: 'New title (leave blank to keep the current title)', + condition: { + field: 'operation', + value: ['gitlab_update_issue', 'gitlab_update_merge_request'], + }, + }, { id: 'description', title: 'Description', @@ -975,13 +1056,24 @@ Return ONLY the timestamp string - no explanations, no extra text.`, id: 'sha', title: 'Commit SHA', type: 'short-input', - placeholder: 'Optional HEAD SHA to approve', + placeholder: 'Optional HEAD SHA of the source branch', mode: 'advanced', condition: { field: 'operation', value: ['gitlab_approve_merge_request'], }, }, + { + id: 'mergeSha', + title: 'Commit SHA', + type: 'short-input', + placeholder: 'Optional HEAD SHA of the source branch', + mode: 'advanced', + condition: { + field: 'operation', + value: ['gitlab_merge_merge_request'], + }, + }, { id: 'labels', title: 'Labels', @@ -1032,6 +1124,34 @@ Return ONLY the timestamp string - no explanations, no extra text.`, ], }, }, + { + id: 'dueDate', + title: 'Due Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD (optional)', + mode: 'advanced', + condition: { + field: 'operation', + value: ['gitlab_create_issue'], + }, + wandConfig: { + enabled: true, + prompt: `Generate a due date in YYYY-MM-DD format based on the user's description. + +Return ONLY the date string - no explanations, no extra text.`, + placeholder: 'Describe the due date (e.g., "next Friday")...', + }, + }, + { + id: 'confidential', + title: 'Confidential', + type: 'switch', + mode: 'advanced', + condition: { + field: 'operation', + value: ['gitlab_create_issue'], + }, + }, { id: 'issueState', title: 'State', @@ -1117,6 +1237,38 @@ Return ONLY the timestamp string - no explanations, no extra text.`, value: ['gitlab_create_merge_request', 'gitlab_merge_merge_request'], }, }, + { + id: 'draft', + title: 'Draft', + type: 'switch', + mode: 'advanced', + condition: { + field: 'operation', + value: ['gitlab_create_merge_request'], + }, + }, + { + id: 'mergeWhenPipelineSucceeds', + title: 'Merge When Checks Pass', + type: 'switch', + mode: 'advanced', + description: 'Set the merge request to auto-merge once its checks pass', + condition: { + field: 'operation', + value: ['gitlab_merge_merge_request'], + }, + }, + { + id: 'squashCommitMessage', + title: 'Squash Commit Message', + type: 'long-input', + placeholder: 'Custom squash commit message (optional)', + mode: 'advanced', + condition: { + field: 'operation', + value: ['gitlab_merge_merge_request'], + }, + }, // Tri-state variants for Update MR: a switch cannot express "turn this // off" without also clobbering the setting on every unrelated update. { @@ -2170,59 +2322,67 @@ Return ONLY the JSON array - no explanations, no extra text.`, tool: (params) => { return params.operation || 'gitlab_list_projects' }, - params: (params) => { - const baseParams: Record = { + params: (params, context) => { + const operation = mapperOperation(params, context) + const baseParams: Record = { accessToken: params.accessToken, - host: params.host?.trim() || undefined, + host: optionalText(params.host), } + const projectId = inputText(params.projectId) + const groupId = inputText(params.groupId) + const resourceId = inputText(params.resourceId) + const pagination = { + perPage: params.perPage ? Number(params.perPage) : undefined, + page: params.page ? Number(params.page) : undefined, + } + const sort = params.sortOrder || toolCallArg(context, params.sort) || undefined - switch (params.operation) { + switch (operation) { case 'gitlab_list_projects': return { ...baseParams, owned: params.owned || undefined, membership: params.membership || undefined, - search: params.searchQuery?.trim() || undefined, + search: optionalText(params.searchQuery) || toolCallArg(context, params.search), visibility: params.visibility || undefined, - orderBy: params.projectOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + orderBy: params.projectOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } case 'gitlab_get_project': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, } case 'gitlab_list_groups': return { ...baseParams, owned: params.owned || undefined, - search: params.searchQuery?.trim() || undefined, - topLevelOnly: params.groupsTopLevelOnly || undefined, + search: optionalText(params.searchQuery) || toolCallArg(context, params.search), + topLevelOnly: + params.groupsTopLevelOnly || toolCallArg(context, params.topLevelOnly) || undefined, visibility: params.visibility || undefined, minAccessLevel: params.groupMinAccessLevel ? Number(params.groupMinAccessLevel) - : undefined, - allAvailable: params.groupAllAvailable || undefined, - orderBy: params.groupOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + : toolCallArg(context, params.minAccessLevel), + allAvailable: params.groupAllAvailable || toolCallArg(context, params.allAvailable), + orderBy: params.groupOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } case 'gitlab_get_group': - if (!params.groupId?.trim()) { + if (!groupId) { throw new Error('Group ID is required.') } return { ...baseParams, - groupId: params.groupId.trim(), + groupId, } case 'gitlab_list_user_memberships': { @@ -2234,21 +2394,22 @@ Return ONLY the JSON array - no explanations, no extra text.`, ...baseParams, userId: membershipUserId, membershipType: params.membershipType || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + ...pagination, } } case 'gitlab_list_issues': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - state: params.issueState !== 'all' ? params.issueState : undefined, - labels: params.labels?.trim() || undefined, - search: params.searchQuery?.trim() || undefined, + projectId, + state: + (params.issueState !== 'all' ? params.issueState : undefined) || + toolCallArg(context, params.state), + labels: optionalText(params.labels), + search: optionalText(params.searchQuery) || toolCallArg(context, params.search), assigneeId: (() => { const raw = String(params.assigneeId ?? '').trim() if (!raw) return undefined @@ -2256,479 +2417,489 @@ Return ONLY the JSON array - no explanations, no extra text.`, if (Number.isNaN(parsed)) throw new Error('Assignee ID must be a number.') return parsed })(), - milestoneTitle: params.milestoneTitle?.trim() || undefined, - orderBy: params.issueOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + milestoneTitle: optionalText(params.milestoneTitle), + orderBy: params.issueOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } case 'gitlab_get_issue': - if (!params.projectId?.trim() || !params.issueIid) { + if (!projectId || !params.issueIid) { throw new Error('Project ID and Issue Number are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, issueIid: Number(params.issueIid), } - case 'gitlab_create_issue': - if (!params.projectId?.trim() || !params.title?.trim()) { + case 'gitlab_create_issue': { + const title = inputText(params.title) + if (!projectId || !title) { throw new Error('Project ID and title are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - title: params.title.trim(), - description: params.description?.trim() || undefined, - labels: params.labels?.trim() || undefined, - assigneeIds: params.assigneeIds - ? params.assigneeIds.split(',').map((id: string) => Number(id.trim())) - : undefined, + projectId, + title, + description: optionalText(params.description), + labels: optionalText(params.labels), + assigneeIds: parseIdList(params.assigneeIds), milestoneId: params.milestoneId ? Number(params.milestoneId) : undefined, + dueDate: optionalText(params.dueDate), + confidential: switchInput(params.confidential, context), } + } case 'gitlab_update_issue': - if (!params.projectId?.trim() || !params.issueIid) { + if (!projectId || !params.issueIid) { throw new Error('Project ID and Issue IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, issueIid: Number(params.issueIid), - title: params.title?.trim() || undefined, - description: params.description?.trim() || undefined, - labels: params.labels?.trim() || undefined, - assigneeIds: params.assigneeIds - ? params.assigneeIds.split(',').map((id: string) => Number(id.trim())) - : undefined, - milestoneId: params.milestoneId ? Number(params.milestoneId) : undefined, + title: optionalText(params.updateTitle) || optionalText(params.title), + description: + optionalText(params.description) ?? toolCallClear(params.description, context), + labels: optionalText(params.labels) ?? toolCallClear(params.labels, context), + assigneeIds: parseIdList(params.assigneeIds), + milestoneId: params.milestoneId + ? Number(params.milestoneId) + : toolCallArg(context, params.milestoneId === 0 ? 0 : undefined), stateEvent: params.stateEvent || undefined, + dueDate: toolCallArg(context, params.dueDate), + confidential: toolCallArg(context, params.confidential), } case 'gitlab_delete_issue': - if (!params.projectId?.trim() || !params.issueIid) { + if (!projectId || !params.issueIid) { throw new Error('Project ID and Issue IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, issueIid: Number(params.issueIid), } - case 'gitlab_create_issue_note': - if (!params.projectId?.trim() || !params.issueIid || !params.body?.trim()) { + case 'gitlab_create_issue_note': { + const body = inputText(params.body) + if (!projectId || !params.issueIid || !body) { throw new Error('Project ID, Issue IID, and comment body are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, issueIid: Number(params.issueIid), - body: params.body.trim(), - internal: params.internalNote || undefined, + body, + internal: params.internalNote || toolCallArg(context, params.internal) || undefined, } + } case 'gitlab_list_merge_requests': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - state: params.mrState !== 'all' ? params.mrState : undefined, - labels: params.labels?.trim() || undefined, - sourceBranch: params.sourceBranchFilter?.trim() || undefined, - targetBranch: params.targetBranchFilter?.trim() || undefined, - orderBy: params.mrOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + projectId, + state: + (params.mrState !== 'all' ? params.mrState : undefined) || + toolCallArg(context, params.state), + labels: optionalText(params.labels), + sourceBranch: + optionalText(params.sourceBranchFilter) || + optionalText(toolCallArg(context, params.sourceBranch)), + targetBranch: + optionalText(params.targetBranchFilter) || + optionalText(toolCallArg(context, params.targetBranch)), + orderBy: params.mrOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } case 'gitlab_get_merge_request': - if (!params.projectId?.trim() || !params.mergeRequestIid) { + if (!projectId || !params.mergeRequestIid) { throw new Error('Project ID and Merge Request IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), } - case 'gitlab_create_merge_request': - if ( - !params.projectId?.trim() || - !params.title?.trim() || - !params.sourceBranch?.trim() || - !params.targetBranch?.trim() - ) { + case 'gitlab_create_merge_request': { + const title = inputText(params.title) + const sourceBranch = inputText(params.sourceBranch) + const targetBranch = inputText(params.targetBranch) + if (!projectId || !title || !sourceBranch || !targetBranch) { throw new Error('Project ID, title, source branch, and target branch are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - title: params.title.trim(), - sourceBranch: params.sourceBranch.trim(), - targetBranch: params.targetBranch.trim(), - description: params.description?.trim() || undefined, - labels: params.labels?.trim() || undefined, - assigneeIds: params.assigneeIds - ? params.assigneeIds.split(',').map((id: string) => Number(id.trim())) - : undefined, + projectId, + title, + sourceBranch, + targetBranch, + description: optionalText(params.description), + labels: optionalText(params.labels), + assigneeIds: parseIdList(params.assigneeIds), milestoneId: params.milestoneId ? Number(params.milestoneId) : undefined, - removeSourceBranch: params.removeSourceBranch || undefined, - squash: params.squash || undefined, + removeSourceBranch: switchInput(params.removeSourceBranch, context), + squash: switchInput(params.squash, context), + draft: switchInput(params.draft, context), } + } case 'gitlab_update_merge_request': - if (!params.projectId?.trim() || !params.mergeRequestIid) { + if (!projectId || !params.mergeRequestIid) { throw new Error('Project ID and Merge Request IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), - title: params.title?.trim() || undefined, - description: params.description?.trim() || undefined, - labels: params.labels?.trim() || undefined, - assigneeIds: params.assigneeIds - ? params.assigneeIds.split(',').map((id: string) => Number(id.trim())) - : undefined, - milestoneId: params.milestoneId ? Number(params.milestoneId) : undefined, + title: optionalText(params.updateTitle) || optionalText(params.title), + description: + optionalText(params.description) ?? toolCallClear(params.description, context), + labels: optionalText(params.labels) ?? toolCallClear(params.labels, context), + assigneeIds: + parseIdList(params.assigneeIds) ?? toolCallClear(params.assigneeIds, context), + milestoneId: params.milestoneId + ? Number(params.milestoneId) + : toolCallArg(context, params.milestoneId === 0 ? 0 : undefined), stateEvent: params.stateEvent || undefined, - removeSourceBranch: parseTriState(params.updateRemoveSourceBranch), - squash: parseTriState(params.updateSquash), + removeSourceBranch: + parseTriState(params.updateRemoveSourceBranch) ?? + parseTriState(toolCallArg(context, params.removeSourceBranch)), + squash: + parseTriState(params.updateSquash) ?? + parseTriState(toolCallArg(context, params.squash)), + draft: toolCallArg(context, params.draft), } case 'gitlab_merge_merge_request': - if (!params.projectId?.trim() || !params.mergeRequestIid) { + if (!projectId || !params.mergeRequestIid) { throw new Error('Project ID and Merge Request IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), - mergeCommitMessage: params.mergeCommitMessage?.trim() || undefined, - squash: params.squash || undefined, - shouldRemoveSourceBranch: params.removeSourceBranch || undefined, - } - - case 'gitlab_create_merge_request_note': - if (!params.projectId?.trim() || !params.mergeRequestIid || !params.body?.trim()) { + mergeCommitMessage: optionalText(params.mergeCommitMessage), + squashCommitMessage: optionalText(params.squashCommitMessage), + squash: switchInput(params.squash, context), + shouldRemoveSourceBranch: + params.removeSourceBranch || toolCallArg(context, params.shouldRemoveSourceBranch), + mergeWhenPipelineSucceeds: switchInput(params.mergeWhenPipelineSucceeds, context), + sha: optionalText(params.mergeSha) || optionalText(toolCallArg(context, params.sha)), + } + + case 'gitlab_create_merge_request_note': { + const body = inputText(params.body) + if (!projectId || !params.mergeRequestIid || !body) { throw new Error('Project ID, Merge Request IID, and comment body are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), - body: params.body.trim(), - internal: params.internalNote || undefined, + body, + internal: params.internalNote || toolCallArg(context, params.internal) || undefined, } + } case 'gitlab_list_pipelines': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - status: params.pipelineStatus || undefined, - ref: params.ref?.trim() || undefined, - orderBy: params.pipelineOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + projectId, + status: params.pipelineStatus || toolCallArg(context, params.status) || undefined, + ref: optionalText(params.ref), + orderBy: params.pipelineOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } case 'gitlab_get_pipeline': - if (!params.projectId?.trim() || !params.pipelineId) { + if (!projectId || !params.pipelineId) { throw new Error('Project ID and Pipeline ID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, pipelineId: Number(params.pipelineId), } - case 'gitlab_create_pipeline': - if (!params.projectId?.trim() || !params.ref?.trim()) { + case 'gitlab_create_pipeline': { + const ref = inputText(params.ref) + if (!projectId || !ref) { throw new Error('Project ID and branch/tag ref are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - ref: params.ref.trim(), - variables: (() => { - const parsed = parseJsonParam(params.pipelineVariables, 'Pipeline Variables') - if (parsed === undefined) return undefined - // Accept {KEY: value} shorthand and normalize to GitLab's array form. - if (!Array.isArray(parsed) && typeof parsed === 'object') { - return Object.entries(parsed).map(([key, value]) => ({ - key, - value: String(value), - })) - } - return parsed - })(), - inputs: parseJsonParam(params.pipelineInputs, 'Pipeline Inputs'), + projectId, + ref, + variables: + parseCiVariables(params.pipelineVariables, 'Pipeline Variables') ?? + parseCiVariables(toolCallArg(context, params.variables), 'Pipeline Variables'), + inputs: + parseJsonParam(params.pipelineInputs, 'Pipeline Inputs') ?? + parseJsonParam(toolCallArg(context, params.inputs), 'Pipeline Inputs'), } + } case 'gitlab_retry_pipeline': case 'gitlab_cancel_pipeline': - if (!params.projectId?.trim() || !params.pipelineId) { + if (!projectId || !params.pipelineId) { throw new Error('Project ID and Pipeline ID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, pipelineId: Number(params.pipelineId), } case 'gitlab_list_repository_tree': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - path: params.path?.trim() || undefined, - ref: params.ref?.trim() || undefined, + projectId, + path: optionalText(params.path), + ref: optionalText(params.ref), recursive: params.recursive || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + ...pagination, } - case 'gitlab_get_file': - if (!params.projectId?.trim() || !params.filePath?.trim() || !params.ref?.trim()) { + case 'gitlab_get_file': { + const filePath = inputText(params.filePath) + const ref = inputText(params.ref) + if (!projectId || !filePath || !ref) { throw new Error('Project ID, file path, and ref are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - filePath: params.filePath.trim(), - ref: params.ref.trim(), + projectId, + filePath, + ref, } + } case 'gitlab_create_file': - case 'gitlab_update_file': - if ( - !params.projectId?.trim() || - !params.filePath?.trim() || - !params.branch?.trim() || - !params.content || - !params.commitMessage?.trim() - ) { + case 'gitlab_update_file': { + const filePath = inputText(params.filePath) + const branch = inputText(params.branch) + const commitMessage = inputText(params.commitMessage) + if (!projectId || !filePath || !branch || !params.content || !commitMessage) { throw new Error( 'Project ID, file path, branch, content, and commit message are required.' ) } return { ...baseParams, - projectId: params.projectId.trim(), - filePath: params.filePath.trim(), - branch: params.branch.trim(), + projectId, + filePath, + branch, content: params.content, - commitMessage: params.commitMessage.trim(), - startBranch: params.startBranch?.trim() || undefined, - authorName: params.authorName?.trim() || undefined, - authorEmail: params.authorEmail?.trim() || undefined, + commitMessage, + startBranch: optionalText(params.startBranch), + authorName: optionalText(params.authorName), + authorEmail: optionalText(params.authorEmail), executeFilemode: parseTriState(params.executeFilemode), - ...(params.operation === 'gitlab_update_file' - ? { lastCommitId: params.lastCommitId?.trim() || undefined } + ...(operation === 'gitlab_update_file' + ? { lastCommitId: optionalText(params.lastCommitId) } : {}), } + } - case 'gitlab_create_branch': - if (!params.projectId?.trim() || !params.branch?.trim() || !params.ref?.trim()) { + case 'gitlab_create_branch': { + const branch = inputText(params.branch) + const ref = inputText(params.ref) + if (!projectId || !branch || !ref) { throw new Error('Project ID, branch name, and source ref are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - branch: params.branch.trim(), - ref: params.ref.trim(), + projectId, + branch, + ref, } + } case 'gitlab_list_branches': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - search: params.query?.trim() || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + projectId, + search: optionalText(params.query) || toolCallArg(context, params.search), + ...pagination, } - case 'gitlab_delete_branch': - if (!params.projectId?.trim() || !params.branch?.trim()) { + case 'gitlab_delete_branch': { + const branch = inputText(params.branch) + if (!projectId || !branch) { throw new Error('Project ID and branch name are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - branch: params.branch.trim(), + projectId, + branch, } + } - case 'gitlab_compare_branches': - if ( - !params.projectId?.trim() || - !params.compareFrom?.trim() || - !params.compareTo?.trim() - ) { + case 'gitlab_compare_branches': { + const from = + inputText(params.compareFrom) || inputText(toolCallArg(context, params.from)) + const to = inputText(params.compareTo) || inputText(toolCallArg(context, params.to)) + if (!projectId || !from || !to) { throw new Error('Project ID, from ref, and to ref are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - from: params.compareFrom.trim(), - to: params.compareTo.trim(), + projectId, + from, + to, straight: params.straight || undefined, - fromProjectId: params.fromProjectId?.trim() || undefined, + fromProjectId: optionalText(params.fromProjectId), unidiff: params.unidiff || undefined, } + } case 'gitlab_list_commits': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - refName: params.refName?.trim() || undefined, - since: params.since?.trim() || undefined, - until: params.until?.trim() || undefined, - path: params.path?.trim() || undefined, - author: params.author?.trim() || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + projectId, + refName: optionalText(params.refName), + since: optionalText(params.since), + until: optionalText(params.until), + path: optionalText(params.path), + author: optionalText(params.author), + ...pagination, } case 'gitlab_get_merge_request_changes': - if (!params.projectId?.trim() || !params.mergeRequestIid) { + if (!projectId || !params.mergeRequestIid) { throw new Error('Project ID and Merge Request IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), } case 'gitlab_approve_merge_request': - if (!params.projectId?.trim() || !params.mergeRequestIid) { + if (!projectId || !params.mergeRequestIid) { throw new Error('Project ID and Merge Request IID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, mergeRequestIid: Number(params.mergeRequestIid), - sha: params.sha?.trim() || undefined, + sha: optionalText(params.sha), } case 'gitlab_list_pipeline_jobs': - if (!params.projectId?.trim() || !params.pipelineId) { + if (!projectId || !params.pipelineId) { throw new Error('Project ID and Pipeline ID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, pipelineId: Number(params.pipelineId), scope: params.scope || undefined, includeRetried: params.includeRetried || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + ...pagination, } case 'gitlab_get_job_log': - if (!params.projectId?.trim() || !params.jobId) { + if (!projectId || !params.jobId) { throw new Error('Project ID and Job ID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, jobId: Number(params.jobId), } case 'gitlab_play_job': - if (!params.projectId?.trim() || !params.jobId) { + if (!projectId || !params.jobId) { throw new Error('Project ID and Job ID are required.') } return { ...baseParams, - projectId: params.projectId.trim(), + projectId, jobId: Number(params.jobId), - jobVariables: (() => { - const parsed = parseJsonParam(params.jobVariables, 'Job Variables') - if (parsed === undefined) return undefined - if (!Array.isArray(parsed) && typeof parsed === 'object') { - return Object.entries(parsed).map(([key, value]) => ({ - key, - value: String(value), - })) - } - return parsed - })(), + jobVariables: parseCiVariables(params.jobVariables, 'Job Variables'), } case 'gitlab_list_releases': - if (!params.projectId?.trim()) { + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectId.trim(), - orderBy: params.releaseOrderBy || undefined, - sort: params.sortOrder || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + projectId, + orderBy: params.releaseOrderBy || toolCallArg(context, params.orderBy) || undefined, + sort, + ...pagination, } - case 'gitlab_create_release': - if (!params.projectId?.trim() || !params.tagName?.trim()) { + case 'gitlab_create_release': { + const tagName = inputText(params.tagName) + if (!projectId || !tagName) { throw new Error('Project ID and tag name are required.') } return { ...baseParams, - projectId: params.projectId.trim(), - tagName: params.tagName.trim(), - name: params.releaseName?.trim() || undefined, - description: params.description?.trim() || undefined, - ref: params.ref?.trim() || undefined, - releasedAt: params.releasedAt?.trim() || undefined, - tagMessage: params.tagMessage?.trim() || undefined, + projectId, + tagName, + name: + optionalText(params.releaseName) || optionalText(toolCallArg(context, params.name)), + description: optionalText(params.description), + ref: optionalText(params.ref), + releasedAt: optionalText(params.releasedAt), + tagMessage: optionalText(params.tagMessage), assetLinks: parseJsonParam(params.assetLinks, 'Asset Links'), - milestones: params.releaseMilestones - ? params.releaseMilestones - .split(',') - .map((title: string) => title.trim()) - .filter(Boolean) - : undefined, + milestones: + parseTitleList(params.releaseMilestones) ?? + parseTitleList(toolCallArg(context, params.milestones)), } + } case 'gitlab_list_members': - if (!params.resourceId?.trim()) { + if (!resourceId) { throw new Error('Project / Group ID is required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - directOnly: params.directMembersOnly || undefined, - query: params.query?.trim() || undefined, - userIds: params.memberUserIds?.trim() || undefined, - state: params.memberState || undefined, + resourceId, + directOnly: + params.directMembersOnly || toolCallArg(context, params.directOnly) || undefined, + query: optionalText(params.query), + userIds: + optionalText(params.memberUserIds) || + optionalText(toolCallArg(context, params.userIds)), + state: params.memberState || toolCallArg(context, params.state) || undefined, showSeatInfo: params.showSeatInfo || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + ...pagination, } case 'gitlab_add_member': { const addMemberUserId = String(params.userId ?? '').trim() + const username = inputText(params.username) if ( - !params.resourceId?.trim() || - (!addMemberUserId && !params.username?.trim()) || + !resourceId || + (!addMemberUserId && !username) || !hasGitLabAccessLevel(params.accessLevel) ) { throw new Error( @@ -2738,85 +2909,89 @@ Return ONLY the JSON array - no explanations, no extra text.`, return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), + resourceId, userId: addMemberUserId ? Number(addMemberUserId) : undefined, - username: params.username?.trim() || undefined, + username: username || undefined, accessLevel: coerceGitLabAccessLevel(params.accessLevel), - expiresAt: params.expiresAt?.trim() || undefined, + expiresAt: optionalText(params.expiresAt), memberRoleId: params.memberRoleId ? Number(params.memberRoleId) : undefined, } } - case 'gitlab_update_member': - if ( - !params.resourceId?.trim() || - !params.userId || - !hasGitLabAccessLevel(params.memberAccessLevel) - ) { + case 'gitlab_update_member': { + const level = hasGitLabAccessLevel(params.memberAccessLevel) + ? params.memberAccessLevel + : toolCallArg(context, params.accessLevel) + if (!resourceId || !params.userId || !hasGitLabAccessLevel(level)) { throw new Error('Project / Group ID, User ID, and Access Level are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), + resourceId, userId: Number(params.userId), - accessLevel: coerceGitLabAccessLevel(params.memberAccessLevel), - expiresAt: params.clearExpiresAt ? '' : params.expiresAt?.trim() || undefined, + accessLevel: coerceGitLabAccessLevel(level), + expiresAt: params.clearExpiresAt + ? '' + : (optionalText(params.expiresAt) ?? toolCallClear(params.expiresAt, context)), memberRoleId: params.memberRoleId ? Number(params.memberRoleId) : undefined, } + } case 'gitlab_remove_member': - if (!params.resourceId?.trim() || !params.userId) { + if (!resourceId || !params.userId) { throw new Error('Project / Group ID and User ID are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), + resourceId, userId: Number(params.userId), skipSubresources: params.skipSubresources || undefined, unassignIssuables: params.unassignIssuables || undefined, } - case 'gitlab_invite_member': - if ( - !params.resourceId?.trim() || - !params.email?.trim() || - !hasGitLabAccessLevel(params.accessLevel) - ) { + case 'gitlab_invite_member': { + const email = inputText(params.email) + if (!resourceId || !email || !hasGitLabAccessLevel(params.accessLevel)) { throw new Error('Project / Group ID, Email, and Access Level are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - email: params.email.trim(), + resourceId, + email, accessLevel: coerceGitLabAccessLevel(params.accessLevel), - expiresAt: params.expiresAt?.trim() || undefined, + expiresAt: optionalText(params.expiresAt), memberRoleId: params.memberRoleId ? Number(params.memberRoleId) : undefined, - inviteSource: params.inviteSource?.trim() || undefined, + inviteSource: optionalText(params.inviteSource), } + } case 'gitlab_list_invitations': - if (!params.resourceId?.trim()) { + if (!resourceId) { throw new Error('Project / Group ID is required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - query: params.query?.trim() || undefined, - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + resourceId, + query: optionalText(params.query), + ...pagination, } - case 'gitlab_update_invitation': - if (!params.resourceId?.trim() || !params.email?.trim()) { + case 'gitlab_update_invitation': { + const email = inputText(params.email) + if (!resourceId || !email) { throw new Error('Project / Group ID and Email are required.') } + const level = hasGitLabAccessLevel(params.invitationAccessLevel) + ? params.invitationAccessLevel + : toolCallArg(context, params.accessLevel) if ( - !hasGitLabAccessLevel(params.invitationAccessLevel) && - !params.expiresAt?.trim() && + !hasGitLabAccessLevel(level) && + !inputText(params.expiresAt) && + toolCallClear(params.expiresAt, context) === undefined && !params.clearExpiresAt ) { throw new Error( @@ -2826,47 +3001,49 @@ Return ONLY the JSON array - no explanations, no extra text.`, return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - email: params.email.trim(), + resourceId, + email, // Only send access_level when a level is chosen; "Leave unchanged" // ('') keeps the invitation's current level instead of resetting it. - accessLevel: hasGitLabAccessLevel(params.invitationAccessLevel) - ? coerceGitLabAccessLevel(params.invitationAccessLevel) - : undefined, - expiresAt: params.clearExpiresAt ? '' : params.expiresAt?.trim() || undefined, + accessLevel: hasGitLabAccessLevel(level) ? coerceGitLabAccessLevel(level) : undefined, + expiresAt: params.clearExpiresAt + ? '' + : (optionalText(params.expiresAt) ?? toolCallClear(params.expiresAt, context)), } + } - case 'gitlab_revoke_invitation': - if (!params.resourceId?.trim() || !params.email?.trim()) { + case 'gitlab_revoke_invitation': { + const email = inputText(params.email) + if (!resourceId || !email) { throw new Error('Project / Group ID and Email are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - email: params.email.trim(), + resourceId, + email, } + } case 'gitlab_list_access_requests': - if (!params.resourceId?.trim()) { + if (!resourceId) { throw new Error('Project / Group ID is required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + resourceId, + ...pagination, } case 'gitlab_approve_access_request': - if (!params.resourceId?.trim() || !params.userId) { + if (!resourceId || !params.userId) { throw new Error('Project / Group ID and User ID are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), + resourceId, userId: Number(params.userId), accessLevel: hasGitLabAccessLevel(params.accessLevel) ? coerceGitLabAccessLevel(params.accessLevel) @@ -2874,92 +3051,101 @@ Return ONLY the JSON array - no explanations, no extra text.`, } case 'gitlab_deny_access_request': - if (!params.resourceId?.trim() || !params.userId) { + if (!resourceId || !params.userId) { throw new Error('Project / Group ID and User ID are required.') } return { ...baseParams, resourceType: params.resourceType || 'project', - resourceId: params.resourceId.trim(), + resourceId, userId: Number(params.userId), } case 'gitlab_list_saml_group_links': - if (!params.groupId?.trim()) { + if (!groupId) { throw new Error('Group ID is required.') } return { ...baseParams, - groupId: params.groupId.trim(), + groupId, } - case 'gitlab_add_saml_group_link': - if ( - !params.groupId?.trim() || - !params.samlGroupName?.trim() || - !hasGitLabAccessLevel(params.accessLevel) - ) { + case 'gitlab_add_saml_group_link': { + const samlGroupName = inputText(params.samlGroupName) + if (!groupId || !samlGroupName || !hasGitLabAccessLevel(params.accessLevel)) { throw new Error('Group ID, SAML Group Name, and Access Level are required.') } return { ...baseParams, - groupId: params.groupId.trim(), - samlGroupName: params.samlGroupName.trim(), + groupId, + samlGroupName, accessLevel: coerceGitLabAccessLevel(params.accessLevel), memberRoleId: params.memberRoleId ? Number(params.memberRoleId) : undefined, - provider: params.samlProvider?.trim() || undefined, + provider: + optionalText(params.samlProvider) || + optionalText(toolCallArg(context, params.provider)), } + } - case 'gitlab_delete_saml_group_link': - if (!params.groupId?.trim() || !params.samlGroupName?.trim()) { + case 'gitlab_delete_saml_group_link': { + const samlGroupName = inputText(params.samlGroupName) + if (!groupId || !samlGroupName) { throw new Error('Group ID and SAML Group Name are required.') } return { ...baseParams, - groupId: params.groupId.trim(), - samlGroupName: params.samlGroupName.trim(), - provider: params.samlProvider?.trim() || undefined, + groupId, + samlGroupName, + provider: + optionalText(params.samlProvider) || + optionalText(toolCallArg(context, params.provider)), } + } - case 'gitlab_search_users': - if (!params.userSearch?.trim()) { + case 'gitlab_search_users': { + const search = + inputText(params.userSearch) || inputText(toolCallArg(context, params.search)) + if (!search) { throw new Error('Search query is required.') } return { ...baseParams, - search: params.userSearch.trim(), - perPage: params.perPage ? Number(params.perPage) : undefined, - page: params.page ? Number(params.page) : undefined, + search, + ...pagination, } + } - case 'gitlab_create_user': - if ( - !params.userAdminEmail?.trim() || - !params.userAdminUsername?.trim() || - !params.userAdminName?.trim() - ) { + case 'gitlab_create_user': { + const email = + inputText(params.userAdminEmail) || inputText(toolCallArg(context, params.email)) + const username = + inputText(params.userAdminUsername) || + inputText(toolCallArg(context, params.username)) + const name = + inputText(params.userAdminName) || inputText(toolCallArg(context, params.name)) + const password = + inputText(params.userAdminPassword) || + inputText(toolCallArg(context, params.password)) + if (!email || !username || !name) { throw new Error('Email, Username, and Full Name are required.') } - if ( - !params.userAdminPassword?.trim() && - !params.resetPassword && - !params.forceRandomPassword - ) { + if (!password && !params.resetPassword && !params.forceRandomPassword) { throw new Error( 'One of Password, Send Password Reset Link, or Force Random Password is required.' ) } return { ...baseParams, - email: params.userAdminEmail.trim(), - username: params.userAdminUsername.trim(), - name: params.userAdminName.trim(), - password: params.userAdminPassword?.trim() || undefined, + email, + username, + name, + password: password || undefined, resetPassword: params.resetPassword || undefined, forceRandomPassword: params.forceRandomPassword || undefined, - admin: params.userAdminIsAdmin || undefined, + admin: params.userAdminIsAdmin || toolCallArg(context, params.admin) || undefined, skipConfirmation: params.skipConfirmation || undefined, } + } case 'gitlab_update_user': if (!params.userId) { @@ -2968,14 +3154,25 @@ Return ONLY the JSON array - no explanations, no extra text.`, return { ...baseParams, userId: Number(params.userId), - email: params.userAdminEmail?.trim() || undefined, - username: params.userAdminUsername?.trim() || undefined, - name: params.userAdminName?.trim() || undefined, + email: + optionalText(params.userAdminEmail) || + optionalText(toolCallArg(context, params.email)), + username: + optionalText(params.userAdminUsername) || + optionalText(toolCallArg(context, params.username)), + name: + optionalText(params.userAdminName) || + optionalText(toolCallArg(context, params.name)), // Only pass a real boolean: an explicit `false` demotes the user, // while an untouched switch serializes as `null` and must be // dropped so an unrelated update never touches the admin flag. admin: - typeof params.userAdminIsAdmin === 'boolean' ? params.userAdminIsAdmin : undefined, + typeof params.userAdminIsAdmin === 'boolean' + ? params.userAdminIsAdmin + : toolCallArg( + context, + typeof params.admin === 'boolean' ? params.admin : undefined + ), } case 'gitlab_delete_user': @@ -3004,15 +3201,17 @@ Return ONLY the JSON array - no explanations, no extra text.`, userId: Number(params.userId), } - case 'gitlab_delete_user_identity': - if (!params.userId || !params.provider?.trim()) { + case 'gitlab_delete_user_identity': { + const provider = inputText(params.provider) + if (!params.userId || !provider) { throw new Error('User ID and Identity Provider are required.') } return { ...baseParams, userId: Number(params.userId), - provider: params.provider.trim(), + provider, } + } default: return baseParams @@ -3029,6 +3228,18 @@ Return ONLY the JSON array - no explanations, no extra text.`, mergeRequestIid: { type: 'number', description: 'Merge request internal ID' }, pipelineId: { type: 'number', description: 'Pipeline ID' }, title: { type: 'string', description: 'Title for issue or merge request' }, + updateTitle: { + type: 'string', + description: 'New title when updating an issue or merge request', + }, + dueDate: { type: 'string', description: 'Issue due date (YYYY-MM-DD)' }, + confidential: { type: 'boolean', description: 'Create the issue as confidential' }, + draft: { type: 'boolean', description: 'Create the merge request as a draft' }, + mergeWhenPipelineSucceeds: { + type: 'boolean', + description: 'Auto-merge the merge request once its checks pass', + }, + squashCommitMessage: { type: 'string', description: 'Custom squash commit message' }, description: { type: 'string', description: 'Description (Markdown supported)' }, body: { type: 'string', description: 'Comment body' }, sourceBranch: { type: 'string', description: 'Source branch for merge request' }, @@ -3115,6 +3326,7 @@ Return ONLY the JSON array - no explanations, no extra text.`, scope: { type: 'string', description: 'Job scope filter' }, includeRetried: { type: 'boolean', description: 'Include retried jobs in the listing' }, sha: { type: 'string', description: 'Commit SHA' }, + mergeSha: { type: 'string', description: 'Source branch HEAD SHA required to merge' }, compareFrom: { type: 'string', description: 'Branch, tag, or commit SHA to compare from' }, compareTo: { type: 'string', description: 'Branch, tag, or commit SHA to compare to' }, straight: { type: 'boolean', description: 'Compare directly instead of using the merge base' }, diff --git a/apps/sim/blocks/blocks/incidentio.test.ts b/apps/sim/blocks/blocks/incidentio.test.ts new file mode 100644 index 00000000000..df618b729da --- /dev/null +++ b/apps/sim/blocks/blocks/incidentio.test.ts @@ -0,0 +1,108 @@ +import { describe, expect, it } from 'vitest' +import { IncidentioBlock } from '@/blocks/blocks/incidentio' + +/** + * On a tool call (Agent tool row, Pi, Human-in-the-loop v2) the mapper receives the stored row's + * params merged with the model's args, without `operation`; the operation arrives only in + * `context`. The executor spreads the mapper output over those merged params. + */ +function runToolCall(operation: string, merged: Record) { + const mapper = IncidentioBlock.tools.config?.params + if (!mapper) throw new Error('incidentio block has no params mapper') + return { ...merged, ...mapper(merged, { operation }) } +} + +describe('incidentio mapper on tool calls', () => { + it('applies block-only fields stored on the tool row', () => { + expect(runToolCall('incidentio_users_list', { apiKey: 'k', user_email: 'a@b.com' }).email).toBe( + 'a@b.com' + ) + const alert = runToolCall('incidentio_alert_events_create', { + alert_title: 'Checkout latency', + alert_status: 'firing', + }) + expect(alert.title).toBe('Checkout latency') + expect(alert.status).toBe('firing') + }) + + it("keeps the model's status over the seeded status dropdown", () => { + const resolved = runToolCall('incidentio_actions_update', { + id: 'act_1', + description: 'Fail over', + item_status: 'outstanding', + status: 'completed', + }) + expect(resolved.status).toBe('completed') + }) + + it('uses the status dropdown on the canvas', () => { + const mapper = IncidentioBlock.tools.config?.params + if (!mapper) throw new Error('incidentio block has no params mapper') + const canvas = mapper({ + operation: 'incidentio_follow_ups_update', + item_status: 'not_doing', + follow_up_title: 'Add alerting', + }) + expect(canvas.status).toBe('not_doing') + expect(canvas.title).toBe('Add alerting') + }) + + it("doesn't filter a tool-call alert list by the tool row's seeded status", () => { + const listed = runToolCall('incidentio_alerts_list', { apiKey: 'k', alert_status: 'firing' }) + expect(listed.status).toBeUndefined() + const mapper = IncidentioBlock.tools.config?.params + if (!mapper) throw new Error('incidentio block has no params mapper') + expect(mapper({ alert_status: 'firing' }, { operation: 'incidentio_alerts_list' }).status).toBe( + undefined + ) + expect( + runToolCall('incidentio_alerts_list', { alert_status: 'firing', status: 'resolved' }).status + ).toBe('resolved') + }) + + it("leaves a workflow created without a state to the tool's draft default", () => { + expect(runToolCall('incidentio_workflows_create', { name: 'Notify' }).state).toBeUndefined() + expect( + runToolCall('incidentio_workflows_create', { name: 'Notify', state: 'active' }).state + ).toBe('active') + }) +}) + +describe('incidentio mapper on a block newly added in the editor', () => { + /** The editor seeds dropdowns with `value({})`, so create operations start on the '' option. */ + const runCanvas = (params: Record) => { + const mapper = IncidentioBlock.tools.config?.params + if (!mapper) throw new Error('incidentio block has no params mapper') + return { ...params, ...mapper(params) } + } + + it('creates a firing alert event', () => { + const alert = runCanvas({ + operation: 'incidentio_alert_events_create', + alert_status: '', + alert_title: 'Disk full', + }) + expect(alert.status).toBe('firing') + }) + + it('creates a schedule in UTC', () => { + expect(runCanvas({ operation: 'incidentio_schedules_create', timezone: '' }).timezone).toBe( + 'UTC' + ) + expect( + runCanvas({ operation: 'incidentio_schedules_create', timezone: 'Europe/London' }).timezone + ).toBe('Europe/London') + }) + + it('creates an active workflow', () => { + expect(runCanvas({ operation: 'incidentio_workflows_create', state: '' }).state).toBe('active') + expect(runCanvas({ operation: 'incidentio_workflows_create', state: 'draft' }).state).toBe( + 'draft' + ) + }) + + it("leaves an update's 'No change' options unset", () => { + expect(runCanvas({ operation: 'incidentio_schedules_update', timezone: '' }).timezone).toBe('') + expect(runCanvas({ operation: 'incidentio_workflows_update', state: '' }).state).toBe('') + }) +}) diff --git a/apps/sim/blocks/blocks/incidentio.ts b/apps/sim/blocks/blocks/incidentio.ts index d7f18519767..1d3fc6b5131 100644 --- a/apps/sim/blocks/blocks/incidentio.ts +++ b/apps/sim/blocks/blocks/incidentio.ts @@ -1,7 +1,7 @@ import { IncidentioIcon } from '@/components/icons' import type { BlockConfig, BlockMeta } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' -import { withSavedCredential } from '@/blocks/utils' +import { isToolCall, mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils' import { getTrigger } from '@/triggers' /** Identifiers a user can be looked up by, whichever one is filled. */ @@ -319,6 +319,8 @@ export const IncidentioBlock: BlockConfig = { 'incidentio_incident_alerts_list', 'incidentio_catalog_entries_list', 'incidentio_teams_list', + 'incidentio_actions_list', + 'incidentio_follow_ups_list', ], }, mode: 'advanced', @@ -343,6 +345,8 @@ export const IncidentioBlock: BlockConfig = { 'incidentio_incident_alerts_list', 'incidentio_catalog_entries_list', 'incidentio_teams_list', + 'incidentio_actions_list', + 'incidentio_follow_ups_list', ], }, mode: 'advanced', @@ -401,17 +405,13 @@ Return ONLY the summary text - no explanations.`, field: 'operation', value: ['incidentio_incidents_create', 'incidentio_incidents_update'], }, - required: { field: 'operation', value: 'incidentio_incidents_create' }, }, { id: 'incident_type_id', title: 'Incident Type ID', type: 'short-input', placeholder: 'Enter incident type ID...', - condition: { - field: 'operation', - value: ['incidentio_incidents_create', 'incidentio_incidents_update'], - }, + condition: { field: 'operation', value: 'incidentio_incidents_create' }, }, { id: 'incident_status_id', @@ -578,6 +578,21 @@ Return ONLY the title - no explanations.`, placeholder: 'Enter user IDs, comma-separated (required if no path ID)...', condition: { field: 'operation', value: 'incidentio_escalations_create' }, }, + { + id: 'escalation_description', + title: 'Description', + type: 'long-input', + placeholder: 'Additional details included with the page...', + condition: { field: 'operation', value: 'incidentio_escalations_create' }, + }, + { + id: 'escalation_incident_id', + title: 'Incident ID', + type: 'short-input', + placeholder: 'Link the escalation to an incident (optional)...', + condition: { field: 'operation', value: 'incidentio_escalations_create' }, + mode: 'advanced', + }, { id: 'incident_id', title: 'Incident ID', @@ -613,6 +628,7 @@ Return ONLY the title - no explanations.`, title: 'Incident Mode', type: 'dropdown', options: [ + { label: 'Standard and Retrospective', id: '' }, { label: 'Standard', id: 'standard' }, { label: 'Retrospective', id: 'retrospective' }, { label: 'Test', id: 'test' }, @@ -648,11 +664,18 @@ Return ONLY the title - no explanations.`, title: 'State', type: 'dropdown', options: [ + { label: 'No change', id: '' }, { label: 'Active', id: 'active' }, { label: 'Draft', id: 'draft' }, { label: 'Disabled', id: 'disabled' }, ], - value: () => 'active', + value: (params) => + params?.operation === 'incidentio_workflows_create' + ? 'active' + : params?.operation === 'incidentio_workflows_update' + ? '' + : undefined, + dependsOn: ['operation'], condition: { field: 'operation', value: ['incidentio_workflows_create', 'incidentio_workflows_update'], @@ -823,6 +846,7 @@ Return ONLY the title - no explanations.`, title: 'Timezone', type: 'dropdown', options: [ + { label: 'No change', id: '' }, { label: 'America/New_York (Eastern)', id: 'America/New_York' }, { label: 'America/Chicago (Central)', id: 'America/Chicago' }, { label: 'America/Denver (Mountain)', id: 'America/Denver' }, @@ -847,12 +871,17 @@ Return ONLY the title - no explanations.`, { label: 'Pacific/Auckland (New Zealand)', id: 'Pacific/Auckland' }, { label: 'UTC', id: 'UTC' }, ], - value: () => 'UTC', + value: (params) => + params?.operation === 'incidentio_schedules_create' + ? 'UTC' + : params?.operation === 'incidentio_schedules_update' + ? '' + : undefined, + dependsOn: ['operation'], condition: { field: 'operation', value: ['incidentio_schedules_create', 'incidentio_schedules_update'], }, - required: { field: 'operation', value: 'incidentio_schedules_create' }, }, { id: 'config', @@ -872,7 +901,7 @@ The configuration must follow this structure: "name": "Rotation Name", "users": [{"id": "user_id"}], "handover_start_at": "ISO8601 timestamp", - "handovers": [{"interval": number, "interval_type": "daily|weekly|monthly"}] + "handovers": [{"interval": number, "interval_type": "hourly|daily|weekly"}] } ] } @@ -1132,7 +1161,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, title: 'Path Configuration', type: 'long-input', placeholder: - 'JSON array of escalation levels: [{"targets": [{"id": "...", "type": "...", "urgency": "..."}], "time_to_ack_seconds": 300}]', + 'JSON array of nodes: [{"id": "lvl1", "type": "level", "level": {"targets": [{"id": "", "type": "schedule", "schedule_mode": "currently_on_call", "urgency": "high"}], "time_to_ack_seconds": 300}}]', condition: { field: 'operation', value: ['incidentio_escalation_paths_create', 'incidentio_escalation_paths_update'], @@ -1140,16 +1169,22 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, required: true, wandConfig: { enabled: true, - prompt: `Generate a JSON array for escalation path configuration based on the user's description. -The array must follow this structure: + prompt: `Generate a JSON array of incident.io escalation path nodes based on the user's description. +Each node needs a unique "id" and a "type". A "level" node pages its targets and waits for an acknowledgment: [ { - "targets": [{"id": "target_id", "type": "user|schedule", "urgency": "high|low"}], - "time_to_ack_seconds": number + "id": "lvl1", + "type": "level", + "level": { + "targets": [ + {"id": "schedule_or_user_id", "type": "schedule|user", "schedule_mode": "currently_on_call", "urgency": "high|low"} + ], + "time_to_ack_seconds": number + } } ] -Each level represents an escalation step with acknowledgment timeout. +Use one level node per escalation step, in order. Only set "schedule_mode" on schedule targets. Return ONLY the JSON array - no explanations or markdown formatting.`, placeholder: @@ -1162,7 +1197,7 @@ Return ONLY the JSON array - no explanations or markdown formatting.`, title: 'Working Hours', type: 'long-input', placeholder: - 'Optional JSON array: [{"weekday": "monday", "start_time": "09:00", "end_time": "17:00"}]', + 'Optional JSON array: [{"id": "wh", "name": "Business hours", "timezone": "Europe/London", "weekday_intervals": [{"weekday": "monday", "start_time": "09:00", "end_time": "17:00"}]}]', condition: { field: 'operation', value: ['incidentio_escalation_paths_create', 'incidentio_escalation_paths_update'], @@ -1172,7 +1207,14 @@ Return ONLY the JSON array - no explanations or markdown formatting.`, prompt: `Generate a JSON array for working hours configuration based on the user's description. The array must follow this structure: [ - {"weekday": "monday|tuesday|wednesday|thursday|friday|saturday|sunday", "start_time": "HH:MM", "end_time": "HH:MM"} + { + "id": "unique_id", + "name": "Business hours", + "timezone": "IANA timezone, e.g. Europe/London", + "weekday_intervals": [ + {"weekday": "monday|tuesday|wednesday|thursday|friday|saturday|sunday", "start_time": "HH:MM", "end_time": "HH:MM"} + ] + } ] Return ONLY the JSON array - no explanations or markdown formatting.`, @@ -1185,14 +1227,16 @@ Return ONLY the JSON array - no explanations or markdown formatting.`, title: 'Alert Status', type: 'dropdown', options: [ + { label: 'Any', id: '' }, { label: 'Firing', id: 'firing' }, { label: 'Resolved', id: 'resolved' }, ], + value: (params) => (params?.operation === 'incidentio_alert_events_create' ? 'firing' : ''), + dependsOn: ['operation'], condition: { field: 'operation', value: ['incidentio_alerts_list', 'incidentio_alert_events_create'], }, - required: { field: 'operation', value: 'incidentio_alert_events_create' }, }, { id: 'status_operator', @@ -1740,7 +1784,8 @@ Return ONLY the description - no explanations.`, return 'incidentio_incidents_list' } }, - params: (params) => { + params: (params, context) => { + const operation = mapperOperation(params, context) const result: Record = {} const toBoolean = (value: unknown) => value === true || value === 'true' if (params.page_size) result.page_size = Number(params.page_size) @@ -1756,38 +1801,57 @@ Return ONLY the description - no explanations.`, if (params.skip_step_upgrades !== undefined) { result.skip_step_upgrades = toBoolean(params.skip_step_upgrades) } - if (params.operation === 'incidentio_users_list') { + // Status dropdowns are always seeded, so on a tool call the model's `status` must win. + const pickStatus = (dropdownValue: unknown) => { + const status = toolCallArg(context, params.status) || dropdownValue + if (status) result.status = status + } + if (operation === 'incidentio_users_list') { if (params.user_email) result.email = params.user_email if (params.user_slack_id) result.slack_user_id = params.user_slack_id } - if (params.operation === 'incidentio_alerts_list') { - if (params.alert_status) result.status = params.alert_status + if (operation === 'incidentio_alerts_list') { + // A tool row can't show this dropdown, so its stored value is only the seeded default. + pickStatus(isToolCall(context) ? undefined : params.alert_status) result.has_notes = toTriState(params.has_notes) result.include_maintenance_window = toTriState(params.include_maintenance_window) } - if (params.operation === 'incidentio_alert_events_create') { - if (params.alert_status) result.status = params.alert_status + // The editor seeds these dropdowns without an operation, so a new create block holds ''. + if (operation === 'incidentio_alert_events_create') { + pickStatus(params.alert_status || 'firing') if (params.alert_title) result.title = params.alert_title if (params.alert_description) result.description = params.alert_description } + if (operation === 'incidentio_schedules_create' && !params.timezone) { + result.timezone = 'UTC' + } + // On a tool call a missing state keeps the tool's 'draft' default, so an agent never + // creates a live workflow by omission. + if (operation === 'incidentio_workflows_create' && !params.state && !isToolCall(context)) { + result.state = 'active' + } + if (operation === 'incidentio_escalations_create') { + if (params.escalation_description) result.description = params.escalation_description + if (params.escalation_incident_id) result.incident_id = params.escalation_incident_id + } if ( - params.operation === 'incidentio_follow_ups_create' || - params.operation === 'incidentio_follow_ups_update' + operation === 'incidentio_follow_ups_create' || + operation === 'incidentio_follow_ups_update' ) { if (params.follow_up_title) result.title = params.follow_up_title if (params.follow_up_description) result.description = params.follow_up_description } if ( - params.operation === 'incidentio_actions_create' || - params.operation === 'incidentio_actions_update' + operation === 'incidentio_actions_create' || + operation === 'incidentio_actions_update' ) { if (params.action_description) result.description = params.action_description } if ( - params.operation === 'incidentio_follow_ups_update' || - params.operation === 'incidentio_actions_update' + operation === 'incidentio_follow_ups_update' || + operation === 'incidentio_actions_update' ) { - if (params.item_status) result.status = params.item_status + pickStatus(params.item_status) } return result }, @@ -1890,6 +1954,8 @@ Return ONLY the description - no explanations.`, follow_up_priority_option_id: { type: 'string', description: 'Follow-up priority option ID' }, external_issue_reference_id: { type: 'string', description: 'External issue reference ID' }, labels: { type: 'string', description: 'Comma-separated follow-up labels' }, + escalation_description: { type: 'string', description: 'Escalation description' }, + escalation_incident_id: { type: 'string', description: 'Incident to link an escalation to' }, }, outputs: { incidents: { type: 'json', description: 'List of incidents' }, diff --git a/apps/sim/blocks/blocks/linear.test.ts b/apps/sim/blocks/blocks/linear.test.ts new file mode 100644 index 00000000000..69358e9834f --- /dev/null +++ b/apps/sim/blocks/blocks/linear.test.ts @@ -0,0 +1,138 @@ +import { describe, expect, it } from 'vitest' +import { LinearV2Block } from '@/blocks/blocks/linear' +import type { BlockToolParamsContext } from '@/blocks/types' + +function mapParams(params: Record, context?: BlockToolParamsContext) { + const mapper = LinearV2Block.tools.config?.params + if (!mapper) throw new Error('Linear block has no params mapper') + return mapper(params, context) +} + +/** What the tool receives: the mapper's result spread over the params it was given. */ +function sent(params: Record, context?: BlockToolParamsContext) { + return { ...params, ...mapParams(params, context) } +} + +describe('Linear agent tool calls', () => { + it('uses the Customer ID filled in the tool row', () => { + const toolParams = sent({ customerIdTarget: 'cust-1' }, { operation: 'linear_get_customer' }) + expect(toolParams.customerId).toBe('cust-1') + }) + + it('keeps the model customer fields when no block field is filled', () => { + const toolParams = sent( + { name: 'Acme', domains: ['acme.com'], revenue: 5000, size: 40 }, + { operation: 'linear_create_customer' } + ) + expect(toolParams).toMatchObject({ + name: 'Acme', + domains: ['acme.com'], + revenue: 5000, + size: 40, + }) + }) + + it('keeps the model project and label ids for Add Label to Project', () => { + const toolParams = sent( + { projectId: 'proj-1', labelId: 'plabel-1' }, + { operation: 'linear_add_label_to_project' } + ) + expect(toolParams).toMatchObject({ projectId: 'proj-1', labelId: 'plabel-1' }) + }) + + it('keeps the model attachment title on Update Attachment', () => { + const toolParams = sent( + { attachmentId: 'att-1', title: 'Spec' }, + { operation: 'linear_update_attachment' } + ) + expect(toolParams.title).toBe('Spec') + }) + + it('keeps a model priority of 0 on Update Issue', () => { + const toolParams = sent({ issueId: 'ENG-1', priority: 0 }, { operation: 'linear_update_issue' }) + expect(toolParams.priority).toBe(0) + }) + + it('keeps the model readAt when the tool row leaves Mark as Read unset', () => { + const readAt = '2026-11-01T00:00:00.000Z' + const toolParams = sent( + { notificationId: 'n1', readAt }, + { operation: 'linear_update_notification' } + ) + expect(toolParams.readAt).toBe(readAt) + }) + + it('keeps the model includeArchived on List Customers', () => { + const toolParams = sent({ includeArchived: true }, { operation: 'linear_list_customers' }) + expect(toolParams.includeArchived).toBe(true) + }) +}) + +describe('Linear canvas requests', () => { + it('sends Blocked by as the related issue blocking this one', () => { + const inputs = { + operation: 'linear_create_issue_relation', + issueId: 'ENG-1', + relatedIssueId: 'ENG-2', + relationType: 'blocked', + } + expect(sent(inputs)).toMatchObject({ + issueId: 'ENG-2', + relatedIssueId: 'ENG-1', + type: 'blocks', + }) + }) + + it('sends the customer details filled on Create Customer', () => { + const inputs = { + operation: 'linear_create_customer', + customerName: 'Acme', + customerExternalIds: 'crm-1, crm-2', + customerOwnerId: ' user-1 ', + customerRevenue: '100000', + customerSize: '25', + customerLogoUrl: 'https://acme.test/logo.png', + } + expect(sent(inputs)).toMatchObject({ + name: 'Acme', + externalIds: ['crm-1', 'crm-2'], + ownerId: 'user-1', + revenue: 100000, + size: 25, + logoUrl: 'https://acme.test/logo.png', + }) + }) + + it('leaves the urgency unchanged when Update Customer Request picks No change', () => { + const inputs = { + operation: 'linear_update_customer_request', + customerNeedId: 'need-1', + customerRequestPriority: '', + } + expect(sent(inputs).priority).toBeUndefined() + }) + + it('sends Label IDs typed as a comma-separated list as an array', () => { + const inputs = { operation: 'linear_read_issues', labelIds: 'lbl-1, lbl-2' } + expect(sent(inputs).labelIds).toEqual(['lbl-1', 'lbl-2']) + }) + + it('moves an updated project to the chosen project status', () => { + const inputs = { + operation: 'linear_update_project', + projectId: 'proj-1', + projectUpdateStatusId: ' status-1 ', + } + expect(sent(inputs).statusId).toBe('status-1') + }) + + it('does not move an updated project to a Status ID left over from a project status operation', () => { + const inputs = { + operation: 'linear_update_project', + projectId: 'proj-1', + name: 'Renamed', + projectStatusId: 'ps-old', + } + expect(sent(inputs).statusId).toBeUndefined() + }) +}) diff --git a/apps/sim/blocks/blocks/linear.ts b/apps/sim/blocks/blocks/linear.ts index f4ba420bb27..13bbc3cfa0f 100644 --- a/apps/sim/blocks/blocks/linear.ts +++ b/apps/sim/blocks/blocks/linear.ts @@ -2,7 +2,13 @@ import { DevinIcon, LinearIcon } from '@/components/icons' import { getScopesForService } from '@/lib/oauth/utils' import type { BlockConfig, BlockMeta } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' -import { normalizeFileInput } from '@/blocks/utils' +import { + isToolCall, + mapperOperation, + normalizeFileInput, + parseOptionalBooleanInput, + toolCallArg, +} from '@/blocks/utils' import { getTrigger } from '@/triggers' /** @@ -13,6 +19,46 @@ import { getTrigger } from '@/triggers' const TEAM_FIELD = ['teamId', 'manualTeamId'] as const const PROJECT_FIELD = ['projectId', 'manualProjectId'] as const +/** True for a value a block field holds when nobody filled it. */ +function isBlank(value: unknown): boolean { + return value === undefined || value === null || (typeof value === 'string' && !value.trim()) +} + +/** A trimmed string from a block string or a model number; blank is `undefined`. */ +function trimmedText(value: unknown): string | undefined { + if (typeof value === 'string') return value.trim() || undefined + if (typeof value === 'number' && Number.isFinite(value)) return String(value) + return undefined +} + +/** A number from a block string or a model number; blank is `undefined`, so `0` survives. */ +function optionalNumber(value: unknown): number | undefined { + if (typeof value === 'number') return Number.isFinite(value) ? value : undefined + if (typeof value === 'string' && value.trim()) return Number(value) + return undefined +} + +/** Trimmed ids from a model array, a JSON array string, or a comma-separated block string. */ +function idList(value: unknown): string[] | undefined { + let items: unknown[] + if (Array.isArray(value)) { + items = value + } else if (typeof value === 'string' && value.trim()) { + const text = value.trim() + items = text.split(',') + if (text.startsWith('[')) { + try { + const parsed: unknown = JSON.parse(text) + if (Array.isArray(parsed)) items = parsed + } catch {} + } + } else { + return undefined + } + const ids = items.map(trimmedText).filter((id): id is string => id !== undefined) + return ids.length > 0 ? ids : undefined +} + export const LinearBlock: BlockConfig = { type: 'linear', name: 'Linear (Legacy)', @@ -318,7 +364,7 @@ export const LinearBlock: BlockConfig = { { text: 'Update project status', field: 'projectStatusId', core: true }, ], linear_delete_project_status: [ - { text: 'Delete project status', field: 'projectStatusId', core: true }, + { text: 'Archive project status', field: 'projectStatusId', core: true }, ], linear_list_project_statuses: [ 'List project statuses', @@ -364,7 +410,7 @@ export const LinearBlock: BlockConfig = { { label: 'Update Workflow State', id: 'linear_update_workflow_state' }, { label: 'List Cycles', id: 'linear_list_cycles' }, { label: 'Get Cycle', id: 'linear_get_cycle' }, - { label: 'Create Cycle', id: 'linear_create_cycle' }, + { label: 'Create Cycle', id: 'linear_create_cycle', hidden: true }, { label: 'Get Active Cycle', id: 'linear_get_active_cycle' }, { label: 'Create Attachment', id: 'linear_create_attachment' }, { label: 'List Attachments', id: 'linear_list_attachments' }, @@ -409,7 +455,7 @@ export const LinearBlock: BlockConfig = { { label: 'List Project Milestones', id: 'linear_list_project_milestones' }, { label: 'Create Project Status', id: 'linear_create_project_status' }, { label: 'Update Project Status', id: 'linear_update_project_status' }, - { label: 'Delete Project Status', id: 'linear_delete_project_status' }, + { label: 'Archive Project Status', id: 'linear_delete_project_status' }, { label: 'List Project Statuses', id: 'linear_list_project_statuses' }, ], value: () => 'linear_read_issues', @@ -610,7 +656,7 @@ export const LinearBlock: BlockConfig = { title: 'Title', type: 'short-input', placeholder: 'Enter issue title', - required: true, + required: { field: 'operation', value: 'linear_create_issue' }, condition: { field: 'operation', value: ['linear_create_issue', 'linear_update_issue'], @@ -733,6 +779,7 @@ Return ONLY the comment text - no explanations.`, title: 'Color (hex)', type: 'short-input', placeholder: '#5E6AD2', + required: { field: 'operation', value: 'linear_create_workflow_state' }, condition: { field: 'operation', value: [ @@ -767,14 +814,20 @@ Return ONLY the comment text - no explanations.`, id: 'priority', title: 'Priority', type: 'dropdown', - options: [ + options: (params) => [ + { + label: params?.values.operation === 'linear_update_issue' ? 'No change' : 'Default', + id: '', + }, { label: 'No Priority', id: '0' }, { label: 'Urgent', id: '1' }, { label: 'High', id: '2' }, { label: 'Normal', id: '3' }, { label: 'Low', id: '4' }, ], - value: () => '0', + value: (params) => + params?.operation === 'linear_update_issue' ? '' : params?.operation ? '0' : undefined, + dependsOn: ['operation'], condition: { field: 'operation', value: ['linear_create_issue', 'linear_update_issue', 'linear_create_project'], @@ -819,7 +872,13 @@ Return ONLY the search query - no explanations.`, type: 'switch', condition: { field: 'operation', - value: ['linear_read_issues', 'linear_search_issues', 'linear_list_projects'], + value: [ + 'linear_read_issues', + 'linear_search_issues', + 'linear_list_projects', + 'linear_list_customers', + 'linear_list_customer_requests', + ], }, }, { @@ -1216,7 +1275,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n title: 'Customer Name', type: 'short-input', placeholder: 'Enter customer name', - required: true, + required: { field: 'operation', value: 'linear_create_customer' }, condition: { field: 'operation', value: ['linear_create_customer', 'linear_update_customer'], @@ -1330,11 +1389,22 @@ Return ONLY the description text - no explanations.`, id: 'customerRequestPriority', title: 'Urgency', type: 'dropdown', - options: [ + options: (params) => [ + { + label: + params?.values.operation === 'linear_update_customer_request' ? 'No change' : 'Default', + id: '', + }, { label: 'Not Important (0)', id: '0' }, { label: 'Important (1)', id: '1' }, ], - value: () => '0', + value: (params) => + params?.operation === 'linear_update_customer_request' + ? '' + : params?.operation + ? '0' + : undefined, + dependsOn: ['operation'], condition: { field: 'operation', value: ['linear_create_customer_request', 'linear_update_customer_request'], @@ -1345,6 +1415,7 @@ Return ONLY the description text - no explanations.`, title: 'Link to Issue', type: 'short-input', placeholder: 'Enter issue ID to link', + required: { field: 'operation', value: 'linear_create_customer_request' }, condition: { field: 'operation', value: ['linear_create_customer_request', 'linear_update_customer_request'], @@ -1399,7 +1470,14 @@ Return ONLY the description text - no explanations.`, title: 'Status Color', type: 'short-input', placeholder: 'Enter hex color (e.g., #FF0000)', - required: true, + required: { + field: 'operation', + value: [ + 'linear_create_customer_status', + 'linear_create_customer_tier', + 'linear_create_project_status', + ], + }, condition: { field: 'operation', value: [ @@ -1578,7 +1656,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n { label: 'Backlog', id: 'backlog' }, { label: 'Planned', id: 'planned' }, { label: 'Started', id: 'started' }, - { label: 'Paused', id: 'paused' }, + { label: 'Paused (deprecated)', id: 'paused', hidden: true }, { label: 'Completed', id: 'completed' }, { label: 'Canceled', id: 'canceled' }, ], @@ -1611,6 +1689,16 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n value: ['linear_update_project_status', 'linear_delete_project_status'], }, }, + { + id: 'projectUpdateStatusId', + title: 'Status ID', + type: 'short-input', + placeholder: 'Enter project status ID to move the project to', + condition: { + field: 'operation', + value: 'linear_update_project', + }, + }, { id: 'projectStatusIndefinite', title: 'Can Stay Indefinitely', @@ -1742,22 +1830,41 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n tool: (params) => { return params.operation || 'linear_read_issues' }, - params: (params) => { + params: (params, context) => { + const operation = mapperOperation(params, context) // Use canonical param IDs (raw subBlock IDs are deleted after serialization) const effectiveTeamId = params.teamId ? String(params.teamId).trim() : '' const effectiveProjectId = params.projectId ? String(params.projectId).trim() : '' + /** + * The block-only field when it is filled. On a tool call the model fills the tool's own + * param instead, so a blank block field falls back to it; the canvas keeps the field as is. + */ + const fieldOr = (blockValue: unknown, toolValue: unknown): unknown => + isBlank(blockValue) && isToolCall(context) ? toolValue : blockValue + const baseParams: Record = { oauthCredential: params.oauthCredential, } - switch (params.operation) { + const customerDetails = () => ({ + domains: idList(params.customerDomains) ?? toolCallArg(context, idList(params.domains)), + externalIds: + idList(params.customerExternalIds) ?? toolCallArg(context, idList(params.externalIds)), + logoUrl: trimmedText(fieldOr(params.customerLogoUrl, params.logoUrl)), + ownerId: trimmedText(fieldOr(params.customerOwnerId, params.ownerId)), + revenue: optionalNumber(fieldOr(params.customerRevenue, params.revenue)), + size: optionalNumber(fieldOr(params.customerSize, params.size)), + }) + + switch (operation) { case 'linear_read_issues': return { ...baseParams, teamId: effectiveTeamId || undefined, projectId: effectiveProjectId || undefined, includeArchived: params.includeArchived, + labelIds: idList(params.labelIds), first: params.first ? Number(params.first) : undefined, after: params.after?.trim() || undefined, } @@ -1786,8 +1893,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n description: params.description, stateId: params.stateId, assigneeId: params.assigneeId, - priority: params.priority ? Number(params.priority) : undefined, - estimate: params.estimate ? Number(params.estimate) : undefined, + priority: optionalNumber(params.priority), + estimate: optionalNumber(params.estimate), } case 'linear_update_issue': @@ -1801,8 +1908,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n description: params.description, stateId: params.stateId, assigneeId: params.assigneeId, - priority: params.priority ? Number(params.priority) : undefined, - estimate: params.estimate ? Number(params.estimate) : undefined, + priority: optionalNumber(params.priority), + estimate: optionalNumber(params.estimate), } case 'linear_archive_issue': @@ -1910,7 +2017,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n leadId: params.leadId, startDate: params.startDate, targetDate: params.targetDate, - priority: params.priority ? Number(params.priority) : undefined, + priority: optionalNumber(params.priority), } case 'linear_update_project': @@ -1922,7 +2029,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n projectId: effectiveProjectId, name: params.name, description: params.description, - state: params.projectState, + state: fieldOr(params.projectState, params.state), + statusId: trimmedText(fieldOr(params.projectUpdateStatusId, params.statusId)), leadId: params.leadId, targetDate: params.targetDate, } @@ -1994,17 +2102,19 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n after: params.after?.trim() || undefined, } - case 'linear_create_workflow_state': - if (!effectiveTeamId || !params.name?.trim() || !params.workflowType) { + case 'linear_create_workflow_state': { + const workflowType = fieldOr(params.workflowType, params.type) + if (!effectiveTeamId || !params.name?.trim() || !workflowType) { throw new Error('Team ID, name, and workflow type are required.') } return { ...baseParams, teamId: effectiveTeamId, name: params.name.trim(), - type: params.workflowType, + type: workflowType, color: params.color?.trim() || undefined, } + } case 'linear_update_workflow_state': if (!params.stateId?.trim()) { @@ -2034,17 +2144,20 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n cycleId: params.cycleId.trim(), } - case 'linear_create_cycle': - if (!effectiveTeamId || !params.startDate?.trim() || !params.endDate?.trim()) { + case 'linear_create_cycle': { + const startsAt = trimmedText(fieldOr(params.startDate, params.startsAt)) + const endsAt = trimmedText(fieldOr(params.endDate, params.endsAt)) + if (!effectiveTeamId || !startsAt || !endsAt) { throw new Error('Team ID, start date, and end date are required.') } return { ...baseParams, teamId: effectiveTeamId, name: params.name?.trim() || undefined, - startsAt: params.startDate.trim(), - endsAt: params.endDate.trim(), + startsAt, + endsAt, } + } case 'linear_get_active_cycle': if (!effectiveTeamId) { @@ -2067,7 +2180,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n const attachmentUrl = params.url?.trim() || (attachmentFile ? (attachmentFile as { url?: string }).url : undefined) - if (!attachmentUrl) { + // A tool call hands over a file reference the executor resolves to a URL later. + if (!attachmentUrl && !(isToolCall(context) && attachmentFile)) { throw new Error('URL or file is required.') } return { @@ -2075,7 +2189,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n issueId: params.issueId.trim(), url: attachmentUrl, file: attachmentFile, - title: params.attachmentTitle, + title: fieldOr(params.attachmentTitle, params.title), } } @@ -2097,7 +2211,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n return { ...baseParams, attachmentId: params.attachmentId.trim(), - title: params.attachmentTitle, + title: fieldOr(params.attachmentTitle, params.title), } case 'linear_delete_attachment': @@ -2109,16 +2223,29 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n attachmentId: params.attachmentId.trim(), } - case 'linear_create_issue_relation': - if (!params.issueId?.trim() || !params.relatedIssueId?.trim() || !params.relationType) { + case 'linear_create_issue_relation': { + const relationType = fieldOr(params.relationType, params.type) + if (!params.issueId?.trim() || !params.relatedIssueId?.trim() || !relationType) { throw new Error('Issue ID, related issue ID, and relation type are required.') } + const issueId = params.issueId.trim() + const relatedIssueId = params.relatedIssueId.trim() + // Linear has no "blocked by" type: A blocked by B is stored as B blocks A. + if (relationType === 'blocked') { + return { + ...baseParams, + issueId: relatedIssueId, + relatedIssueId: issueId, + type: 'blocks', + } + } return { ...baseParams, - issueId: params.issueId.trim(), - relatedIssueId: params.relatedIssueId.trim(), - type: params.relationType, + issueId, + relatedIssueId, + type: relationType, } + } case 'linear_list_issue_relations': if (!params.issueId?.trim()) { @@ -2142,6 +2269,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n case 'linear_create_favorite': if (!params.favoriteTargetId?.trim() || !params.favoriteType) { + // A tool call names the target with the tool's own issueId/projectId/cycleId/labelId. + if (isToolCall(context)) return baseParams throw new Error('Target ID and favorite type are required.') } return { @@ -2190,50 +2319,58 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n if (!params.notificationId?.trim()) { throw new Error('Notification ID is required.') } + // On a tool call with no Mark as Read setting, the model's readAt decides. + if (isToolCall(context) && isBlank(params.markAsRead)) { + return { + ...baseParams, + notificationId: params.notificationId.trim(), + } + } return { ...baseParams, notificationId: params.notificationId.trim(), readAt: params.markAsRead ? new Date().toISOString() : null, } - case 'linear_create_customer': - if (!params.customerName?.trim()) { + case 'linear_create_customer': { + const name = trimmedText(fieldOr(params.customerName, params.name)) + if (!name) { throw new Error('Customer name is required.') } return { ...baseParams, - name: params.customerName.trim(), - domains: params.customerDomains - ? params.customerDomains - .split(',') - .map((d: string) => d.trim()) - .filter(Boolean) - : undefined, + name, + ...customerDetails(), } + } case 'linear_list_customers': return { ...baseParams, first: params.first ? Number(params.first) : undefined, after: params.after?.trim() || undefined, - includeArchived: false, + includeArchived: params.includeArchived ?? false, } - case 'linear_create_customer_request': + case 'linear_create_customer_request': { + const issueId = trimmedText(fieldOr(params.linkedIssueId, params.issueId)) if (!params.customerId?.trim()) { throw new Error('Customer ID is required.') } + if (!issueId) { + throw new Error( + 'Link to Issue is required: Linear needs an issue for every customer request created through its API.' + ) + } return { ...baseParams, customerId: params.customerId.trim(), - body: params.requestBody?.trim(), + body: trimmedText(fieldOr(params.requestBody, params.body)), priority: - params.customerRequestPriority !== undefined - ? Number(params.customerRequestPriority) - : 0, - issueId: params.linkedIssueId?.trim(), - projectId: effectiveProjectId || undefined, + optionalNumber(fieldOr(params.customerRequestPriority, params.priority)) ?? 0, + issueId, } + } case 'linear_update_customer_request': if (!params.customerNeedId?.trim()) { @@ -2243,13 +2380,9 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n ...baseParams, customerNeedId: params.customerNeedId.trim(), customerId: params.customerId?.trim(), - body: params.requestBody?.trim(), - priority: - params.customerRequestPriority !== undefined - ? Number(params.customerRequestPriority) - : undefined, - issueId: params.linkedIssueId?.trim(), - projectId: effectiveProjectId || undefined, + body: trimmedText(fieldOr(params.requestBody, params.body)), + priority: optionalNumber(fieldOr(params.customerRequestPriority, params.priority)), + issueId: trimmedText(fieldOr(params.linkedIssueId, params.issueId)), } case 'linear_list_customer_requests': @@ -2257,48 +2390,35 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n ...baseParams, first: params.first ? Number(params.first) : undefined, after: params.after?.trim() || undefined, - includeArchived: false, + includeArchived: params.includeArchived ?? false, } case 'linear_get_customer': - if (!params.customerIdTarget?.trim()) { + case 'linear_delete_customer': { + const customerId = trimmedText(fieldOr(params.customerIdTarget, params.customerId)) + if (!customerId) { throw new Error('Customer ID is required.') } return { ...baseParams, - customerId: params.customerIdTarget.trim(), + customerId, } + } - case 'linear_update_customer': - if (!params.customerIdTarget?.trim()) { + case 'linear_update_customer': { + const customerId = trimmedText(fieldOr(params.customerIdTarget, params.customerId)) + if (!customerId) { throw new Error('Customer ID is required.') } return { ...baseParams, - customerId: params.customerIdTarget.trim(), - name: params.customerName?.trim() || undefined, - domains: params.customerDomains?.trim() - ? params.customerDomains.split(',').map((d: string) => d.trim()) - : undefined, - externalIds: params.customerExternalIds?.trim() - ? params.customerExternalIds.split(',').map((id: string) => id.trim()) - : undefined, - logoUrl: params.customerLogoUrl?.trim() || undefined, - ownerId: params.customerOwnerId?.trim() || undefined, - revenue: params.customerRevenue ? Number(params.customerRevenue) : undefined, - size: params.customerSize ? Number(params.customerSize) : undefined, + customerId, + name: trimmedText(fieldOr(params.customerName, params.name)), + ...customerDetails(), statusId: params.statusId?.trim() || undefined, tierId: params.tierId?.trim() || undefined, } - - case 'linear_delete_customer': - if (!params.customerIdTarget?.trim()) { - throw new Error('Customer ID is required.') - } - return { - ...baseParams, - customerId: params.customerIdTarget.trim(), - } + } case 'linear_merge_customers': if (!params.sourceCustomerId?.trim() || !params.targetCustomerId?.trim()) { @@ -2310,17 +2430,20 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n targetCustomerId: params.targetCustomerId.trim(), } - case 'linear_create_customer_status': - if (!params.statusName?.trim() || !params.statusColor?.trim()) { + case 'linear_create_customer_status': { + const name = trimmedText(fieldOr(params.statusName, params.name)) + const color = trimmedText(fieldOr(params.statusColor, params.color)) + if (!name || !color) { throw new Error('Status name and color are required.') } return { ...baseParams, - name: params.statusName.trim(), - color: params.statusColor.trim(), - description: params.statusDescription?.trim() || undefined, - displayName: params.statusDisplayName?.trim() || undefined, + name, + color, + description: trimmedText(fieldOr(params.statusDescription, params.description)), + displayName: trimmedText(fieldOr(params.statusDisplayName, params.displayName)), } + } case 'linear_update_customer_status': if (!params.statusId?.trim()) { @@ -2329,10 +2452,10 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n return { ...baseParams, statusId: params.statusId.trim(), - name: params.statusName?.trim() || undefined, - color: params.statusColor?.trim() || undefined, - description: params.statusDescription?.trim() || undefined, - displayName: params.statusDisplayName?.trim() || undefined, + name: trimmedText(fieldOr(params.statusName, params.name)), + color: trimmedText(fieldOr(params.statusColor, params.color)), + description: trimmedText(fieldOr(params.statusDescription, params.description)), + displayName: trimmedText(fieldOr(params.statusDisplayName, params.displayName)), } case 'linear_delete_customer_status': @@ -2351,17 +2474,20 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n after: params.after?.trim() || undefined, } - case 'linear_create_customer_tier': - if (!params.tierName?.trim() || !params.statusColor?.trim()) { + case 'linear_create_customer_tier': { + const name = trimmedText(fieldOr(params.tierName, params.name)) + const color = trimmedText(fieldOr(params.statusColor, params.color)) + if (!name || !color) { throw new Error('Tier name and color are required.') } return { ...baseParams, - name: params.tierName.trim(), - displayName: params.tierDisplayName?.trim() || params.tierName.trim(), - color: params.statusColor.trim(), - description: params.tierDescription?.trim() || undefined, + name, + displayName: trimmedText(fieldOr(params.tierDisplayName, params.displayName)) || name, + color, + description: trimmedText(fieldOr(params.tierDescription, params.description)), } + } case 'linear_update_customer_tier': if (!params.tierId?.trim()) { @@ -2370,10 +2496,10 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n return { ...baseParams, tierId: params.tierId.trim(), - name: params.tierName?.trim() || undefined, - displayName: params.tierDisplayName?.trim() || undefined, - color: params.statusColor?.trim() || undefined, - description: params.tierDescription?.trim() || undefined, + name: trimmedText(fieldOr(params.tierName, params.name)), + displayName: trimmedText(fieldOr(params.tierDisplayName, params.displayName)), + color: trimmedText(fieldOr(params.statusColor, params.color)), + description: trimmedText(fieldOr(params.tierDescription, params.description)), } case 'linear_delete_customer_tier': @@ -2401,39 +2527,47 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n projectId: effectiveProjectId, } - case 'linear_create_project_label': - if (!params.projectLabelName?.trim()) { + case 'linear_create_project_label': { + const name = trimmedText(fieldOr(params.projectLabelName, params.name)) + if (!name) { throw new Error('Project label name is required.') } return { ...baseParams, - name: params.projectLabelName.trim(), - description: params.projectLabelDescription?.trim() || undefined, - color: params.statusColor?.trim() || undefined, - isGroup: params.projectLabelIsGroup === 'true', - parentId: params.projectLabelParentId?.trim() || undefined, + name, + description: trimmedText(fieldOr(params.projectLabelDescription, params.description)), + color: trimmedText(fieldOr(params.statusColor, params.color)), + isGroup: isBlank(params.projectLabelIsGroup) + ? (parseOptionalBooleanInput(toolCallArg(context, params.isGroup)) ?? false) + : params.projectLabelIsGroup === 'true', + parentId: trimmedText(fieldOr(params.projectLabelParentId, params.parentId)), } + } - case 'linear_update_project_label': - if (!params.projectLabelId?.trim()) { + case 'linear_update_project_label': { + const labelId = trimmedText(fieldOr(params.projectLabelId, params.labelId)) + if (!labelId) { throw new Error('Project label ID is required.') } return { ...baseParams, - labelId: params.projectLabelId.trim(), - name: params.projectLabelName?.trim() || undefined, - description: params.projectLabelDescription?.trim() || undefined, - color: params.statusColor?.trim() || undefined, + labelId, + name: trimmedText(fieldOr(params.projectLabelName, params.name)), + description: trimmedText(fieldOr(params.projectLabelDescription, params.description)), + color: trimmedText(fieldOr(params.statusColor, params.color)), } + } - case 'linear_delete_project_label': - if (!params.projectLabelId?.trim()) { + case 'linear_delete_project_label': { + const labelId = trimmedText(fieldOr(params.projectLabelId, params.labelId)) + if (!labelId) { throw new Error('Project label ID is required.') } return { ...baseParams, - labelId: params.projectLabelId.trim(), + labelId, } + } case 'linear_list_project_labels': return { @@ -2444,36 +2578,33 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n } case 'linear_add_label_to_project': - if (!params.projectIdForMilestone?.trim() || !params.projectLabelId?.trim()) { - throw new Error('Project ID and label ID are required.') - } - return { - ...baseParams, - projectId: params.projectIdForMilestone.trim(), - labelId: params.projectLabelId.trim(), - } - - case 'linear_remove_label_from_project': - if (!params.projectIdForMilestone?.trim() || !params.projectLabelId?.trim()) { + case 'linear_remove_label_from_project': { + const projectId = trimmedText(fieldOr(params.projectIdForMilestone, params.projectId)) + const labelId = trimmedText(fieldOr(params.projectLabelId, params.labelId)) + if (!projectId || !labelId) { throw new Error('Project ID and label ID are required.') } return { ...baseParams, - projectId: params.projectIdForMilestone.trim(), - labelId: params.projectLabelId.trim(), + projectId, + labelId, } + } - case 'linear_create_project_milestone': - if (!params.projectIdForMilestone?.trim() || !params.milestoneName?.trim()) { + case 'linear_create_project_milestone': { + const projectId = trimmedText(fieldOr(params.projectIdForMilestone, params.projectId)) + const name = trimmedText(fieldOr(params.milestoneName, params.name)) + if (!projectId || !name) { throw new Error('Project ID and milestone name are required.') } return { ...baseParams, - projectId: params.projectIdForMilestone.trim(), - name: params.milestoneName.trim(), - description: params.milestoneDescription?.trim() || undefined, - targetDate: params.milestoneTargetDate?.trim() || undefined, + projectId, + name, + description: trimmedText(fieldOr(params.milestoneDescription, params.description)), + targetDate: trimmedText(fieldOr(params.milestoneTargetDate, params.targetDate)), } + } case 'linear_update_project_milestone': if (!params.milestoneId?.trim()) { @@ -2482,9 +2613,9 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n return { ...baseParams, milestoneId: params.milestoneId.trim(), - name: params.milestoneName?.trim() || undefined, - description: params.milestoneDescription?.trim() || undefined, - targetDate: params.milestoneTargetDate?.trim() || undefined, + name: trimmedText(fieldOr(params.milestoneName, params.name)), + description: trimmedText(fieldOr(params.milestoneDescription, params.description)), + targetDate: trimmedText(fieldOr(params.milestoneTargetDate, params.targetDate)), } case 'linear_delete_project_milestone': @@ -2496,59 +2627,77 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n milestoneId: params.milestoneId.trim(), } - case 'linear_list_project_milestones': - if (!params.projectIdForMilestone?.trim()) { + case 'linear_list_project_milestones': { + const projectId = trimmedText(fieldOr(params.projectIdForMilestone, params.projectId)) + if (!projectId) { throw new Error('Project ID is required.') } return { ...baseParams, - projectId: params.projectIdForMilestone.trim(), + projectId, first: params.first ? Number(params.first) : undefined, after: params.after?.trim() || undefined, } + } - case 'linear_create_project_status': - if ( - !params.projectStatusName?.trim() || - !params.projectStatusType?.trim() || - !params.statusColor?.trim() || - !params.projectStatusPosition?.trim() - ) { + case 'linear_create_project_status': { + const name = trimmedText(fieldOr(params.projectStatusName, params.name)) + const type = trimmedText(fieldOr(params.projectStatusType, params.type)) + const color = trimmedText(fieldOr(params.statusColor, params.color)) + const positionInput = fieldOr(params.projectStatusPosition, params.position) + const position = + typeof positionInput === 'number' + ? positionInput + : typeof positionInput === 'string' && positionInput.trim() + ? Number.parseFloat(positionInput.trim()) + : undefined + if (!name || !type || !color || position === undefined) { throw new Error('Project status name, type, color, and position are required.') } return { ...baseParams, - name: params.projectStatusName.trim(), - type: params.projectStatusType.trim(), - color: params.statusColor.trim(), - position: Number.parseFloat(params.projectStatusPosition.trim()), - description: params.projectStatusDescription?.trim() || undefined, - indefinite: params.projectStatusIndefinite === 'true', + name, + type, + color, + position, + description: trimmedText( + fieldOr(params.projectStatusDescription, params.description) + ), + indefinite: isBlank(params.projectStatusIndefinite) + ? (parseOptionalBooleanInput(toolCallArg(context, params.indefinite)) ?? false) + : params.projectStatusIndefinite === 'true', } + } - case 'linear_update_project_status': - if (!params.projectStatusId?.trim()) { + case 'linear_update_project_status': { + const statusId = trimmedText(fieldOr(params.projectStatusId, params.statusId)) + if (!statusId) { throw new Error('Project status ID is required.') } return { ...baseParams, - statusId: params.projectStatusId.trim(), - name: params.projectStatusName?.trim() || undefined, - color: params.statusColor?.trim() || undefined, - description: params.projectStatusDescription?.trim() || undefined, + statusId, + name: trimmedText(fieldOr(params.projectStatusName, params.name)), + color: trimmedText(fieldOr(params.statusColor, params.color)), + description: trimmedText( + fieldOr(params.projectStatusDescription, params.description) + ), indefinite: params.projectStatusIndefinite ? params.projectStatusIndefinite === 'true' - : undefined, + : parseOptionalBooleanInput(toolCallArg(context, params.indefinite)), } + } - case 'linear_delete_project_status': - if (!params.projectStatusId?.trim()) { + case 'linear_delete_project_status': { + const statusId = trimmedText(fieldOr(params.projectStatusId, params.statusId)) + if (!statusId) { throw new Error('Project status ID is required.') } return { ...baseParams, - statusId: params.projectStatusId.trim(), + statusId, } + } case 'linear_list_project_statuses': return { @@ -2651,6 +2800,10 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n milestoneDescription: { type: 'string', description: 'Milestone description' }, milestoneTargetDate: { type: 'string', description: 'Milestone target date (YYYY-MM-DD)' }, projectStatusId: { type: 'string', description: 'Project status identifier' }, + projectUpdateStatusId: { + type: 'string', + description: 'Project status ID to move the project to on Update Project', + }, projectStatusName: { type: 'string', description: 'Project status name' }, projectStatusDescription: { type: 'string', description: 'Project status description' }, projectStatusIndefinite: { diff --git a/apps/sim/blocks/blocks/pagerduty.ts b/apps/sim/blocks/blocks/pagerduty.ts index 7dc5ad95d49..388e8f75d33 100644 --- a/apps/sim/blocks/blocks/pagerduty.ts +++ b/apps/sim/blocks/blocks/pagerduty.ts @@ -1,6 +1,6 @@ import { PagerDutyIcon } from '@/components/icons' import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types' -import { withSavedCredential } from '@/blocks/utils' +import { mapperOperation, withSavedCredential } from '@/blocks/utils' import { getTrigger } from '@/triggers' export const PagerDutyBlock: BlockConfig = { @@ -744,6 +744,55 @@ export const PagerDutyBlock: BlockConfig = { }, mode: 'advanced', }, + { + id: 'eventTimestamp', + title: 'Timestamp', + type: 'short-input', + placeholder: 'When the event was detected (ISO 8601, e.g., 2024-01-01T00:00:00Z)', + condition: { + field: 'operation', + value: 'send_event', + and: { field: 'eventAction', value: 'trigger' }, + }, + mode: 'advanced', + wandConfig: { + enabled: true, + prompt: + 'Generate an ISO 8601 timestamp. Return ONLY the timestamp string - no explanations, no extra text.', + generationType: 'timestamp', + }, + }, + { + id: 'eventCustomDetails', + title: 'Custom Details', + type: 'code', + language: 'json', + placeholder: '{\n "region": "us-east-1",\n "error_rate": 0.42\n}', + condition: { + field: 'operation', + value: 'send_event', + and: { field: 'eventAction', value: 'trigger' }, + }, + mode: 'advanced', + }, + { + id: 'includeTotal', + title: 'Include Total Count', + type: 'switch', + condition: { + field: 'operation', + value: [ + 'list_incidents', + 'list_incident_alerts', + 'list_services', + 'list_oncalls', + 'list_escalation_policies', + 'list_schedules', + 'list_users', + ], + }, + mode: 'advanced', + }, ...getTrigger('pagerduty_incident_triggered').subBlocks, ...getTrigger('pagerduty_incident_acknowledged').subBlocks, ...getTrigger('pagerduty_incident_resolved').subBlocks, @@ -772,10 +821,10 @@ export const PagerDutyBlock: BlockConfig = { ], config: { tool: (params) => `pagerduty_${params.operation}`, - params: (params) => { + params: (params, context) => { const result: Record = {} - switch (params.operation) { + switch (mapperOperation(params, context)) { case 'list_incidents': if (params.statuses) result.statuses = params.statuses if (params.listUrgencies) result.urgencies = params.listUrgencies @@ -875,6 +924,8 @@ export const PagerDutyBlock: BlockConfig = { if (params.eventComponent) result.component = params.eventComponent if (params.eventGroup) result.group = params.eventGroup if (params.eventClass) result.class = params.eventClass + if (params.eventTimestamp) result.timestamp = params.eventTimestamp + if (params.eventCustomDetails) result.customDetails = params.eventCustomDetails break } @@ -950,6 +1001,9 @@ export const PagerDutyBlock: BlockConfig = { eventComponent: { type: 'string', description: 'Event component' }, eventGroup: { type: 'string', description: 'Event group' }, eventClass: { type: 'string', description: 'Event class' }, + eventTimestamp: { type: 'string', description: 'Event detection time (ISO 8601)' }, + eventCustomDetails: { type: 'json', description: 'Additional event details object' }, + includeTotal: { type: 'boolean', description: 'Populate the total count on list operations' }, }, outputs: { diff --git a/apps/sim/blocks/blocks/sentry.ts b/apps/sim/blocks/blocks/sentry.ts index 18f42e618ed..431ae4ecc1b 100644 --- a/apps/sim/blocks/blocks/sentry.ts +++ b/apps/sim/blocks/blocks/sentry.ts @@ -95,9 +95,9 @@ export const SentryBlock: BlockConfig = { { id: 'projectSlug', - title: 'Project ID', + title: 'Project ID or Slug', type: 'short-input', - placeholder: 'Numeric project ID (optional)', + placeholder: 'Project ID or slug (optional)', condition: { field: 'operation', value: 'sentry_issues_list' }, mode: 'advanced', }, @@ -206,6 +206,19 @@ Return ONLY the search query.`, value: () => '', condition: { field: 'operation', value: 'sentry_issues_update' }, }, + { + id: 'priority', + title: 'New Priority', + type: 'dropdown', + options: [ + { label: 'No Change', id: '' }, + { label: 'High', id: 'high' }, + { label: 'Medium', id: 'medium' }, + { label: 'Low', id: 'low' }, + ], + value: () => '', + condition: { field: 'operation', value: 'sentry_issues_update' }, + }, { id: 'assignedTo', title: 'Assign To', @@ -387,7 +400,7 @@ Return ONLY the search query.`, id: 'limit', title: 'Limit', type: 'short-input', - placeholder: '50', + placeholder: '10', condition: { field: 'operation', value: 'sentry_events_list' }, mode: 'advanced', }, @@ -419,9 +432,9 @@ Return ONLY the search query.`, { id: 'projectSlug', - title: 'Project ID', + title: 'Project ID or Slug', type: 'short-input', - placeholder: 'Numeric project ID (optional)', + placeholder: 'Project ID or slug (optional)', condition: { field: 'operation', value: 'sentry_releases_list' }, mode: 'advanced', }, @@ -737,6 +750,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, apiKey: { type: 'string', description: 'Sentry API authentication token' }, organizationSlug: { type: 'string', description: 'Organization slug' }, issueId: { type: 'string', description: 'Issue ID' }, + priority: { type: 'string', description: 'Issue priority (low, medium, high)' }, assignedTo: { type: 'string', description: 'User to assign issue to' }, isBookmarked: { type: 'boolean', description: 'Bookmark state' }, isSubscribed: { type: 'boolean', description: 'Subscription state' }, diff --git a/apps/sim/blocks/blocks/slack-workflow-operations.ts b/apps/sim/blocks/blocks/slack-workflow-operations.ts index 0f1ce5f1924..0589d397ae7 100644 --- a/apps/sim/blocks/blocks/slack-workflow-operations.ts +++ b/apps/sim/blocks/blocks/slack-workflow-operations.ts @@ -1,9 +1,10 @@ import { getScopesForService } from '@/lib/oauth/utils' -import type { BlockConfig, SubBlockConfig } from '@/blocks/types' +import type { BlockConfig, BlockToolParamsContext, SubBlockConfig } from '@/blocks/types' import { parseOptionalBooleanInput, parseOptionalJsonInput, parseOptionalNumberInput, + toolCallArg, } from '@/blocks/utils' interface SlackWorkflowField { @@ -1420,17 +1421,26 @@ export function getSlackWorkflowSubBlocks(): SubBlockConfig[] { return result } +/** + * Maps a workflow operation's `slack__` block fields to its tool params. On a tool call + * those fields are absent and the model's args arrive under the tool's param names; an empty field + * then leaves the model's value in place instead of writing the field's default over it. + */ export function mapSlackWorkflowParams( operation: SlackWorkflowOperation, - params: Record + params: Record, + context?: BlockToolParamsContext ): Record { const result: Record = { - credential: params[operation.auth === 'bot' ? 'apiBotCredentialId' : 'apiOAuthCredentialId'], + credential: + params[operation.auth === 'bot' ? 'apiBotCredentialId' : 'apiOAuthCredentialId'] ?? + toolCallArg(context, params.credential), } for (const field of operation.fields) { const raw = params[field.id] - const value = - raw === undefined || raw === null || (raw === '' && !field.allowEmpty) ? field.default : raw + const isEmpty = raw === undefined || raw === null || (raw === '' && !field.allowEmpty) + if (isEmpty && toolCallArg(context, params[field.param]) !== undefined) continue + const value = isEmpty ? field.default : raw if (value === undefined) continue if (field.type === 'json') result[field.param] = parseOptionalJsonInput(value, field.title) else if (field.type === 'number') diff --git a/apps/sim/blocks/blocks/slack.test.ts b/apps/sim/blocks/blocks/slack.test.ts index ba244f1b057..bc0f68f1c5a 100644 --- a/apps/sim/blocks/blocks/slack.test.ts +++ b/apps/sim/blocks/blocks/slack.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { evaluateSubBlockCondition } from '@/lib/workflows/subblocks/visibility' -import { SlackV2Block } from '@/blocks/blocks/slack' +import { SlackBlock, SlackV2Block } from '@/blocks/blocks/slack' function mapSlackV2Params(params: Record): Record { const mapParams = SlackV2Block.tools.config?.params @@ -8,6 +8,20 @@ function mapSlackV2Params(params: Record): Record +): Record { + const mapParams = block.tools.config?.params + if (!mapParams) throw new Error('Slack parameter mapper is required') + return { ...merged, ...mapParams(merged, { operation }) } +} + function isSlackV2SubBlockVisible(subBlockId: string, values: Record): boolean { const subBlock = SlackV2Block.subBlocks.find((candidate) => candidate.id === subBlockId) if (!subBlock) throw new Error(`Slack v2 subblock not found: ${subBlockId}`) @@ -110,4 +124,94 @@ describe('Slack block release', () => { { limit: 100 } ) }) + + describe('tool calls (operation only in context)', () => { + it('sends the stored bot credential for workflow operations', () => { + expect( + toolCall(SlackV2Block, 'add_bookmark', { + apiBotCredentialId: 'bot-cred', + channel_id: 'C1', + title: 'Docs', + link: 'https://example.com', + }) + ).toMatchObject({ credential: 'bot-cred', channel_id: 'C1', title: 'Docs' }) + }) + + it('keeps the model value over a workflow field default', () => { + expect( + toolCall(SlackV2Block, 'get_team_profile', { + apiBotCredentialId: 'bot-cred', + visibility: 'hidden', + }) + ).toMatchObject({ credential: 'bot-cred', visibility: 'hidden' }) + }) + + it('maps stored workflow fields when the model omits them', () => { + expect( + toolCall(SlackV2Block, 'list_files', { + apiOAuthCredentialId: 'cred', + slack_list_files_channel: 'C123', + }) + ).toMatchObject({ credential: 'cred', channel: 'C123' }) + }) + + it('keeps model args the v1 branches would otherwise overwrite', () => { + expect( + toolCall(SlackBlock, 'edit_canvas', { + oauthCredential: 'cred', + canvasId: 'F1', + operation: 'insert_at_end', + content: 'x', + }) + ).toMatchObject({ credential: 'cred', canvasId: 'F1', operation: 'insert_at_end' }) + expect( + toolCall(SlackBlock, 'get_channel_history', { channel: 'C1', inclusive: true }) + ).toMatchObject({ inclusive: true }) + expect(toolCall(SlackBlock, 'list_users', { includeDeleted: true, limit: 5 })).toMatchObject({ + includeDeleted: true, + limit: 5, + }) + expect( + toolCall(SlackBlock, 'list_channels', { includePrivate: false, limit: 20 }) + ).toMatchObject({ includePrivate: false, limit: 20 }) + expect(toolCall(SlackBlock, 'list_channels', { excludeArchived: false })).toMatchObject({ + excludeArchived: false, + }) + expect( + toolCall(SlackBlock, 'schedule_message', { channel: 'C1', text: 'hi', postAt: 1900000000 }) + ).toMatchObject({ postAt: 1900000000 }) + expect( + toolCall(SlackBlock, 'update_view', { externalId: 'ext-1', view: { type: 'modal' } }) + ).toMatchObject({ externalId: 'ext-1', view: { type: 'modal' } }) + }) + + it('maps stored v1 fields under their tool param names', () => { + expect( + toolCall(SlackV2Block, 'lookup_canvas_sections', { + oauthCredential: 'cred', + lookupCanvasId: 'F1', + sectionCriteria: '{"contains_text":"x"}', + }) + ).toMatchObject({ canvasId: 'F1', criteria: '{"contains_text":"x"}' }) + }) + + it('keeps model args for List and agent session operations', () => { + expect( + toolCall(SlackV2Block, 'list_items', { + listCredentialId: 'bot', + listId: 'L1', + limit: 10, + cursor: 'c1', + }) + ).toMatchObject({ credential: 'bot', listId: 'L1', limit: 10, cursor: 'c1' }) + expect( + toolCall(SlackV2Block, 'set_agent_session_status', { + agentCredentialId: 'bot', + channel: 'C1', + threadTs: '1.2', + status: 'processing', + }) + ).toMatchObject({ credential: 'bot', channel: 'C1', threadTs: '1.2', status: 'processing' }) + }) + }) }) diff --git a/apps/sim/blocks/blocks/slack.ts b/apps/sim/blocks/blocks/slack.ts index 54b6e93cee3..47b9c743928 100644 --- a/apps/sim/blocks/blocks/slack.ts +++ b/apps/sim/blocks/blocks/slack.ts @@ -10,13 +10,16 @@ import { SLACK_WORKFLOW_OPERATIONS, SLACK_WORKFLOW_SENTENCES, } from '@/blocks/blocks/slack-workflow-operations' -import type { BlockConfig, BlockMeta, SubBlockConfig } from '@/blocks/types' +import type { BlockConfig, BlockMeta, BlockToolParamsContext, SubBlockConfig } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' import { + isToolCall, + mapperOperation, normalizeFileInput, parseOptionalBooleanInput, parseOptionalJsonInput, parseOptionalNumberInput, + toolCallArg, } from '@/blocks/utils' import { getTrigger } from '@/triggers' import { SLACK_AGENT_SCOPES } from '@/triggers/slack/shared' @@ -1045,7 +1048,7 @@ Return ONLY the JSON array - no explanations, no quotes around the array, no ext id: 'historyMaxPages', title: 'Max Pages', type: 'short-input', - placeholder: '10', + placeholder: '10 (max 50)', mode: 'advanced', condition: { field: 'operation', @@ -1508,7 +1511,6 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`, field: 'operation', value: ['open_view', 'push_view'], }, - required: true, }, { id: 'viewInteractivityPointer', @@ -1877,13 +1879,13 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te throw new Error(`Invalid Slack operation: ${params.operation}`) } }, - params: (params) => { + params: (params, context) => { + const operation = mapperOperation(params, context) const { oauthCredential, authMethod, botToken, botCredential, - operation, destinationType, channel, dmUserId, @@ -1991,7 +1993,7 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te baseParams.accessToken = botToken } } else { - baseParams.credential = oauthCredential + baseParams.credential = oauthCredential ?? toolCallArg(context, params.credential) } switch (operation) { @@ -2013,7 +2015,9 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te case 'ephemeral': { baseParams.text = messageFormat === 'blocks' && !text ? ' ' : text - baseParams.user = ephemeralUser ? String(ephemeralUser).trim() : '' + baseParams.user = ephemeralUser + ? String(ephemeralUser).trim() + : (toolCallArg(context, params.user) ?? '') if (threadTs) { baseParams.threadTs = threadTs } @@ -2041,11 +2045,11 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'get_message': - baseParams.timestamp = getMessageTimestamp + baseParams.timestamp = getMessageTimestamp ?? toolCallArg(context, params.timestamp) break case 'get_thread': { - baseParams.threadTs = getThreadTimestamp + baseParams.threadTs = getThreadTimestamp ?? toolCallArg(context, params.threadTs) if (threadLimit) { const parsedLimit = Number.parseInt(threadLimit, 10) if (!Number.isNaN(parsedLimit) && parsedLimit > 0) { @@ -2056,7 +2060,7 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'set_status': { - baseParams.threadTs = getThreadTimestamp + baseParams.threadTs = getThreadTimestamp ?? toolCallArg(context, params.threadTs) baseParams.status = status ?? '' if (loadingMessages) { baseParams.loadingMessages = loadingMessages @@ -2065,14 +2069,14 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'set_title': { - baseParams.threadTs = getThreadTimestamp - baseParams.title = assistantTitle + baseParams.threadTs = getThreadTimestamp ?? toolCallArg(context, params.threadTs) + baseParams.title = assistantTitle ?? toolCallArg(context, params.title) break } case 'set_suggested_prompts': { - baseParams.threadTs = getThreadTimestamp - baseParams.prompts = suggestedPrompts + baseParams.threadTs = getThreadTimestamp ?? toolCallArg(context, params.threadTs) + baseParams.prompts = suggestedPrompts ?? toolCallArg(context, params.prompts) if (promptsTitle) { baseParams.promptsTitle = promptsTitle } @@ -2080,14 +2084,14 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'get_permalink': { - baseParams.messageTs = getMessageTimestamp + baseParams.messageTs = getMessageTimestamp ?? toolCallArg(context, params.messageTs) break } case 'get_channel_history': case 'get_thread_replies': { if (operation === 'get_thread_replies') { - baseParams.threadTs = getThreadTimestamp + baseParams.threadTs = getThreadTimestamp ?? toolCallArg(context, params.threadTs) } if (historyOldest) { baseParams.oldest = String(historyOldest).trim() @@ -2110,18 +2114,28 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te if (historyCursor) { baseParams.cursor = String(historyCursor).trim() } - baseParams.inclusive = historyInclusive === 'true' + baseParams.inclusive = + historyInclusive === undefined + ? (toolCallArg(context, params.inclusive) ?? false) + : historyInclusive === 'true' || historyInclusive === true break } case 'list_channels': { - baseParams.includePrivate = includePrivate !== 'false' - baseParams.excludeArchived = true + baseParams.includePrivate = includePrivate !== 'false' && includePrivate !== false + const modelExcludeArchived = toolCallArg(context, params.excludeArchived) + baseParams.excludeArchived = + modelExcludeArchived !== false && modelExcludeArchived !== 'false' const hasChannelLimit = channelLimit !== undefined && channelLimit !== null && (typeof channelLimit !== 'string' || Boolean(channelLimit.trim())) - const parsedLimit = hasChannelLimit ? Number(channelLimit) : 100 + const modelLimit = toolCallArg(context, params.limit) + const parsedLimit = hasChannelLimit + ? Number(channelLimit) + : modelLimit === undefined || modelLimit === null || modelLimit === '' + ? 100 + : Number(modelLimit) if (!Number.isInteger(parsedLimit) || parsedLimit < 1 || parsedLimit > 200) { throw new Error('Conversations per page must be an integer between 1 and 200') } @@ -2133,7 +2147,9 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'list_members': { - baseParams.limit = memberLimit ? Number.parseInt(memberLimit, 10) : 100 + baseParams.limit = memberLimit + ? Number.parseInt(memberLimit, 10) + : (toolCallArg(context, params.limit) ?? 100) if (paginationCursor) { baseParams.cursor = String(paginationCursor).trim() } @@ -2141,8 +2157,10 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te } case 'list_users': { - baseParams.includeDeleted = includeDeleted === 'true' - baseParams.limit = userLimit ? Number.parseInt(userLimit, 10) : 100 + baseParams.includeDeleted = includeDeleted === 'true' || includeDeleted === true + baseParams.limit = userLimit + ? Number.parseInt(userLimit, 10) + : (toolCallArg(context, params.limit) ?? 100) if (paginationCursor) { baseParams.cursor = String(paginationCursor).trim() } @@ -2161,35 +2179,41 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te break } - case 'update': - baseParams.timestamp = updateTimestamp - baseParams.text = messageFormat === 'blocks' && !updateText ? ' ' : updateText + case 'update': { + baseParams.timestamp = updateTimestamp ?? toolCallArg(context, params.timestamp) + const updateBody = updateText ?? toolCallArg(context, params.text) + baseParams.text = messageFormat === 'blocks' && !updateBody ? ' ' : updateBody if (blocks) { baseParams.blocks = blocks } break + } case 'delete': - baseParams.timestamp = deleteTimestamp + baseParams.timestamp = deleteTimestamp ?? toolCallArg(context, params.timestamp) break case 'react': case 'unreact': - baseParams.timestamp = reactionTimestamp - baseParams.name = emojiName + baseParams.timestamp = reactionTimestamp ?? toolCallArg(context, params.timestamp) + baseParams.name = emojiName ?? toolCallArg(context, params.name) break case 'get_channel_info': - baseParams.includeNumMembers = includeNumMembers !== 'false' + baseParams.includeNumMembers = + includeNumMembers !== 'false' && includeNumMembers !== false break case 'get_user_presence': - baseParams.userId = presenceUserId + baseParams.userId = presenceUserId ?? toolCallArg(context, params.userId) break case 'edit_canvas': - baseParams.canvasId = editCanvasId - baseParams.operation = canvasOperation + baseParams.canvasId = editCanvasId ?? toolCallArg(context, params.canvasId) + // A tool call's own `operation` arg (the edit kind) stays in the merged params. + if (canvasOperation !== undefined || !isToolCall(context)) { + baseParams.operation = canvasOperation + } if (canvasContent) { baseParams.content = canvasContent } @@ -2211,18 +2235,20 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te break case 'get_canvas': - baseParams.canvasId = getCanvasId + baseParams.canvasId = getCanvasId ?? toolCallArg(context, params.canvasId) break case 'list_canvases': - baseParams.count = parseOptionalNumberInput(canvasListCount, 'Canvas Limit', { - integer: true, - min: 1, - }) - baseParams.page = parseOptionalNumberInput(canvasListPage, 'Canvas Page', { - integer: true, - min: 1, - }) + baseParams.count = + parseOptionalNumberInput(canvasListCount, 'Canvas Limit', { + integer: true, + min: 1, + }) ?? toolCallArg(context, params.count) + baseParams.page = + parseOptionalNumberInput(canvasListPage, 'Canvas Page', { + integer: true, + min: 1, + }) ?? toolCallArg(context, params.page) if (canvasListUser) { baseParams.user = String(canvasListUser).trim() } @@ -2238,40 +2264,41 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te break case 'lookup_canvas_sections': - baseParams.canvasId = lookupCanvasId - baseParams.criteria = sectionCriteria + baseParams.canvasId = lookupCanvasId ?? toolCallArg(context, params.canvasId) + baseParams.criteria = sectionCriteria ?? toolCallArg(context, params.criteria) break case 'delete_canvas': - baseParams.canvasId = deleteCanvasId + baseParams.canvasId = deleteCanvasId ?? toolCallArg(context, params.canvasId) break case 'create_conversation': - baseParams.name = conversationName - baseParams.isPrivate = isPrivate === 'true' + baseParams.name = conversationName ?? toolCallArg(context, params.name) + baseParams.isPrivate = isPrivate === 'true' || isPrivate === true if (teamId) { baseParams.teamId = teamId } break case 'invite_to_conversation': - baseParams.users = inviteUsers + baseParams.users = inviteUsers ?? toolCallArg(context, params.users) if (inviteForce === 'true') { baseParams.force = true } break case 'open_view': - baseParams.triggerId = viewTriggerId + baseParams.triggerId = viewTriggerId ?? toolCallArg(context, params.triggerId) if (viewInteractivityPointer) { baseParams.interactivityPointer = viewInteractivityPointer } - baseParams.view = viewPayload + baseParams.view = viewPayload ?? toolCallArg(context, params.view) break case 'update_view': { const trimmedViewId = viewId ? String(viewId).trim() : '' - const trimmedExternalId = viewExternalId ? String(viewExternalId).trim() : '' + const externalId = viewExternalId || toolCallArg(context, params.externalId) + const trimmedExternalId = externalId ? String(externalId).trim() : '' if (!trimmedViewId && !trimmedExternalId) { throw new Error('update_view requires either View ID or External ID') } @@ -2284,24 +2311,24 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te if (viewHash) { baseParams.hash = viewHash } - baseParams.view = viewPayload + baseParams.view = viewPayload ?? toolCallArg(context, params.view) break } case 'push_view': - baseParams.triggerId = viewTriggerId + baseParams.triggerId = viewTriggerId ?? toolCallArg(context, params.triggerId) if (viewInteractivityPointer) { baseParams.interactivityPointer = viewInteractivityPointer } - baseParams.view = viewPayload + baseParams.view = viewPayload ?? toolCallArg(context, params.view) break case 'publish_view': - baseParams.userId = publishUserId + baseParams.userId = publishUserId ?? toolCallArg(context, params.userId) if (viewHash) { baseParams.hash = viewHash } - baseParams.view = viewPayload + baseParams.view = viewPayload ?? toolCallArg(context, params.view) break case 'schedule_message': { @@ -2312,7 +2339,8 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te if (threadTs) { baseParams.threadTs = threadTs } - const parsedPostAt = Number.parseInt(String(scheduleAt ?? '').trim(), 10) + const postAt = scheduleAt ?? toolCallArg(context, params.postAt) + const parsedPostAt = Number.parseInt(String(postAt ?? '').trim(), 10) if (Number.isNaN(parsedPostAt)) { throw new Error('Send At must be a Unix timestamp in seconds') } @@ -2341,15 +2369,15 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te break case 'rename_conversation': - baseParams.name = renameChannelName + baseParams.name = renameChannelName ?? toolCallArg(context, params.name) break case 'set_conversation_topic': - baseParams.topic = conversationTopic + baseParams.topic = conversationTopic ?? toolCallArg(context, params.topic) break case 'set_conversation_purpose': - baseParams.purpose = conversationPurpose + baseParams.purpose = conversationPurpose ?? toolCallArg(context, params.purpose) break } @@ -2598,6 +2626,8 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te type: 'json', description: 'Array of user IDs who are members of the channel', }, + ids: { type: 'json', description: 'IDs of the returned channels or users' }, + names: { type: 'json', description: 'Names of the returned channels or users' }, users: { type: 'json', @@ -3017,12 +3047,8 @@ function getSlackV2AgentSubBlocks(): SubBlockConfig[] { id: 'agentThreadTs', title: 'Thread Timestamp', type: 'short-input', - placeholder: 'Thread timestamp (thread_ts)', + placeholder: 'Thread timestamp (thread_ts); leave empty for session channels', condition: { field: 'operation', value: [...SLACK_V2_AGENT_OPERATIONS] }, - required: { - field: 'operation', - value: ['set_agent_session_status', 'rename_agent_session'], - }, }, { id: 'agentSessionStatus', @@ -3102,9 +3128,19 @@ function getSlackV2AgentSubBlocks(): SubBlockConfig[] { ] } -function mapSlackListParams(params: Record): Record { +/** + * Maps a Slack List operation's block fields to its tool params. On a tool call the block-only + * fields are absent and the model's args arrive under the tool's param names, so each assignment + * falls back to the model's value through {@link toolCallArg}. + */ +function mapSlackListParams( + operation: string, + params: Record, + context: BlockToolParamsContext | undefined +): Record { + const modelArg = (param: string) => toolCallArg(context, params[param]) const result: Record = { - credential: params.listCredentialId, + credential: params.listCredentialId ?? modelArg('credential'), listId: params.listId, } const optional = (field: string) => { @@ -3117,56 +3153,63 @@ function mapSlackListParams(params: Record): Record { - const operation = getSlackWorkflowOperation(params.operation) - if (operation) return mapSlackWorkflowParams(operation, params) - if (SLACK_V2_LIST_OPERATIONS.includes(params.operation as never)) { - return mapSlackListParams(params) + params: (params, context) => { + const operationId = mapperOperation(params, context) + const workflowOperation = getSlackWorkflowOperation(operationId) + if (workflowOperation) return mapSlackWorkflowParams(workflowOperation, params, context) + if (SLACK_V2_LIST_OPERATIONS.includes(operationId as never)) { + return mapSlackListParams(operationId, params, context) } const mapParams = SlackBlock.tools.config?.params if (!mapParams) throw new Error('Slack parameter mapper is required') - const baseParams = mapParams(params) - if (!SLACK_V2_AGENT_OPERATIONS.includes(params.operation as never)) return baseParams + const baseParams = mapParams(params, context) + if (!SLACK_V2_AGENT_OPERATIONS.includes(operationId as never)) return baseParams + const modelArg = (param: string) => toolCallArg(context, params[param]) return { ...baseParams, - credential: params.agentCredentialId, - channel: params.agentChannelId, - threadTs: params.agentThreadTs, - status: params.agentSessionStatus, - title: params.agentSessionTitle, - initiatorUserId: params.agentInitiatorUserId, - iconEmoji: params.agentIconEmoji, - iconUrl: params.agentIconUrl, - username: params.agentUsername, - prompts: params.suggestedPrompts, + credential: params.agentCredentialId ?? modelArg('credential'), + channel: params.agentChannelId ?? modelArg('channel'), + threadTs: params.agentThreadTs ?? modelArg('threadTs'), + status: params.agentSessionStatus ?? modelArg('status'), + title: params.agentSessionTitle ?? modelArg('title'), + initiatorUserId: params.agentInitiatorUserId ?? modelArg('initiatorUserId'), + iconEmoji: params.agentIconEmoji ?? modelArg('iconEmoji'), + iconUrl: params.agentIconUrl ?? modelArg('iconUrl'), + username: params.agentUsername ?? modelArg('username'), + prompts: params.suggestedPrompts ?? modelArg('prompts'), promptsTitle: params.promptsTitle, } }, @@ -3864,7 +3909,7 @@ Block Kit messages can contain buttons, selects and forms, but interactions requ emoji: { type: 'json', description: 'Custom emoji names mapped to image URLs or aliases' }, team: { type: 'json', description: 'Workspace details' }, job_id: { type: 'string', description: 'List export job ID' }, - status: { type: 'string', description: 'List export job status' }, + status: { type: 'string', description: 'List export job status, or agent session status' }, download_url: { type: 'string', description: 'List export download URL when ready' }, response_metadata: { type: 'json', description: 'Pagination metadata including next_cursor' }, dnd_enabled: { type: 'boolean', description: 'Whether Do Not Disturb is enabled' }, diff --git a/apps/sim/lib/internal/github/operations.ts b/apps/sim/lib/internal/github/operations.ts index b30e3941b9a..50d5198471b 100644 --- a/apps/sim/lib/internal/github/operations.ts +++ b/apps/sim/lib/internal/github/operations.ts @@ -64,16 +64,42 @@ interface GitHubCommitFile { blob_url?: string } +interface GitHubGitActor { + name: string + email: string + date: string +} + +interface GitHubCommitUser { + login: string + avatar_url: string + html_url: string + id?: number + node_id?: string + type?: string + url?: string + site_admin?: boolean +} + interface GitHubCommitResponse { sha: string html_url: string commit: { + url?: string message: string - author: { name: string; email: string; date: string } - committer: { name: string; email: string; date: string } + comment_count?: number + author: GitHubGitActor + committer: GitHubGitActor + tree?: { sha: string; url: string } + verification?: { + verified: boolean + reason: string + signature?: string | null + payload?: string | null + } } - author?: { login: string; avatar_url: string; html_url: string } - committer?: { login: string; avatar_url: string; html_url: string } + author?: GitHubCommitUser | null + committer?: GitHubCommitUser | null stats?: { additions: number; deletions: number; total: number } files?: GitHubCommitFile[] } @@ -348,6 +374,27 @@ async function fetchChangedFileContent( } } +/** + * Merges a commit's git identity with its linked GitHub account. The account + * fields keep their `'Unknown'`/`''` fallbacks when the commit has no linked + * user, which the v1 output has always returned. + */ +function commitActorMetadata(actor: GitHubGitActor, user: GitHubCommitUser | null | undefined) { + return { + name: actor.name, + email: actor.email, + date: actor.date, + login: user?.login || 'Unknown', + avatar_url: user?.avatar_url || '', + html_url: user?.html_url || '', + id: user?.id, + node_id: user?.node_id, + type: user?.type, + url: user?.url, + site_admin: user?.site_admin, + } +} + export async function getGitHubLatestCommit( input: LatestCommitParams, context: GitHubOperationContext @@ -410,18 +457,12 @@ export async function getGitHubLatestCommit( sha: data.sha, html_url: data.html_url, commit_message: data.commit.message, - author: { - name: data.commit.author.name, - login: data.author?.login || 'Unknown', - avatar_url: data.author?.avatar_url || '', - html_url: data.author?.html_url || '', - }, - committer: { - name: data.commit.committer.name, - login: data.committer?.login || 'Unknown', - avatar_url: data.committer?.avatar_url || '', - html_url: data.committer?.html_url || '', - }, + commit_url: data.commit.url, + comment_count: data.commit.comment_count, + tree: data.commit.tree, + verification: data.commit.verification, + author: commitActorMetadata(data.commit.author, data.author), + committer: commitActorMetadata(data.commit.committer, data.committer), stats: data.stats, files: files.length > 0 ? files : undefined, }, diff --git a/apps/sim/lib/internal/slack/operations.test.ts b/apps/sim/lib/internal/slack/operations.test.ts index cce8756aaa4..cf92cc9f035 100644 --- a/apps/sim/lib/internal/slack/operations.test.ts +++ b/apps/sim/lib/internal/slack/operations.test.ts @@ -19,6 +19,7 @@ vi.mock('@/lib/internal/slack/file-input', () => ({ vi.mock('@/lib/core/security/input-validation.server', () => inputValidationMock) import { executeSlackDownload } from '@/lib/internal/slack/operations' +import { executeSlackGetChannelHistoryOperation } from '@/lib/internal/slack/operations/get-channel-history' import { MAX_FILE_SIZE } from '@/lib/uploads/utils/validation' const { mockValidateUrlWithDNS, mockSecureFetchWithPinnedIP, mockSecureFetchWithValidation } = @@ -90,4 +91,22 @@ describe('Slack operations', () => { } expect(result.present([storedFile])).toEqual({ success: true, output: { file: storedFile } }) }) + + it('stops following history cursors at the page ceiling whatever maxPages asks for', async () => { + vi.mocked(global.fetch).mockImplementation(async () => + slackResponse({ + ok: true, + messages: [{ ts: '1.0', text: 'hi' }], + response_metadata: { next_cursor: 'more' }, + }) + ) + + const result = await executeSlackGetChannelHistoryOperation( + { accessToken: 'token', channel: 'C1', limit: 999, maxPages: 10000 }, + new AbortController().signal + ) + + expect(global.fetch).toHaveBeenCalledTimes(50) + expect(result.output).toMatchObject({ pages: 50, hasMore: true, nextCursor: 'more' }) + }) }) diff --git a/apps/sim/tools/datadog/create_event.ts b/apps/sim/tools/datadog/create_event.ts index eeb3f3d4f5a..0a5c54eb85d 100644 --- a/apps/sim/tools/datadog/create_event.ts +++ b/apps/sim/tools/datadog/create_event.ts @@ -4,7 +4,7 @@ import type { EventAlertType, EventPriority, } from '@/tools/datadog/types' -import { datadogErrorMessage, resolveDatadogSite } from '@/tools/datadog/utils' +import { datadogErrorMessage, resolveDatadogSite, splitCommaList } from '@/tools/datadog/utils' import { DATADOG_API_KEY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -12,7 +12,7 @@ export const createEventTool: ToolConfig id: 'datadog_create_event', name: 'Datadog Create Event', description: - 'Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences.', + 'Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences. Uses the v1 events endpoint, which Datadog has deprecated and serves only to organizations that have used it before.', version: '1.0.0', oauth: DATADOG_API_KEY_CREDENTIAL_OAUTH, @@ -121,12 +121,8 @@ export const createEventTool: ToolConfig if (params.sourceTypeName) body.source_type_name = params.sourceTypeName if (params.dateHappened) body.date_happened = params.dateHappened - if (params.tags) { - body.tags = params.tags - .split(',') - .map((t: string) => t.trim()) - .filter((t: string) => t.length > 0) - } + const tags = splitCommaList(params.tags) + if (tags) body.tags = tags return body }, @@ -150,6 +146,7 @@ export const createEventTool: ToolConfig output: { event: { id: data.event?.id, + id_str: data.event?.id_str, title: data.event?.title, text: data.event?.text, date_happened: data.event?.date_happened, @@ -168,7 +165,15 @@ export const createEventTool: ToolConfig type: 'object', description: 'The created event details', properties: { - id: { type: 'number', description: 'Event ID' }, + id: { + type: 'number', + description: 'Event ID. Can lose precision above 2^53; prefer id_str', + }, + id_str: { + type: 'string', + description: 'Event ID as an exact string', + optional: true, + }, title: { type: 'string', description: 'Event title' }, text: { type: 'string', description: 'Event text' }, date_happened: { type: 'number', description: 'Unix timestamp when event occurred' }, diff --git a/apps/sim/tools/datadog/create_monitor.ts b/apps/sim/tools/datadog/create_monitor.ts index 6382756ece3..33e27bd2734 100644 --- a/apps/sim/tools/datadog/create_monitor.ts +++ b/apps/sim/tools/datadog/create_monitor.ts @@ -1,5 +1,10 @@ import type { CreateMonitorParams, CreateMonitorResponse, MonitorType } from '@/tools/datadog/types' -import { datadogErrorMessage, parseJsonParam, resolveDatadogSite } from '@/tools/datadog/utils' +import { + datadogErrorMessage, + parseJsonParam, + resolveDatadogSite, + splitCommaList, +} from '@/tools/datadog/utils' import { DATADOG_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -106,12 +111,8 @@ export const createMonitorTool: ToolConfig t.trim()) - .filter((t: string) => t.length > 0) - } + const tags = splitCommaList(params.tags) + if (tags) body.tags = tags const options = parseJsonParam>(params.options, 'options parameter') if (options) body.options = options diff --git a/apps/sim/tools/datadog/datadog.test.ts b/apps/sim/tools/datadog/datadog.test.ts index 4ac79ec2288..901ffa76c88 100644 --- a/apps/sim/tools/datadog/datadog.test.ts +++ b/apps/sim/tools/datadog/datadog.test.ts @@ -4,9 +4,11 @@ import { executeUpdateSloOperation } from '@/lib/internal/datadog/operations/upd import * as datadogTools from '@/tools/datadog' import { cancelDowntimeTool } from '@/tools/datadog/cancel_downtime' import { createDowntimeTool } from '@/tools/datadog/create_downtime' +import { createEventTool } from '@/tools/datadog/create_event' import { createMonitorTool } from '@/tools/datadog/create_monitor' import { getIncidentTool } from '@/tools/datadog/get_incident' import { getMonitorTool } from '@/tools/datadog/get_monitor' +import { getSloHistoryTool } from '@/tools/datadog/get_slo_history' import { listDashboardsTool } from '@/tools/datadog/list_dashboards' import { listDowntimesTool } from '@/tools/datadog/list_downtimes' import { listIncidentsTool } from '@/tools/datadog/list_incidents' @@ -16,7 +18,13 @@ import { queryLogsTool } from '@/tools/datadog/query_logs' import { queryTimeseriesTool } from '@/tools/datadog/query_timeseries' import { sendLogsTool } from '@/tools/datadog/send_logs' import { submitMetricsTool } from '@/tools/datadog/submit_metrics' -import { DATADOG_SITES } from '@/tools/datadog/types' +import { + type CreateEventParams, + type CreateMonitorParams, + DATADOG_SITES, + type SubmitMetricsParams, + type UpdateIncidentParams, +} from '@/tools/datadog/types' import { unmuteMonitorTool } from '@/tools/datadog/unmute_monitor' import { updateIncidentTool } from '@/tools/datadog/update_incident' import { @@ -654,3 +662,76 @@ describe('every Datadog tool routes its host through the allowlist', () => { expect(unguarded).toEqual([]) }) }) + +describe('submit_metrics numeric intake codes', () => { + it('passes a numeric MetricIntakeType through instead of dropping it', () => { + const body = callBody(submitMetricsTool, { + ...auth, + series: JSON.stringify([{ metric: 'm', type: 3, points: [{ timestamp: 1, value: 2 }] }]), + } as SubmitMetricsParams) + expect(body.series[0].type).toBe(3) + }) + + it('drops a numeric code outside the enum', () => { + const body = callBody(submitMetricsTool, { + ...auth, + series: JSON.stringify([{ metric: 'm', type: 9, points: [{ timestamp: 1, value: 2 }] }]), + } as SubmitMetricsParams) + expect(body.series[0].type).toBeUndefined() + }) +}) + +describe('tags that arrive as an array', () => { + const tags = ['env:prod', ' team:a '] + + it('create_monitor sends the tags instead of throwing', () => { + const params: CreateMonitorParams = { + ...auth, + name: 'n', + type: 'metric alert', + query: 'q', + tags, + } + expect(callBody(createMonitorTool, params).tags).toEqual(['env:prod', 'team:a']) + }) + + it('create_event sends the tags instead of throwing', () => { + const params: CreateEventParams = { ...auth, title: 't', text: 'x', tags } + expect(callBody(createEventTool, params).tags).toEqual(['env:prod', 'team:a']) + }) +}) + +describe('update_incident body id', () => { + it('matches the trimmed path id', () => { + const params: UpdateIncidentParams = { ...auth, incidentId: ' abc-123 ', title: 'T' } + expect(callUrl(updateIncidentTool, params)).toContain('/api/v2/incidents/abc-123') + expect(callBody(updateIncidentTool, params).data.id).toBe('abc-123') + }) +}) + +describe('response fields Datadog returns alongside the main payload', () => { + it('keeps the exact event id string that a number cannot hold', async () => { + const response = new Response( + '{"event":{"id":1234567890123456789,"id_str":"1234567890123456789","title":"t"}}', + { status: 200 } + ) + const result = await createEventTool.transformResponse?.(response) + expect(result?.output.event.id_str).toBe('1234567890123456789') + }) + + it('surfaces SLO history query errors on a successful response', async () => { + const result = await getSloHistoryTool.transformResponse?.( + jsonResponse({ data: {}, errors: [{ error: 'query timed out' }] }) + ) + expect(result?.success).toBe(true) + expect(result?.output.errors).toEqual([{ error: 'query timed out' }]) + }) + + it('returns the included resources get_incident asked for', async () => { + const included = [{ id: 'u1', type: 'users' }] + const result = await getIncidentTool.transformResponse?.( + jsonResponse({ data: { id: 'i1', type: 'incidents', attributes: {} }, included }) + ) + expect(result?.output.included).toEqual(included) + }) +}) diff --git a/apps/sim/tools/datadog/get_incident.ts b/apps/sim/tools/datadog/get_incident.ts index 3f7862da960..3ee71b6ccd8 100644 --- a/apps/sim/tools/datadog/get_incident.ts +++ b/apps/sim/tools/datadog/get_incident.ts @@ -82,6 +82,7 @@ export const getIncidentTool: ToolConfig type: data.data?.type, attributes: data.data?.attributes ?? {}, }, + included: Array.isArray(data.included) ? data.included : [], }, } }, @@ -114,5 +115,10 @@ export const getIncidentTool: ToolConfig }, }, }, + included: { + type: 'array', + description: 'Related resources requested through include (users, attachments)', + optional: true, + }, }, } diff --git a/apps/sim/tools/datadog/get_slo_history.ts b/apps/sim/tools/datadog/get_slo_history.ts index 343902e356b..a42b62089dc 100644 --- a/apps/sim/tools/datadog/get_slo_history.ts +++ b/apps/sim/tools/datadog/get_slo_history.ts @@ -103,6 +103,7 @@ export const getSloHistoryTool: ToolConfig = { type: 'number', required: false, visibility: 'user-or-llm', - description: 'Maximum number of logs to return (e.g., 50, 100, max: 1000)', + description: 'Maximum number of logs to return (default: 50, max: 5000)', }, cursor: { type: 'string', diff --git a/apps/sim/tools/datadog/submit_metrics.ts b/apps/sim/tools/datadog/submit_metrics.ts index b6e33330635..ece0410fc19 100644 --- a/apps/sim/tools/datadog/submit_metrics.ts +++ b/apps/sim/tools/datadog/submit_metrics.ts @@ -13,11 +13,25 @@ import type { ToolConfig } from '@/tools/types' * A metric with no recognized type is submitted without a `type`, letting Datadog * infer it rather than silently mislabeling the series. */ -const METRIC_INTAKE_TYPE = { +const METRIC_INTAKE_TYPE: Readonly> = { count: 1, rate: 2, gauge: 3, -} as const +} + +/** + * Resolves a series `type` to Datadog's intake code. A name maps through + * {@link METRIC_INTAKE_TYPE}; a numeric code (0-3), as a model or upstream block may send + * in Datadog's own encoding, passes through unchanged. + */ +function metricIntakeType(type: unknown): number | undefined { + if (typeof type === 'number') { + return Number.isInteger(type) && type >= 0 && type <= 3 ? type : undefined + } + return typeof type === 'string' && Object.hasOwn(METRIC_INTAKE_TYPE, type) + ? METRIC_INTAKE_TYPE[type] + : undefined +} export const submitMetricsTool: ToolConfig = { id: 'datadog_submit_metrics', @@ -68,7 +82,7 @@ export const submitMetricsTool: ToolConfig filterUndefined({ metric: s.metric, - type: METRIC_INTAKE_TYPE[s.type as keyof typeof METRIC_INTAKE_TYPE], + type: metricIntakeType(s.type), points: s.points?.map((p) => ({ timestamp: p.timestamp, value: p.value })), tags: s.tags, unit: s.unit, diff --git a/apps/sim/tools/datadog/types.ts b/apps/sim/tools/datadog/types.ts index 736e523b035..ecb965bd50e 100644 --- a/apps/sim/tools/datadog/types.ts +++ b/apps/sim/tools/datadog/types.ts @@ -65,7 +65,8 @@ interface MetricPoint { export interface MetricSeries { metric: string - type?: MetricType + /** A type name, or Datadog's numeric `MetricIntakeType` code (0 unspecified, 1 count, 2 rate, 3 gauge). */ + type?: MetricType | number points: MetricPoint[] tags?: string[] unit?: string @@ -145,8 +146,8 @@ export interface CreateEventParams extends DatadogWriteOnlyParams { alertType?: EventAlertType priority?: EventPriority host?: string - /** Comma-separated tags */ - tags?: string + /** Comma-separated tags, or an array when a model or upstream block supplies one */ + tags?: string | string[] aggregationKey?: string sourceTypeName?: string /** Unix timestamp */ @@ -155,6 +156,7 @@ export interface CreateEventParams extends DatadogWriteOnlyParams { interface EventData { id?: number + id_str?: string title?: string text?: string date_happened?: number @@ -213,8 +215,8 @@ export interface CreateMonitorParams extends DatadogBaseParams { type: MonitorType query: string message?: string - /** Comma-separated tags */ - tags?: string + /** Comma-separated tags, or an array when a model or upstream block supplies one */ + tags?: string | string[] /** 1-5 */ priority?: number /** JSON string of MonitorOptions */ @@ -611,6 +613,8 @@ interface SloHistoryData { interface GetSloHistoryOutput { history: SloHistoryData sliValue?: number | null + /** Partial query errors Datadog returns alongside a 200, each `{ error }`. */ + errors?: { error?: string }[] } export interface GetSloHistoryResponse extends ToolResponse { @@ -1102,6 +1106,8 @@ export interface GetIncidentParams extends DatadogBaseParams { interface GetIncidentOutput { incident: IncidentData + /** Related resources Datadog returns for the `include` query param. */ + included?: Record[] } export interface GetIncidentResponse extends ToolResponse { diff --git a/apps/sim/tools/datadog/update_incident.ts b/apps/sim/tools/datadog/update_incident.ts index be5a9f4f965..3374c02bdec 100644 --- a/apps/sim/tools/datadog/update_incident.ts +++ b/apps/sim/tools/datadog/update_incident.ts @@ -132,7 +132,7 @@ export const updateIncidentTool: ToolConfig ({ handle })) } - return { data: { type: 'incidents', id: params.incidentId, attributes } } + return { data: { type: 'incidents', id: String(params.incidentId ?? '').trim(), attributes } } }, }, diff --git a/apps/sim/tools/datadog/update_slo.ts b/apps/sim/tools/datadog/update_slo.ts index 10735e4d1fa..a407ccda25d 100644 --- a/apps/sim/tools/datadog/update_slo.ts +++ b/apps/sim/tools/datadog/update_slo.ts @@ -29,7 +29,7 @@ export const updateSloTool: InternalToolConfig { } ) + it("omits the block's 'All' status, which GitHub would answer with zero runs", () => { + const url = buildRunsUrl({ owner: 'sim', repo: 'sim', status: 'all' }) + expect(new URL(url).searchParams.has('status')).toBe(false) + }) + it('escapes a workflow id so it cannot break out of its path segment', () => { expect(buildRunsUrl({ owner: 'sim', repo: 'sim', workflow_id: 'a/../b' })).toContain( '/actions/workflows/a%2F..%2Fb/runs' @@ -240,6 +245,47 @@ describe('github block wiring', () => { }) expect(mapped).toEqual({ public: false }) }) + + /** + * On a tool call the operation arrives only in the context, and the params are + * the stored tool row merged with the model's arguments. + */ + it('applies a stored block-only field on a tool call', () => { + const mapper = GitHubBlock.tools.config?.params + expect( + mapper?.({ owner: 'o', repo: 'r', fork_name: 'my-fork' }, { operation: 'github_fork_repo' }) + ).toEqual({ name: 'my-fork' }) + expect( + mapper?.({ files: '{}', gist_public: true }, { operation: 'github_create_gist' }) + ).toEqual({ public: true }) + }) + + it('leaves the model argument alone on a tool call when the block field is unset', () => { + const mapped = + GitHubBlock.tools.config?.params?.( + { owner: 'o', repo: 'r', title: 'From the model' }, + { operation: 'github_create_milestone' } + ) ?? {} + expect(Object.keys(mapped)).toHaveLength(0) + }) + + it("sends the Draft and Prerelease dropdowns' strings as booleans", () => { + const mapper = GitHubBlock.tools.config?.params + expect(mapper?.({ operation: 'github_create_pr', draft: 'true' })).toEqual({ draft: true }) + expect( + mapper?.({ operation: 'github_create_release', draft: 'false', prerelease: 'true' }) + ).toEqual({ draft: false, prerelease: true }) + expect(mapper?.({ operation: 'github_fork_repo', default_branch_only: 'true' })).toEqual({ + default_branch_only: true, + }) + }) + + it('keeps a Draft value left from Create Release out of Update Release', () => { + const mapped = + GitHubBlock.tools.config?.params?.({ operation: 'github_update_release', draft: 'false' }) ?? + {} + expect(Object.keys(mapped)).toHaveLength(0) + }) }) /** diff --git a/apps/sim/tools/github/check_star.ts b/apps/sim/tools/github/check_star.ts index 09b729a9d8c..95c872265b0 100644 --- a/apps/sim/tools/github/check_star.ts +++ b/apps/sim/tools/github/check_star.ts @@ -1,3 +1,5 @@ +import { isRecordLike } from '@sim/utils/object' +import { GITHUB_GRAPHQL_URL, githubGraphQlHeaders, readGraphQlData } from '@/tools/github/graphql' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -19,6 +21,31 @@ interface CheckStarResponse { } } +/** + * Asks GraphQL rather than REST: `GET /user/starred/{owner}/{repo}` answers "not + * starred" with a 404, and the executor fails every non-2xx response before a + * transform runs, so the REST form could only ever report `starred: true`. + */ +const VIEWER_HAS_STARRED_QUERY = ` + query($owner: String!, $name: String!) { + repository(owner: $owner, name: $name) { + viewerHasStarred + } + } +` + +async function readViewerHasStarred(response: Response): Promise { + const data = await readGraphQlData(response, 'GitHub check star') + const repository = data.repository + if (!isRecordLike(repository)) { + throw new Error('GitHub check star: repository not found') + } + if (typeof repository.viewerHasStarred !== 'boolean') { + throw new Error('GitHub check star: viewerHasStarred must be a boolean') + } + return repository.viewerHasStarred +} + export const checkStarTool: ToolConfig = { id: 'github_check_star', name: 'GitHub Check Star', @@ -48,17 +75,17 @@ export const checkStarTool: ToolConfig = { }, request: { - url: (params) => `https://api.github.com/user/starred/${params.owner}/${params.repo}`, - method: 'GET', - headers: (params) => ({ - Accept: 'application/vnd.github.v3+json', - Authorization: `Bearer ${params.apiKey}`, - 'X-GitHub-Api-Version': '2022-11-28', + url: GITHUB_GRAPHQL_URL, + method: 'POST', + headers: (params) => githubGraphQlHeaders(params.apiKey), + body: (params) => ({ + query: VIEWER_HAS_STARRED_QUERY, + variables: { owner: params.owner, name: params.repo }, }), }, transformResponse: async (response, params) => { - const starred = response.status === 204 + const starred = await readViewerHasStarred(response) return { success: true, @@ -99,7 +126,7 @@ export const checkStarV2Tool: ToolConfig = { request: checkStarTool.request, transformResponse: async (response: Response, params) => { - const starred = response.status === 204 + const starred = await readViewerHasStarred(response) return { success: true, output: { diff --git a/apps/sim/tools/github/close_issue.ts b/apps/sim/tools/github/close_issue.ts index 4647568fa8d..adf324bf034 100644 --- a/apps/sim/tools/github/close_issue.ts +++ b/apps/sim/tools/github/close_issue.ts @@ -33,7 +33,7 @@ export const closeIssueTool: ToolConfig = { type: 'string', required: false, visibility: 'user-or-llm', - description: 'Reason for closing: completed or not_planned', + description: 'Reason for closing: completed, not_planned, or duplicate', }, apiKey: { type: 'string', diff --git a/apps/sim/tools/github/comment.ts b/apps/sim/tools/github/comment.ts index 2e25907b808..4453233e2a7 100644 --- a/apps/sim/tools/github/comment.ts +++ b/apps/sim/tools/github/comment.ts @@ -51,20 +51,20 @@ export const commentTool: InternalToolConfig request: { url: (params) => - `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${params.path}`, + `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}`, method: 'PUT', headers: (params) => ({ Accept: 'application/vnd.github+json', diff --git a/apps/sim/tools/github/delete_file.ts b/apps/sim/tools/github/delete_file.ts index 212bbeb3de5..14236427a6f 100644 --- a/apps/sim/tools/github/delete_file.ts +++ b/apps/sim/tools/github/delete_file.ts @@ -1,3 +1,4 @@ +import { encodeContentPath } from '@/tools/github/content-path' import type { DeleteFileParams, DeleteFileResponse } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -57,7 +58,7 @@ export const deleteFileTool: ToolConfig = request: { url: (params) => - `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${params.path}`, + `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}`, method: 'DELETE', headers: (params) => ({ Accept: 'application/vnd.github+json', diff --git a/apps/sim/tools/github/get_commit.ts b/apps/sim/tools/github/get_commit.ts index bffc1211a5b..ac2b64bb10c 100644 --- a/apps/sim/tools/github/get_commit.ts +++ b/apps/sim/tools/github/get_commit.ts @@ -43,7 +43,8 @@ interface GetCommitResponse { export const getCommitTool: ToolConfig = { id: 'github_get_commit', name: 'GitHub Get Commit', - description: 'Get detailed information about a specific commit including files changed and stats', + description: + 'Get detailed information about a specific commit including files changed and stats. GitHub returns at most the first 300 changed files of a larger commit.', version: '1.0.0', oauth: GITHUB_CREDENTIAL_OAUTH, diff --git a/apps/sim/tools/github/get_file_content.ts b/apps/sim/tools/github/get_file_content.ts index 0c4f8130ad9..03801c2dcf4 100644 --- a/apps/sim/tools/github/get_file_content.ts +++ b/apps/sim/tools/github/get_file_content.ts @@ -1,5 +1,6 @@ import { truncate } from '@sim/utils/string' import { getFileExtension, getMimeTypeFromExtension } from '@/lib/uploads/utils/file' +import { encodeContentPath } from '@/tools/github/content-path' import type { FileContentResponse, GetFileContentParams } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -47,8 +48,8 @@ export const getFileContentTool: ToolConfig { - const baseUrl = `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${params.path}` - return params.ref ? `${baseUrl}?ref=${params.ref}` : baseUrl + const baseUrl = `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}` + return params.ref ? `${baseUrl}?ref=${encodeURIComponent(params.ref)}` : baseUrl }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/github/get_pr_files.ts b/apps/sim/tools/github/get_pr_files.ts index 1c8bcf669d6..6b9e71ec8b3 100644 --- a/apps/sim/tools/github/get_pr_files.ts +++ b/apps/sim/tools/github/get_pr_files.ts @@ -123,7 +123,8 @@ ${files filename: { type: 'string', description: 'File path' }, status: { type: 'string', - description: 'Change type (added/modified/deleted/renamed)', + description: + 'Change type (added, removed, modified, renamed, copied, changed, unchanged)', }, additions: { type: 'number', description: 'Lines added' }, deletions: { type: 'number', description: 'Lines deleted' }, @@ -134,7 +135,7 @@ ${files }, }, }, - total_count: { type: 'number', description: 'Total number of files changed' }, + total_count: { type: 'number', description: 'Number of files in this page' }, }, }, }, @@ -170,6 +171,6 @@ export const getPRFilesV2Tool: ToolConfig = { properties: PR_FILE_OUTPUT_PROPERTIES, }, }, - count: { type: 'number', description: 'Total number of files' }, + count: { type: 'number', description: 'Number of files in this page' }, }, } diff --git a/apps/sim/tools/github/get_project.ts b/apps/sim/tools/github/get_project.ts index 28ba1eb0338..a16a96b5e14 100644 --- a/apps/sim/tools/github/get_project.ts +++ b/apps/sim/tools/github/get_project.ts @@ -2,6 +2,18 @@ import type { GetProjectParams, ProjectResponse } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +/** + * GraphQL rejects a string for `Int!`, and the block's short-input stores the + * project number as text, so it is converted before it becomes a variable. + */ +function toProjectNumber(value: unknown): number { + const parsed = typeof value === 'string' ? Number(value.trim()) : value + if (typeof parsed !== 'number' || !Number.isInteger(parsed) || parsed < 1) { + throw new Error(`project_number must be a positive integer, but was ${String(value)}`) + } + return parsed +} + export const getProjectTool: ToolConfig = { id: 'github_get_project', name: 'GitHub Get Project', @@ -68,7 +80,7 @@ export const getProjectTool: ToolConfig = { query, variables: { login: params.owner_login, - number: params.project_number, + number: toProjectNumber(params.project_number), }, } }, diff --git a/apps/sim/tools/github/get_tree.ts b/apps/sim/tools/github/get_tree.ts index b0a50518f94..67243417db2 100644 --- a/apps/sim/tools/github/get_tree.ts +++ b/apps/sim/tools/github/get_tree.ts @@ -1,3 +1,4 @@ +import { encodeContentPath } from '@/tools/github/content-path' import type { GetTreeParams, TreeResponse } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -47,8 +48,8 @@ export const getTreeTool: ToolConfig = { request: { url: (params) => { const path = params.path || '' - const baseUrl = `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${path}` - return params.ref ? `${baseUrl}?ref=${params.ref}` : baseUrl + const baseUrl = `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(path)}` + return params.ref ? `${baseUrl}?ref=${encodeURIComponent(params.ref)}` : baseUrl }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/github/get_workflow.ts b/apps/sim/tools/github/get_workflow.ts index 22f7ba0dc3a..4c94729bc53 100644 --- a/apps/sim/tools/github/get_workflow.ts +++ b/apps/sim/tools/github/get_workflow.ts @@ -84,7 +84,11 @@ Updated: ${data.updated_at}` id: { type: 'number', description: 'Workflow ID' }, name: { type: 'string', description: 'Workflow name' }, path: { type: 'string', description: 'Path to workflow file' }, - state: { type: 'string', description: 'Workflow state (active/disabled)' }, + state: { + type: 'string', + description: + 'Workflow state (active, deleted, disabled_fork, disabled_inactivity, disabled_manually)', + }, badge_url: { type: 'string', description: 'Badge URL for workflow' }, }, }, diff --git a/apps/sim/tools/github/latest_commit.ts b/apps/sim/tools/github/latest_commit.ts index f1b0861db63..3fac0c6c192 100644 --- a/apps/sim/tools/github/latest_commit.ts +++ b/apps/sim/tools/github/latest_commit.ts @@ -79,9 +79,13 @@ export const latestCommitV2Tool: InternalToolConfig = { sha: metadata.sha ?? '', html_url: metadata.html_url ?? '', commit: { + url: metadata.commit_url ?? null, message: metadata.commit_message ?? '', + comment_count: metadata.comment_count ?? null, author: metadata.author ?? null, committer: metadata.committer ?? null, + tree: metadata.tree ?? null, + verification: metadata.verification ?? null, }, author: metadata.author ?? null, committer: metadata.committer ?? null, diff --git a/apps/sim/tools/github/list_issue_comments.ts b/apps/sim/tools/github/list_issue_comments.ts index e000ea4825d..a04451e4795 100644 --- a/apps/sim/tools/github/list_issue_comments.ts +++ b/apps/sim/tools/github/list_issue_comments.ts @@ -87,7 +87,7 @@ export const listIssueCommentsTool: ToolConfig - `- ${c.user.login} (${new Date(c.created_at).toLocaleDateString()}): "${truncate(c.body, 80)}"` + `- ${c.user?.login ?? 'unknown'} (${new Date(c.created_at).toLocaleDateString()}): "${truncate(c.body ?? '', 80)}"` ) .join('\n')}` : '' @@ -101,7 +101,7 @@ export const listIssueCommentsTool: ToolConfig ({ id: comment.id, body: comment.body, - user: { login: comment.user.login }, + user: { login: comment.user?.login ?? null }, created_at: comment.created_at, html_url: comment.html_url, })), diff --git a/apps/sim/tools/github/list_pr_comments.ts b/apps/sim/tools/github/list_pr_comments.ts index f1b2db9c66d..02762af3a08 100644 --- a/apps/sim/tools/github/list_pr_comments.ts +++ b/apps/sim/tools/github/list_pr_comments.ts @@ -103,7 +103,7 @@ export const listPRCommentsTool: ToolConfig - `- ${c.user.login} on ${c.path}${c.line ? `:${c.line}` : ''} (${new Date(c.created_at).toLocaleDateString()}): "${truncate(c.body, 80)}"` + `- ${c.user?.login ?? 'unknown'} on ${c.path}${c.line ? `:${c.line}` : ''} (${new Date(c.created_at).toLocaleDateString()}): "${truncate(c.body ?? '', 80)}"` ) .join('\n')}` : '' @@ -117,7 +117,7 @@ export const listPRCommentsTool: ToolConfig ({ id: comment.id, body: comment.body, - user: { login: comment.user.login }, + user: { login: comment.user?.login ?? null }, created_at: comment.created_at, html_url: comment.html_url, })), diff --git a/apps/sim/tools/github/list_workflow_runs.ts b/apps/sim/tools/github/list_workflow_runs.ts index eb2ff5eb00b..e61dd01d79f 100644 --- a/apps/sim/tools/github/list_workflow_runs.ts +++ b/apps/sim/tools/github/list_workflow_runs.ts @@ -59,7 +59,8 @@ export const listWorkflowRunsTool: ToolConfig { const files: GitHubPullRequestFile[] = [] const maxPages = MAX_PULL_REQUEST_FILES / PULL_REQUEST_FILES_PER_PAGE + let remainingBytes = MAX_BUFFERED_TRANSFER_BYTES for (let page = 1; page <= maxPages; page += 1) { + signal?.throwIfAborted() const response = await outboundFetch( `https://api.github.com/repos/${params.owner}/${params.repo}/pulls/${pullNumber}/files?per_page=${PULL_REQUEST_FILES_PER_PAGE}&page=${page}`, { @@ -159,6 +172,7 @@ async function fetchPullRequestFiles( Authorization: `Bearer ${params.apiKey}`, 'X-GitHub-Api-Version': '2022-11-28', }, + signal, } ) @@ -171,7 +185,13 @@ async function fetchPullRequestFiles( } } - const value: unknown = await response.json() + const text = await readResponseTextWithLimit(response, { + maxBytes: Math.min(MAX_TOOL_RESPONSE_BODY_BYTES, remainingBytes), + label: 'GitHub pull request files response', + signal, + }) + remainingBytes -= Buffer.byteLength(text) + const value: unknown = JSON.parse(text) const pageFiles = parsePullRequestFiles(value) if (pageFiles.length > PULL_REQUEST_FILES_PER_PAGE) { throw new Error( @@ -236,10 +256,10 @@ export const prTool: ToolConfig = { }), }, - transformResponse: async (response, params) => { + transformResponse: async (response, params, context) => { const requestParams = requireParams(params) const pr = await parsePullRequestResponse(response) - const filesResult = await fetchPullRequestFiles(requestParams, pr.number) + const filesResult = await fetchPullRequestFiles(requestParams, pr.number, context?.signal) if (!filesResult.success) { return { @@ -346,12 +366,12 @@ export const prV2Tool: ToolConfig = }, request: prTool.request, - transformResponse: async (response: Response, params) => { + transformResponse: async (response: Response, params, context) => { const requestParams = requireParams(params) const pr = await parsePullRequestResponse(response) if (requestParams.includeFiles !== false) { - const filesResult = await fetchPullRequestFiles(requestParams, pr.number) + const filesResult = await fetchPullRequestFiles(requestParams, pr.number, context?.signal) if (!filesResult.success) { return { success: false, diff --git a/apps/sim/tools/github/request-coercions.test.ts b/apps/sim/tools/github/request-coercions.test.ts new file mode 100644 index 00000000000..59621b209c2 --- /dev/null +++ b/apps/sim/tools/github/request-coercions.test.ts @@ -0,0 +1,186 @@ +import { describe, expect, it, vi } from 'vitest' +import { checkStarTool, checkStarV2Tool } from '@/tools/github/check_star' +import { getFileContentTool } from '@/tools/github/get_file_content' +import { getProjectTool } from '@/tools/github/get_project' +import { listIssueCommentsTool } from '@/tools/github/list_issue_comments' +import { prV2Tool } from '@/tools/github/pr' +import { triggerWorkflowTool } from '@/tools/github/trigger_workflow' +import { updatePRTool } from '@/tools/github/update_pr' +import { updateProjectTool } from '@/tools/github/update_project' +import type { ToolConfig } from '@/tools/types' + +function body(tool: ToolConfig, params: Record): Record { + const built = tool.request.body?.(params) + if (!built || typeof built !== 'object' || built instanceof FormData) { + throw new Error(`${tool.id} built no JSON body`) + } + return built +} + +function url(tool: ToolConfig, params: Record): string { + const { url: builder } = tool.request + return typeof builder === 'function' ? builder(params) : builder +} + +describe('github_check_star', () => { + const params = { owner: 'octo', repo: 'demo', apiKey: 'ghp_test' } + + /** + * GitHub's REST check answers "not starred" with a 404, which the executor + * fails before any transform runs, so the answer has to come from a 200. + */ + it.each([true, false])('reports viewerHasStarred=%s from a 200 response', async (starred) => { + expect(body(checkStarTool, params).variables).toEqual({ owner: 'octo', name: 'demo' }) + const response = () => Response.json({ data: { repository: { viewerHasStarred: starred } } }) + + const v1 = await checkStarTool.transformResponse?.(response(), params) + const v2 = await checkStarV2Tool.transformResponse?.(response(), params) + + expect(v1?.output.metadata.starred).toBe(starred) + expect(v2?.output.starred).toBe(starred) + }) + + it('fails rather than reporting false for a repository GitHub cannot resolve', async () => { + const response = Response.json({ + data: { repository: null }, + errors: [{ message: "Could not resolve to a Repository with the name 'octo/nope'." }], + }) + await expect(checkStarV2Tool.transformResponse?.(response, params)).rejects.toThrow( + 'Could not resolve' + ) + }) +}) + +describe('GitHub Projects GraphQL variables', () => { + it('sends the short-input project number as the Int GraphQL requires', () => { + const variables = body(getProjectTool, { + owner_type: 'org', + owner_login: 'octo', + project_number: '1', + apiKey: 'k', + }).variables + expect(variables).toEqual({ login: 'octo', number: 1 }) + }) + + it('rejects a project number that is not a positive integer', () => { + expect(() => + body(getProjectTool, { owner_type: 'org', owner_login: 'o', project_number: '1.5' }) + ).toThrow('positive integer') + }) + + it("sends the Public dropdown's string as the Boolean GraphQL requires", () => { + const built = body(updateProjectTool, { project_id: 'PVT_1', project_public: 'false' }) + expect(built.variables).toEqual({ projectId: 'PVT_1', project_public: false }) + }) + + it('leaves visibility out of the mutation for the "No change" option', () => { + const built = body(updateProjectTool, { project_id: 'PVT_1', title: 'T', project_public: '' }) + expect(built.variables).toEqual({ projectId: 'PVT_1', title: 'T' }) + expect(built.query).not.toContain('$project_public') + }) +}) + +describe('github_trigger_workflow inputs', () => { + const base = { owner: 'o', repo: 'r', workflow_id: 'ci.yml', ref: 'main' } + + it('parses the long-input JSON text into the object GitHub requires', () => { + expect(body(triggerWorkflowTool, { ...base, inputs: '{"env":"prod"}' }).inputs).toEqual({ + env: 'prod', + }) + }) + + it("passes a model's object through and sends no inputs for blank text", () => { + expect(body(triggerWorkflowTool, { ...base, inputs: { env: 'dev' } }).inputs).toEqual({ + env: 'dev', + }) + expect(body(triggerWorkflowTool, { ...base, inputs: ' ' })).not.toHaveProperty('inputs') + }) + + it.each(['not json', '["a"]'])('rejects %j as workflow inputs', (inputs) => { + expect(() => body(triggerWorkflowTool, { ...base, inputs })).toThrow('JSON object') + }) +}) + +describe('github_get_file_content URL', () => { + it('keeps a # in the path and a + in the ref inside their URL parts', () => { + const built = new URL( + url(getFileContentTool, { owner: 'o', repo: 'r', path: 'docs/a#b.md', ref: 'feat+x' }) + ) + expect(built.pathname).toBe('/repos/o/r/contents/docs/a%23b.md') + expect(built.searchParams.get('ref')).toBe('feat+x') + }) +}) + +describe('github_list_issue_comments', () => { + it('lists a comment whose author account is gone', async () => { + const response = Response.json([ + { + id: 1, + body: 'hello', + user: null, + created_at: '2026-01-01T00:00:00Z', + html_url: 'https://github.com/o/r/issues/1#c1', + }, + ]) + const result = await listIssueCommentsTool.transformResponse?.(response) + expect(result?.output.metadata.comments[0].user).toEqual({ login: null }) + }) +}) + +describe('github_update_pr state', () => { + it('sends no state for the "No change" option', () => { + expect( + body(updatePRTool, { owner: 'o', repo: 'r', pullNumber: 1, state: '' }) + ).not.toHaveProperty('state') + }) +}) + +describe('github_pr_v2 changed files', () => { + it('stops before fetching file pages once the run is aborted', async () => { + const filesFetch = vi.fn() + vi.stubGlobal('fetch', filesFetch) + const controller = new AbortController() + controller.abort() + const pr = Response.json({ + id: 1, + number: 7, + title: 'T', + state: 'open', + html_url: 'https://github.com/o/r/pull/7', + diff_url: 'https://github.com/o/r/pull/7.diff', + body: null, + user: { + login: 'o', + id: 2, + avatar_url: 'https://avatars.githubusercontent.com/u/2', + html_url: 'https://github.com/o', + type: 'User', + }, + head: { label: 'o:f', sha: 'a'.repeat(40), ref: 'f' }, + base: { label: 'o:main', sha: 'b'.repeat(40), ref: 'main' }, + merged: false, + mergeable: true, + merged_by: null, + comments: 0, + review_comments: 0, + commits: 1, + additions: 1, + deletions: 1, + changed_files: 1, + created_at: '2026-01-01T00:00:00Z', + updated_at: '2026-01-01T00:00:00Z', + closed_at: null, + merged_at: null, + }) + + await expect( + prV2Tool.transformResponse?.( + pr, + { owner: 'o', repo: 'r', pullNumber: 7, apiKey: 'k' }, + { signal: controller.signal } + ) + ).rejects.toThrow() + expect(filesFetch).not.toHaveBeenCalled() + vi.unstubAllGlobals() + }) +}) diff --git a/apps/sim/tools/github/search_code.ts b/apps/sim/tools/github/search_code.ts index 79bd09a4756..4542b2027c1 100644 --- a/apps/sim/tools/github/search_code.ts +++ b/apps/sim/tools/github/search_code.ts @@ -51,13 +51,15 @@ export const searchCodeTool: ToolConfig = type: 'string', required: false, visibility: 'user-or-llm', - description: 'Sort by indexed date (default: best match)', + description: + 'Sort by "indexed" (how recently GitHub indexed the file); default is best match. GitHub has deprecated this parameter and is closing it down.', }, order: { type: 'string', required: false, visibility: 'user-or-llm', - description: 'Sort order: asc or desc (default: desc)', + description: + 'Sort order: asc or desc (default: desc). Ignored unless sort is set; GitHub has deprecated this parameter and is closing it down.', }, per_page: { type: 'number', @@ -93,7 +95,7 @@ export const searchCodeTool: ToolConfig = }, method: 'GET', headers: (params) => ({ - Accept: 'application/vnd.github.v3+json', + Accept: 'application/vnd.github.text-match+json', Authorization: `Bearer ${params.apiKey}`, 'X-GitHub-Api-Version': '2022-11-28', }), diff --git a/apps/sim/tools/github/trigger_workflow.ts b/apps/sim/tools/github/trigger_workflow.ts index b6e49d919b7..a40392104aa 100644 --- a/apps/sim/tools/github/trigger_workflow.ts +++ b/apps/sim/tools/github/trigger_workflow.ts @@ -1,7 +1,31 @@ +import { isRecordLike } from '@sim/utils/object' import type { TriggerWorkflowParams, TriggerWorkflowResponse } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +/** + * GitHub requires `inputs` to be a JSON object, but the block's long-input + * stores the JSON as text, so a string is parsed here. A model's object passes + * through unchanged; a blank value sends no inputs. + */ +function toWorkflowInputs(value: unknown): Record | undefined { + if (value === undefined || value === null) return undefined + let parsed: unknown = value + if (typeof value === 'string') { + const trimmed = value.trim() + if (!trimmed) return undefined + try { + parsed = JSON.parse(trimmed) + } catch { + throw new Error('Workflow inputs must be a JSON object, such as {"environment":"prod"}') + } + } + if (!isRecordLike(parsed)) { + throw new Error('Workflow inputs must be a JSON object, such as {"environment":"prod"}') + } + return parsed +} + export const triggerWorkflowTool: ToolConfig = { id: 'github_trigger_workflow', name: 'GitHub Trigger Workflow', @@ -58,14 +82,17 @@ export const triggerWorkflowTool: ToolConfig ({ - ref: params.ref, - ...(params.inputs && { inputs: params.inputs }), - }), + body: (params) => { + const inputs = toWorkflowInputs(params.inputs) + return { + ref: params.ref, + ...(inputs && { inputs }), + } + }, }, - transformResponse: async (response) => { - const content = `Workflow dispatched successfully on ref: ${response.url.includes('ref') ? 'requested ref' : 'default branch'} + transformResponse: async (_response, params) => { + const content = `Workflow dispatched successfully on ref: ${params?.ref ?? 'requested ref'} The workflow run should start shortly.` return { diff --git a/apps/sim/tools/github/types.ts b/apps/sim/tools/github/types.ts index 65d6a7a816e..007697d7ce2 100644 --- a/apps/sim/tools/github/types.ts +++ b/apps/sim/tools/github/types.ts @@ -1047,22 +1047,39 @@ interface CommentMetadata { commit_id?: string } +/** + * A commit's author or committer: the git identity (name, email, date) merged + * with the linked GitHub account's fields when the commit has one. + */ +interface CommitActorMetadata { + name: string + email?: string + date?: string + login: string + avatar_url: string + html_url: string + id?: number + node_id?: string + type?: string + url?: string + site_admin?: boolean +} + interface CommitMetadata { sha: string html_url: string commit_message: string - author: { - name: string - login: string - avatar_url: string - html_url: string - } - committer: { - name: string - login: string - avatar_url: string - html_url: string + commit_url?: string + comment_count?: number + tree?: { sha: string; url: string } + verification?: { + verified: boolean + reason: string + signature?: string | null + payload?: string | null } + author: CommitActorMetadata + committer: CommitActorMetadata stats?: { additions: number deletions: number diff --git a/apps/sim/tools/github/update_file.ts b/apps/sim/tools/github/update_file.ts index b4f6e9d6614..e26785a1e0a 100644 --- a/apps/sim/tools/github/update_file.ts +++ b/apps/sim/tools/github/update_file.ts @@ -1,3 +1,4 @@ +import { encodeContentPath } from '@/tools/github/content-path' import type { FileOperationResponse, UpdateFileParams } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -63,7 +64,7 @@ export const updateFileTool: ToolConfig request: { url: (params) => - `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${params.path}`, + `https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}`, method: 'PUT', headers: (params) => ({ Accept: 'application/vnd.github+json', diff --git a/apps/sim/tools/github/update_issue.ts b/apps/sim/tools/github/update_issue.ts index 54f1e6de3e1..b3d3571194e 100644 --- a/apps/sim/tools/github/update_issue.ts +++ b/apps/sim/tools/github/update_issue.ts @@ -85,7 +85,7 @@ export const updateIssueTool: ToolConfig = { const body: any = {} if (params.title !== undefined) body.title = params.title if (params.body !== undefined) body.body = params.body - if (params.state !== undefined) body.state = params.state + if (params.state) body.state = params.state if (params.labels !== undefined) body.labels = params.labels if (params.assignees !== undefined) body.assignees = params.assignees return body diff --git a/apps/sim/tools/github/update_pr.ts b/apps/sim/tools/github/update_pr.ts index 48fa97495d4..38e12e346b0 100644 --- a/apps/sim/tools/github/update_pr.ts +++ b/apps/sim/tools/github/update_pr.ts @@ -73,7 +73,7 @@ export const updatePRTool: ToolConfig = { const body: Record = {} if (params.title !== undefined) body.title = params.title if (params.body !== undefined) body.body = params.body - if (params.state !== undefined) body.state = params.state + if (params.state) body.state = params.state if (params.base !== undefined) body.base = params.base return body }, diff --git a/apps/sim/tools/github/update_project.ts b/apps/sim/tools/github/update_project.ts index 48b2439727d..4a266c74b51 100644 --- a/apps/sim/tools/github/update_project.ts +++ b/apps/sim/tools/github/update_project.ts @@ -2,6 +2,22 @@ import type { ProjectResponse, UpdateProjectParams } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +/** + * GraphQL rejects a string for a `Boolean` variable, and the block's dropdown + * stores `'true'`/`'false'`. An empty value is the "No change" option. + */ +function toOptionalBoolean(value: unknown, name: string): boolean | undefined { + if (value === undefined || value === null || value === '') return undefined + if (typeof value === 'boolean') return value + if (typeof value === 'string') { + const normalized = value.trim().toLowerCase() + if (normalized === 'true') return true + if (normalized === 'false') return false + if (normalized === '') return undefined + } + throw new Error(`${name} must be true or false, but was ${String(value)}`) +} + export const updateProjectTool: ToolConfig = { id: 'github_update_project', name: 'GitHub Update Project', @@ -70,20 +86,22 @@ export const updateProjectTool: ToolConfig inputFields.push('shortDescription: $shortDescription') variables.shortDescription = params.shortDescription } - if (params.project_public !== undefined) { + const projectPublic = toOptionalBoolean(params.project_public, 'project_public') + const closed = toOptionalBoolean(params.closed, 'closed') + if (projectPublic !== undefined) { inputFields.push('public: $project_public') - variables.project_public = params.project_public + variables.project_public = projectPublic } - if (params.closed !== undefined) { + if (closed !== undefined) { inputFields.push('closed: $closed') - variables.closed = params.closed + variables.closed = closed } const variableDefs = ['$projectId: ID!'] if (params.title !== undefined) variableDefs.push('$title: String') if (params.shortDescription !== undefined) variableDefs.push('$shortDescription: String') - if (params.project_public !== undefined) variableDefs.push('$project_public: Boolean') - if (params.closed !== undefined) variableDefs.push('$closed: Boolean') + if (projectPublic !== undefined) variableDefs.push('$project_public: Boolean') + if (closed !== undefined) variableDefs.push('$closed: Boolean') const query = ` mutation(${variableDefs.join(', ')}) { diff --git a/apps/sim/tools/gitlab/add_member.ts b/apps/sim/tools/gitlab/add_member.ts index 368b741e47a..8491ab3a2ae 100644 --- a/apps/sim/tools/gitlab/add_member.ts +++ b/apps/sim/tools/gitlab/add_member.ts @@ -53,7 +53,7 @@ export const gitlabAddMemberTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.groupId).trim()) + const encodedId = encodeGitLabResourceId(params.groupId) return `${getGitLabApiBase(params.host)}/groups/${encodedId}/saml_group_links` }, method: 'POST', diff --git a/apps/sim/tools/gitlab/approve_access_request.ts b/apps/sim/tools/gitlab/approve_access_request.ts index 14a333de0a7..10cc89b8923 100644 --- a/apps/sim/tools/gitlab/approve_access_request.ts +++ b/apps/sim/tools/gitlab/approve_access_request.ts @@ -5,6 +5,7 @@ import type { import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabApproveAccessRequestTool: ToolConfig< GitLabApproveAccessRequestParams, @@ -67,7 +68,7 @@ export const gitlabApproveAccessRequestTool: ToolConfig< } const query = queryParams.toString() - return `${getGitLabApiBase(params.host)}/${resourcePath}/access_requests/${params.userId}/approve${query ? `?${query}` : ''}` + return `${getGitLabApiBase(params.host)}/${resourcePath}/access_requests/${safeUrlPathSegment(params.userId, 'userId')}/approve${query ? `?${query}` : ''}` }, method: 'PUT', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/approve_merge_request.ts b/apps/sim/tools/gitlab/approve_merge_request.ts index 4cd4796317d..761f3cb9f02 100644 --- a/apps/sim/tools/gitlab/approve_merge_request.ts +++ b/apps/sim/tools/gitlab/approve_merge_request.ts @@ -2,9 +2,10 @@ import type { GitLabApproveMergeRequestParams, GitLabApproveMergeRequestResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabApproveMergeRequestTool: ToolConfig< GitLabApproveMergeRequestParams, @@ -52,8 +53,8 @@ export const gitlabApproveMergeRequestTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}/approve` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}/approve` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/cancel_pipeline.ts b/apps/sim/tools/gitlab/cancel_pipeline.ts index 5a4428cf604..8b7465bc899 100644 --- a/apps/sim/tools/gitlab/cancel_pipeline.ts +++ b/apps/sim/tools/gitlab/cancel_pipeline.ts @@ -1,7 +1,8 @@ import type { GitLabCancelPipelineParams, GitLabCancelPipelineResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabCancelPipelineTool: ToolConfig< GitLabCancelPipelineParams, @@ -43,8 +44,8 @@ export const gitlabCancelPipelineTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${params.pipelineId}/cancel` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${safeUrlPathSegment(params.pipelineId, 'pipelineId')}/cancel` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/compare_branches.ts b/apps/sim/tools/gitlab/compare_branches.ts index 917605d1920..0baba9a096b 100644 --- a/apps/sim/tools/gitlab/compare_branches.ts +++ b/apps/sim/tools/gitlab/compare_branches.ts @@ -2,7 +2,7 @@ import type { GitLabCompareBranchesParams, GitLabCompareBranchesResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -70,7 +70,7 @@ export const gitlabCompareBranchesTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() queryParams.append('from', params.from) queryParams.append('to', params.to) diff --git a/apps/sim/tools/gitlab/create_branch.ts b/apps/sim/tools/gitlab/create_branch.ts index af66dbbf1fc..b329df73875 100644 --- a/apps/sim/tools/gitlab/create_branch.ts +++ b/apps/sim/tools/gitlab/create_branch.ts @@ -1,5 +1,5 @@ import type { GitLabCreateBranchParams, GitLabCreateBranchResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -49,7 +49,7 @@ export const gitlabCreateBranchTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() queryParams.append('branch', String(params.branch)) queryParams.append('ref', String(params.ref)) diff --git a/apps/sim/tools/gitlab/create_file.ts b/apps/sim/tools/gitlab/create_file.ts index f158abee34a..7490dfe64b5 100644 --- a/apps/sim/tools/gitlab/create_file.ts +++ b/apps/sim/tools/gitlab/create_file.ts @@ -1,5 +1,5 @@ import type { GitLabCreateFileParams, GitLabCreateFileResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -82,7 +82,7 @@ export const gitlabCreateFileTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const encodedPath = encodeURIComponent(String(params.filePath)) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/repository/files/${encodedPath}` }, diff --git a/apps/sim/tools/gitlab/create_issue.ts b/apps/sim/tools/gitlab/create_issue.ts index 0cf6cf805e5..7db495c7164 100644 --- a/apps/sim/tools/gitlab/create_issue.ts +++ b/apps/sim/tools/gitlab/create_issue.ts @@ -1,5 +1,5 @@ import type { GitLabCreateIssueParams, GitLabCreateIssueResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -77,7 +77,7 @@ export const gitlabCreateIssueTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues` }, method: 'POST', @@ -86,7 +86,7 @@ export const gitlabCreateIssueTool: ToolConfig { - const body: Record = { + const body: Record = { title: params.title, } diff --git a/apps/sim/tools/gitlab/create_issue_note.ts b/apps/sim/tools/gitlab/create_issue_note.ts index 322bb927977..8d94cad5d85 100644 --- a/apps/sim/tools/gitlab/create_issue_note.ts +++ b/apps/sim/tools/gitlab/create_issue_note.ts @@ -1,7 +1,8 @@ import type { GitLabCreateIssueNoteParams, GitLabCreateNoteResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabCreateIssueNoteTool: ToolConfig< GitLabCreateIssueNoteParams, @@ -55,8 +56,8 @@ export const gitlabCreateIssueNoteTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${params.issueIid}/notes` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${safeUrlPathSegment(params.issueIid, 'issueIid')}/notes` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/create_merge_request.ts b/apps/sim/tools/gitlab/create_merge_request.ts index 6f65b6d86ec..3bdd986fcd0 100644 --- a/apps/sim/tools/gitlab/create_merge_request.ts +++ b/apps/sim/tools/gitlab/create_merge_request.ts @@ -2,7 +2,7 @@ import type { GitLabCreateMergeRequestParams, GitLabCreateMergeRequestResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -100,7 +100,7 @@ export const gitlabCreateMergeRequestTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests` }, method: 'POST', @@ -115,7 +115,7 @@ export const gitlabCreateMergeRequestTool: ToolConfig< params.draft === true && !/^\s*draft:/i.test(params.title) ? `Draft: ${params.title}` : params.title - const body: Record = { + const body: Record = { source_branch: params.sourceBranch, target_branch: params.targetBranch, title, diff --git a/apps/sim/tools/gitlab/create_merge_request_note.ts b/apps/sim/tools/gitlab/create_merge_request_note.ts index ef96ce25fe6..22756db70b6 100644 --- a/apps/sim/tools/gitlab/create_merge_request_note.ts +++ b/apps/sim/tools/gitlab/create_merge_request_note.ts @@ -2,9 +2,10 @@ import type { GitLabCreateMergeRequestNoteParams, GitLabCreateNoteResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabCreateMergeRequestNoteTool: ToolConfig< GitLabCreateMergeRequestNoteParams, @@ -58,8 +59,8 @@ export const gitlabCreateMergeRequestNoteTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}/notes` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}/notes` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/create_pipeline.ts b/apps/sim/tools/gitlab/create_pipeline.ts index cb4b703e06f..e812d18c4d1 100644 --- a/apps/sim/tools/gitlab/create_pipeline.ts +++ b/apps/sim/tools/gitlab/create_pipeline.ts @@ -1,5 +1,5 @@ import type { GitLabCreatePipelineParams, GitLabCreatePipelineResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -56,7 +56,7 @@ export const gitlabCreatePipelineTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipeline` }, method: 'POST', @@ -65,7 +65,7 @@ export const gitlabCreatePipelineTool: ToolConfig< 'PRIVATE-TOKEN': params.accessToken, }), body: (params) => { - const body: Record = { + const body: Record = { ref: params.ref, } diff --git a/apps/sim/tools/gitlab/create_release.ts b/apps/sim/tools/gitlab/create_release.ts index 0a70273c7bc..720a8271396 100644 --- a/apps/sim/tools/gitlab/create_release.ts +++ b/apps/sim/tools/gitlab/create_release.ts @@ -1,5 +1,5 @@ import type { GitLabCreateReleaseParams, GitLabCreateReleaseResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -86,7 +86,7 @@ export const gitlabCreateReleaseTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/releases` }, method: 'POST', diff --git a/apps/sim/tools/gitlab/delete_branch.ts b/apps/sim/tools/gitlab/delete_branch.ts index 4d2ebee1660..e5bfea6c6a4 100644 --- a/apps/sim/tools/gitlab/delete_branch.ts +++ b/apps/sim/tools/gitlab/delete_branch.ts @@ -1,7 +1,8 @@ import type { GitLabDeleteBranchParams, GitLabDeleteBranchResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDeleteBranchTool: ToolConfig< GitLabDeleteBranchParams, @@ -43,8 +44,8 @@ export const gitlabDeleteBranchTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - const encodedBranch = encodeURIComponent(String(params.branch).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) + const encodedBranch = safeUrlPathSegment(params.branch, 'branch', { allowSeparators: true }) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/repository/branches/${encodedBranch}` }, method: 'DELETE', diff --git a/apps/sim/tools/gitlab/delete_issue.ts b/apps/sim/tools/gitlab/delete_issue.ts index 680f9e9581d..b5b58249d47 100644 --- a/apps/sim/tools/gitlab/delete_issue.ts +++ b/apps/sim/tools/gitlab/delete_issue.ts @@ -1,7 +1,8 @@ import type { GitLabDeleteIssueParams, GitLabDeleteIssueResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDeleteIssueTool: ToolConfig = { @@ -41,8 +42,8 @@ export const gitlabDeleteIssueTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${params.issueIid}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${safeUrlPathSegment(params.issueIid, 'issueIid')}` }, method: 'DELETE', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/delete_saml_group_link.ts b/apps/sim/tools/gitlab/delete_saml_group_link.ts index 90ff607eae4..f1e1153d028 100644 --- a/apps/sim/tools/gitlab/delete_saml_group_link.ts +++ b/apps/sim/tools/gitlab/delete_saml_group_link.ts @@ -2,9 +2,10 @@ import type { GitLabDeleteSamlGroupLinkParams, GitLabDeleteSamlGroupLinkResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDeleteSamlGroupLinkTool: ToolConfig< GitLabDeleteSamlGroupLinkParams, @@ -53,8 +54,10 @@ export const gitlabDeleteSamlGroupLinkTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.groupId).trim()) - const encodedName = encodeURIComponent(String(params.samlGroupName).trim()) + const encodedId = encodeGitLabResourceId(params.groupId) + const encodedName = safeUrlPathSegment(params.samlGroupName, 'samlGroupName', { + allowSeparators: true, + }) const queryParams = new URLSearchParams() if (params.provider) queryParams.append('provider', params.provider.trim()) const query = queryParams.toString() diff --git a/apps/sim/tools/gitlab/delete_user.ts b/apps/sim/tools/gitlab/delete_user.ts index 08c412b2603..d8a0c3fcff1 100644 --- a/apps/sim/tools/gitlab/delete_user.ts +++ b/apps/sim/tools/gitlab/delete_user.ts @@ -2,6 +2,7 @@ import type { GitLabDeleteUserParams, GitLabDeleteUserResponse } from '@/tools/g import { getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDeleteUserTool: ToolConfig = { id: 'gitlab_delete_user', @@ -47,7 +48,7 @@ export const gitlabDeleteUserTool: ToolConfig ({ diff --git a/apps/sim/tools/gitlab/delete_user_identity.ts b/apps/sim/tools/gitlab/delete_user_identity.ts index 0cffe6a2817..c70bfd56fbc 100644 --- a/apps/sim/tools/gitlab/delete_user_identity.ts +++ b/apps/sim/tools/gitlab/delete_user_identity.ts @@ -5,6 +5,7 @@ import type { import { getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDeleteUserIdentityTool: ToolConfig< GitLabDeleteUserIdentityParams, @@ -47,8 +48,10 @@ export const gitlabDeleteUserIdentityTool: ToolConfig< request: { url: (params) => { - const encodedProvider = encodeURIComponent(String(params.provider).trim()) - return `${getGitLabApiBase(params.host)}/users/${params.userId}/identities/${encodedProvider}` + const encodedProvider = safeUrlPathSegment(params.provider, 'provider', { + allowSeparators: true, + }) + return `${getGitLabApiBase(params.host)}/users/${safeUrlPathSegment(params.userId, 'userId')}/identities/${encodedProvider}` }, method: 'DELETE', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/deny_access_request.ts b/apps/sim/tools/gitlab/deny_access_request.ts index 48d43a6114e..11d6fd347b9 100644 --- a/apps/sim/tools/gitlab/deny_access_request.ts +++ b/apps/sim/tools/gitlab/deny_access_request.ts @@ -5,6 +5,7 @@ import type { import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabDenyAccessRequestTool: ToolConfig< GitLabDenyAccessRequestParams, @@ -53,7 +54,7 @@ export const gitlabDenyAccessRequestTool: ToolConfig< request: { url: (params) => { const resourcePath = getGitLabResourcePath(params.resourceType, params.resourceId) - return `${getGitLabApiBase(params.host)}/${resourcePath}/access_requests/${params.userId}` + return `${getGitLabApiBase(params.host)}/${resourcePath}/access_requests/${safeUrlPathSegment(params.userId, 'userId')}` }, method: 'DELETE', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_file.ts b/apps/sim/tools/gitlab/get_file.ts index a071267d432..bccd6520e81 100644 --- a/apps/sim/tools/gitlab/get_file.ts +++ b/apps/sim/tools/gitlab/get_file.ts @@ -1,5 +1,5 @@ import type { GitLabGetFileParams, GitLabGetFileResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -46,7 +46,7 @@ export const gitlabGetFileTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const encodedPath = encodeURIComponent(String(params.filePath)) const ref = encodeURIComponent(String(params.ref)) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/repository/files/${encodedPath}?ref=${ref}` diff --git a/apps/sim/tools/gitlab/get_issue.ts b/apps/sim/tools/gitlab/get_issue.ts index 52ceff47edd..e7516c511e2 100644 --- a/apps/sim/tools/gitlab/get_issue.ts +++ b/apps/sim/tools/gitlab/get_issue.ts @@ -1,7 +1,8 @@ import type { GitLabGetIssueParams, GitLabGetIssueResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabGetIssueTool: ToolConfig = { id: 'gitlab_get_issue', @@ -40,8 +41,8 @@ export const gitlabGetIssueTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${params.issueIid}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${safeUrlPathSegment(params.issueIid, 'issueIid')}` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_job_log.ts b/apps/sim/tools/gitlab/get_job_log.ts index 80fa6f0cc6b..0dc1493843e 100644 --- a/apps/sim/tools/gitlab/get_job_log.ts +++ b/apps/sim/tools/gitlab/get_job_log.ts @@ -1,8 +1,9 @@ import { truncate } from '@sim/utils/string' import type { GitLabGetJobLogParams, GitLabGetJobLogResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' /** * Job traces can reach ~100 MB on gitlab.com (more on self-managed); cap what @@ -48,8 +49,8 @@ export const gitlabGetJobLogTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/jobs/${params.jobId}/trace` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/jobs/${safeUrlPathSegment(params.jobId, 'jobId')}/trace` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_merge_request.ts b/apps/sim/tools/gitlab/get_merge_request.ts index df660835d3c..11a42a33d22 100644 --- a/apps/sim/tools/gitlab/get_merge_request.ts +++ b/apps/sim/tools/gitlab/get_merge_request.ts @@ -2,9 +2,10 @@ import type { GitLabGetMergeRequestParams, GitLabGetMergeRequestResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabGetMergeRequestTool: ToolConfig< GitLabGetMergeRequestParams, @@ -46,8 +47,8 @@ export const gitlabGetMergeRequestTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_merge_request_changes.ts b/apps/sim/tools/gitlab/get_merge_request_changes.ts index c4a36adf042..12de8fa8d85 100644 --- a/apps/sim/tools/gitlab/get_merge_request_changes.ts +++ b/apps/sim/tools/gitlab/get_merge_request_changes.ts @@ -2,9 +2,10 @@ import type { GitLabGetMergeRequestChangesParams, GitLabGetMergeRequestChangesResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabGetMergeRequestChangesTool: ToolConfig< GitLabGetMergeRequestChangesParams, @@ -53,8 +54,8 @@ export const gitlabGetMergeRequestChangesTool: ToolConfig< * in a single call, which covers the vast majority of merge requests. */ url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}/diffs?per_page=100` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}/diffs?per_page=100` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_pipeline.ts b/apps/sim/tools/gitlab/get_pipeline.ts index e17519e6d3a..a07a99a7ebf 100644 --- a/apps/sim/tools/gitlab/get_pipeline.ts +++ b/apps/sim/tools/gitlab/get_pipeline.ts @@ -1,7 +1,8 @@ import type { GitLabGetPipelineParams, GitLabGetPipelineResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabGetPipelineTool: ToolConfig = { @@ -41,8 +42,8 @@ export const gitlabGetPipelineTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${params.pipelineId}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${safeUrlPathSegment(params.pipelineId, 'pipelineId')}` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/get_project.ts b/apps/sim/tools/gitlab/get_project.ts index 3bff58c0d57..4a36a56db67 100644 --- a/apps/sim/tools/gitlab/get_project.ts +++ b/apps/sim/tools/gitlab/get_project.ts @@ -1,5 +1,5 @@ import type { GitLabGetProjectParams, GitLabGetProjectResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -34,7 +34,7 @@ export const gitlabGetProjectTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) return `${getGitLabApiBase(params.host)}/projects/${encodedId}` }, method: 'GET', diff --git a/apps/sim/tools/gitlab/invite_member.ts b/apps/sim/tools/gitlab/invite_member.ts index 347751ca29d..e9208065db3 100644 --- a/apps/sim/tools/gitlab/invite_member.ts +++ b/apps/sim/tools/gitlab/invite_member.ts @@ -50,7 +50,7 @@ export const gitlabInviteMemberTool: ToolConfig< required: true, visibility: 'user-or-llm', description: - 'Access level: 0 (No access), 5 (Minimal), 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner)', + 'Access level: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner). 5 (Minimal access) is also valid for a top-level group on Premium and Ultimate.', }, expiresAt: { type: 'string', diff --git a/apps/sim/tools/gitlab/list_branches.ts b/apps/sim/tools/gitlab/list_branches.ts index bcf3ea6eede..5960e5e4daa 100644 --- a/apps/sim/tools/gitlab/list_branches.ts +++ b/apps/sim/tools/gitlab/list_branches.ts @@ -1,5 +1,5 @@ import type { GitLabListBranchesParams, GitLabListBranchesResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -55,7 +55,7 @@ export const gitlabListBranchesTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.search) queryParams.append('search', params.search) diff --git a/apps/sim/tools/gitlab/list_commits.ts b/apps/sim/tools/gitlab/list_commits.ts index 392216c8ac9..6b2962fbf91 100644 --- a/apps/sim/tools/gitlab/list_commits.ts +++ b/apps/sim/tools/gitlab/list_commits.ts @@ -1,5 +1,5 @@ import type { GitLabListCommitsParams, GitLabListCommitsResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -77,7 +77,7 @@ export const gitlabListCommitsTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.refName) queryParams.append('ref_name', params.refName) diff --git a/apps/sim/tools/gitlab/list_issues.ts b/apps/sim/tools/gitlab/list_issues.ts index b967cdb5d4a..8a47551cf7b 100644 --- a/apps/sim/tools/gitlab/list_issues.ts +++ b/apps/sim/tools/gitlab/list_issues.ts @@ -1,5 +1,5 @@ import type { GitLabListIssuesParams, GitLabListIssuesResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -89,7 +89,7 @@ export const gitlabListIssuesTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.state) queryParams.append('state', params.state) diff --git a/apps/sim/tools/gitlab/list_merge_requests.ts b/apps/sim/tools/gitlab/list_merge_requests.ts index 5bf7a31379e..3855e532aa0 100644 --- a/apps/sim/tools/gitlab/list_merge_requests.ts +++ b/apps/sim/tools/gitlab/list_merge_requests.ts @@ -2,7 +2,7 @@ import type { GitLabListMergeRequestsParams, GitLabListMergeRequestsResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -89,7 +89,7 @@ export const gitlabListMergeRequestsTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.state) queryParams.append('state', params.state) diff --git a/apps/sim/tools/gitlab/list_pipeline_jobs.ts b/apps/sim/tools/gitlab/list_pipeline_jobs.ts index 6f2ed932f17..4399e8beb4f 100644 --- a/apps/sim/tools/gitlab/list_pipeline_jobs.ts +++ b/apps/sim/tools/gitlab/list_pipeline_jobs.ts @@ -2,9 +2,10 @@ import type { GitLabListPipelineJobsParams, GitLabListPipelineJobsResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabListPipelineJobsTool: ToolConfig< GitLabListPipelineJobsParams, @@ -70,7 +71,7 @@ export const gitlabListPipelineJobsTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.scope) queryParams.append('scope', params.scope) @@ -79,7 +80,7 @@ export const gitlabListPipelineJobsTool: ToolConfig< if (params.page) queryParams.append('page', String(params.page)) const query = queryParams.toString() - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${params.pipelineId}/jobs${query ? `?${query}` : ''}` + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${safeUrlPathSegment(params.pipelineId, 'pipelineId')}/jobs${query ? `?${query}` : ''}` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/list_pipelines.ts b/apps/sim/tools/gitlab/list_pipelines.ts index ec03df6bdf7..bfaee125e54 100644 --- a/apps/sim/tools/gitlab/list_pipelines.ts +++ b/apps/sim/tools/gitlab/list_pipelines.ts @@ -1,5 +1,5 @@ import type { GitLabListPipelinesParams, GitLabListPipelinesResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -74,7 +74,7 @@ export const gitlabListPipelinesTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.ref) queryParams.append('ref', params.ref) diff --git a/apps/sim/tools/gitlab/list_releases.ts b/apps/sim/tools/gitlab/list_releases.ts index 16333a5b3a3..9905057383a 100644 --- a/apps/sim/tools/gitlab/list_releases.ts +++ b/apps/sim/tools/gitlab/list_releases.ts @@ -1,5 +1,5 @@ import type { GitLabListReleasesParams, GitLabListReleasesResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -61,7 +61,7 @@ export const gitlabListReleasesTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.orderBy) queryParams.append('order_by', params.orderBy) diff --git a/apps/sim/tools/gitlab/list_repository_tree.ts b/apps/sim/tools/gitlab/list_repository_tree.ts index 906c8a4223c..a14f47f27b3 100644 --- a/apps/sim/tools/gitlab/list_repository_tree.ts +++ b/apps/sim/tools/gitlab/list_repository_tree.ts @@ -2,7 +2,7 @@ import type { GitLabListRepositoryTreeParams, GitLabListRepositoryTreeResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -70,7 +70,7 @@ export const gitlabListRepositoryTreeTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const queryParams = new URLSearchParams() if (params.path) queryParams.append('path', params.path) diff --git a/apps/sim/tools/gitlab/list_saml_group_links.ts b/apps/sim/tools/gitlab/list_saml_group_links.ts index 564a6b94792..83fac15faa9 100644 --- a/apps/sim/tools/gitlab/list_saml_group_links.ts +++ b/apps/sim/tools/gitlab/list_saml_group_links.ts @@ -2,7 +2,7 @@ import type { GitLabListSamlGroupLinksParams, GitLabListSamlGroupLinksResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -41,7 +41,7 @@ export const gitlabListSamlGroupLinksTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.groupId).trim()) + const encodedId = encodeGitLabResourceId(params.groupId) return `${getGitLabApiBase(params.host)}/groups/${encodedId}/saml_group_links` }, method: 'GET', diff --git a/apps/sim/tools/gitlab/merge_merge_request.ts b/apps/sim/tools/gitlab/merge_merge_request.ts index cc3ebcdf3ae..305450c106d 100644 --- a/apps/sim/tools/gitlab/merge_merge_request.ts +++ b/apps/sim/tools/gitlab/merge_merge_request.ts @@ -2,9 +2,10 @@ import type { GitLabMergeMergeRequestParams, GitLabMergeMergeRequestResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabMergeMergeRequestTool: ToolConfig< GitLabMergeMergeRequestParams, @@ -72,12 +73,19 @@ export const gitlabMergeMergeRequestTool: ToolConfig< visibility: 'user-or-llm', description: 'Merge when pipeline succeeds', }, + sha: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'HEAD SHA of the source branch; the merge fails if it does not match. Required when the group or instance requires a commit SHA on the merge requests API.', + }, }, request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}/merge` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}/merge` }, method: 'PUT', headers: (params) => ({ @@ -85,7 +93,7 @@ export const gitlabMergeMergeRequestTool: ToolConfig< 'PRIVATE-TOKEN': params.accessToken, }), body: (params) => { - const body: Record = {} + const body: Record = {} if (params.mergeCommitMessage) body.merge_commit_message = params.mergeCommitMessage if (params.squashCommitMessage) body.squash_commit_message = params.squashCommitMessage @@ -99,6 +107,7 @@ export const gitlabMergeMergeRequestTool: ToolConfig< body.auto_merge = params.mergeWhenPipelineSucceeds body.merge_when_pipeline_succeeds = params.mergeWhenPipelineSucceeds } + if (params.sha) body.sha = params.sha return body }, diff --git a/apps/sim/tools/gitlab/play_job.ts b/apps/sim/tools/gitlab/play_job.ts index 60f375a0401..85663b5a328 100644 --- a/apps/sim/tools/gitlab/play_job.ts +++ b/apps/sim/tools/gitlab/play_job.ts @@ -1,7 +1,8 @@ import type { GitLabPlayJobParams, GitLabPlayJobResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabPlayJobTool: ToolConfig = { id: 'gitlab_play_job', @@ -46,8 +47,8 @@ export const gitlabPlayJobTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/jobs/${params.jobId}/play` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/jobs/${safeUrlPathSegment(params.jobId, 'jobId')}/play` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/remove_member.ts b/apps/sim/tools/gitlab/remove_member.ts index 442f5970bbe..87430913f9c 100644 --- a/apps/sim/tools/gitlab/remove_member.ts +++ b/apps/sim/tools/gitlab/remove_member.ts @@ -2,6 +2,7 @@ import type { GitLabRemoveMemberParams, GitLabRemoveMemberResponse } from '@/too import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabRemoveMemberTool: ToolConfig< GitLabRemoveMemberParams, @@ -68,7 +69,7 @@ export const gitlabRemoveMemberTool: ToolConfig< if (params.skipSubresources) queryParams.append('skip_subresources', 'true') if (params.unassignIssuables) queryParams.append('unassign_issuables', 'true') const query = queryParams.toString() - return `${getGitLabApiBase(params.host)}/${resourcePath}/members/${params.userId}${query ? `?${query}` : ''}` + return `${getGitLabApiBase(params.host)}/${resourcePath}/members/${safeUrlPathSegment(params.userId, 'userId')}${query ? `?${query}` : ''}` }, method: 'DELETE', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/request-paths.test.ts b/apps/sim/tools/gitlab/request-paths.test.ts new file mode 100644 index 00000000000..bcce7a50265 --- /dev/null +++ b/apps/sim/tools/gitlab/request-paths.test.ts @@ -0,0 +1,64 @@ +import { describe, expect, it } from 'vitest' +import { gitlabDeleteBranchTool } from '@/tools/gitlab/delete_branch' +import { gitlabDeleteIssueTool } from '@/tools/gitlab/delete_issue' +import { gitlabDeleteSamlGroupLinkTool } from '@/tools/gitlab/delete_saml_group_link' +import { gitlabDeleteUserIdentityTool } from '@/tools/gitlab/delete_user_identity' +import { gitlabGetProjectTool } from '@/tools/gitlab/get_project' +import { gitlabMergeMergeRequestTool } from '@/tools/gitlab/merge_merge_request' +import { gitlabRevokeInvitationTool } from '@/tools/gitlab/revoke_invitation' +import { gitlabUpdateInvitationTool } from '@/tools/gitlab/update_invitation' + +function urlOf(tool: { request: { url: unknown } }, params: Record): string { + const { url } = tool.request + if (typeof url !== 'function') throw new Error('expected a URL builder') + return url(params) +} + +describe('gitlab project-scoped request paths', () => { + it('encodes a pre-encoded namespaced project path exactly once', () => { + expect(urlOf(gitlabGetProjectTool, { projectId: 'my-group%2Fmy-project' })).toBe( + 'https://gitlab.com/api/v4/projects/my-group%2Fmy-project' + ) + }) + + it('rejects an issue IID that would steer the request to another endpoint', () => { + expect(() => + urlOf(gitlabDeleteIssueTool, { projectId: 'g/p', issueIid: '1/../../../../users/7' }) + ).toThrow(/issueIid/) + expect(() => urlOf(gitlabGetProjectTool, { projectId: '..' })).toThrow() + }) + + it('rejects a dot-segment name that would retarget a DELETE to its parent resource', () => { + const scoped = { resourceType: 'project', resourceId: '42' } + expect(() => urlOf(gitlabRevokeInvitationTool, { ...scoped, email: '..' })).toThrow(/email/) + expect(() => urlOf(gitlabUpdateInvitationTool, { ...scoped, email: ' .. ' })).toThrow(/email/) + expect(() => + urlOf(gitlabDeleteSamlGroupLinkTool, { groupId: '5', samlGroupName: '..' }) + ).toThrow(/samlGroupName/) + expect(() => urlOf(gitlabDeleteUserIdentityTool, { userId: 7, provider: '..' })).toThrow( + /provider/ + ) + expect(() => urlOf(gitlabDeleteBranchTool, { projectId: '1', branch: '.' })).toThrow(/branch/) + }) + + it('still encodes names that contain a slash or dots', () => { + expect(urlOf(gitlabDeleteSamlGroupLinkTool, { groupId: '5', samlGroupName: 'eng/devs' })).toBe( + 'https://gitlab.com/api/v4/groups/5/saml_group_links/eng%2Fdevs' + ) + expect(urlOf(gitlabDeleteBranchTool, { projectId: '1', branch: 'feature/a..b' })).toBe( + 'https://gitlab.com/api/v4/projects/1/repository/branches/feature%2Fa..b' + ) + }) +}) + +describe('gitlab_merge_merge_request', () => { + it('sends the head SHA that instances requiring it check', () => { + const body = gitlabMergeMergeRequestTool.request.body?.({ + accessToken: 'pat', + projectId: '1', + mergeRequestIid: 2, + sha: 'abc123', + }) + expect(body).toMatchObject({ sha: 'abc123' }) + }) +}) diff --git a/apps/sim/tools/gitlab/retry_pipeline.ts b/apps/sim/tools/gitlab/retry_pipeline.ts index 4cfee25ba05..375e0f268aa 100644 --- a/apps/sim/tools/gitlab/retry_pipeline.ts +++ b/apps/sim/tools/gitlab/retry_pipeline.ts @@ -1,7 +1,8 @@ import type { GitLabRetryPipelineParams, GitLabRetryPipelineResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabRetryPipelineTool: ToolConfig< GitLabRetryPipelineParams, @@ -43,8 +44,8 @@ export const gitlabRetryPipelineTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${params.pipelineId}/retry` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/pipelines/${safeUrlPathSegment(params.pipelineId, 'pipelineId')}/retry` }, method: 'POST', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/revoke_invitation.ts b/apps/sim/tools/gitlab/revoke_invitation.ts index ac1d7dd41bd..27305050160 100644 --- a/apps/sim/tools/gitlab/revoke_invitation.ts +++ b/apps/sim/tools/gitlab/revoke_invitation.ts @@ -5,6 +5,7 @@ import type { import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabRevokeInvitationTool: ToolConfig< GitLabRevokeInvitationParams, @@ -53,7 +54,7 @@ export const gitlabRevokeInvitationTool: ToolConfig< request: { url: (params) => { const resourcePath = getGitLabResourcePath(params.resourceType, params.resourceId) - const encodedEmail = encodeURIComponent(String(params.email).trim()) + const encodedEmail = safeUrlPathSegment(params.email, 'email', { allowSeparators: true }) return `${getGitLabApiBase(params.host)}/${resourcePath}/invitations/${encodedEmail}` }, method: 'DELETE', diff --git a/apps/sim/tools/gitlab/types.ts b/apps/sim/tools/gitlab/types.ts index 69f4e77ef45..ceca1c5012d 100644 --- a/apps/sim/tools/gitlab/types.ts +++ b/apps/sim/tools/gitlab/types.ts @@ -412,6 +412,7 @@ export interface GitLabMergeMergeRequestParams extends GitLabBaseParams { squash?: boolean shouldRemoveSourceBranch?: boolean mergeWhenPipelineSucceeds?: boolean + sha?: string } export interface GitLabListPipelinesParams extends GitLabBaseParams { diff --git a/apps/sim/tools/gitlab/update_file.ts b/apps/sim/tools/gitlab/update_file.ts index 269a60648e5..2924942d7fe 100644 --- a/apps/sim/tools/gitlab/update_file.ts +++ b/apps/sim/tools/gitlab/update_file.ts @@ -1,5 +1,5 @@ import type { GitLabUpdateFileParams, GitLabUpdateFileResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -88,7 +88,7 @@ export const gitlabUpdateFileTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) + const encodedId = encodeGitLabResourceId(params.projectId) const encodedPath = encodeURIComponent(String(params.filePath)) return `${getGitLabApiBase(params.host)}/projects/${encodedId}/repository/files/${encodedPath}` }, diff --git a/apps/sim/tools/gitlab/update_invitation.ts b/apps/sim/tools/gitlab/update_invitation.ts index 0f2c1aba53c..7bf44d0cb84 100644 --- a/apps/sim/tools/gitlab/update_invitation.ts +++ b/apps/sim/tools/gitlab/update_invitation.ts @@ -5,6 +5,7 @@ import type { import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabUpdateInvitationTool: ToolConfig< GitLabUpdateInvitationParams, @@ -67,7 +68,7 @@ export const gitlabUpdateInvitationTool: ToolConfig< request: { url: (params) => { const resourcePath = getGitLabResourcePath(params.resourceType, params.resourceId) - const encodedEmail = encodeURIComponent(String(params.email).trim()) + const encodedEmail = safeUrlPathSegment(params.email, 'email', { allowSeparators: true }) return `${getGitLabApiBase(params.host)}/${resourcePath}/invitations/${encodedEmail}` }, method: 'PUT', diff --git a/apps/sim/tools/gitlab/update_issue.ts b/apps/sim/tools/gitlab/update_issue.ts index 7a9ac696a00..b7d611a7ce0 100644 --- a/apps/sim/tools/gitlab/update_issue.ts +++ b/apps/sim/tools/gitlab/update_issue.ts @@ -1,7 +1,8 @@ import type { GitLabUpdateIssueParams, GitLabUpdateIssueResponse } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabUpdateIssueTool: ToolConfig = { @@ -89,8 +90,8 @@ export const gitlabUpdateIssueTool: ToolConfig { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${params.issueIid}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/issues/${safeUrlPathSegment(params.issueIid, 'issueIid')}` }, method: 'PUT', headers: (params) => ({ @@ -98,7 +99,7 @@ export const gitlabUpdateIssueTool: ToolConfig { - const body: Record = {} + const body: Record = {} if (params.title) body.title = params.title if (params.description !== undefined) body.description = params.description diff --git a/apps/sim/tools/gitlab/update_member.ts b/apps/sim/tools/gitlab/update_member.ts index c78795b588d..220b5a4c631 100644 --- a/apps/sim/tools/gitlab/update_member.ts +++ b/apps/sim/tools/gitlab/update_member.ts @@ -2,6 +2,7 @@ import type { GitLabUpdateMemberParams, GitLabUpdateMemberResponse } from '@/too import { getGitLabApiBase, getGitLabResourcePath } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabUpdateMemberTool: ToolConfig< GitLabUpdateMemberParams, @@ -50,7 +51,7 @@ export const gitlabUpdateMemberTool: ToolConfig< required: true, visibility: 'user-or-llm', description: - 'New access level: 0 (No access), 5 (Minimal), 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner)', + 'New access level: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner). 5 (Minimal access) is also valid for a top-level group on Premium and Ultimate.', }, expiresAt: { type: 'string', @@ -71,7 +72,7 @@ export const gitlabUpdateMemberTool: ToolConfig< request: { url: (params) => { const resourcePath = getGitLabResourcePath(params.resourceType, params.resourceId) - return `${getGitLabApiBase(params.host)}/${resourcePath}/members/${params.userId}` + return `${getGitLabApiBase(params.host)}/${resourcePath}/members/${safeUrlPathSegment(params.userId, 'userId')}` }, method: 'PUT', headers: (params) => ({ diff --git a/apps/sim/tools/gitlab/update_merge_request.ts b/apps/sim/tools/gitlab/update_merge_request.ts index 30e2ca12224..df3ff8a9b88 100644 --- a/apps/sim/tools/gitlab/update_merge_request.ts +++ b/apps/sim/tools/gitlab/update_merge_request.ts @@ -2,9 +2,10 @@ import type { GitLabUpdateMergeRequestParams, GitLabUpdateMergeRequestResponse, } from '@/tools/gitlab/types' -import { getGitLabApiBase } from '@/tools/gitlab/utils' +import { encodeGitLabResourceId, getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabUpdateMergeRequestTool: ToolConfig< GitLabUpdateMergeRequestParams, @@ -107,8 +108,8 @@ export const gitlabUpdateMergeRequestTool: ToolConfig< request: { url: (params) => { - const encodedId = encodeURIComponent(String(params.projectId).trim()) - return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${params.mergeRequestIid}` + const encodedId = encodeGitLabResourceId(params.projectId) + return `${getGitLabApiBase(params.host)}/projects/${encodedId}/merge_requests/${safeUrlPathSegment(params.mergeRequestIid, 'mergeRequestIid')}` }, method: 'PUT', headers: (params) => ({ @@ -116,7 +117,7 @@ export const gitlabUpdateMergeRequestTool: ToolConfig< 'PRIVATE-TOKEN': params.accessToken, }), body: (params) => { - const body: Record = {} + const body: Record = {} // GitLab has no `draft` body param — draft status is conveyed via the // "Draft:" title prefix, so it can only be changed when a title is sent. diff --git a/apps/sim/tools/gitlab/update_user.ts b/apps/sim/tools/gitlab/update_user.ts index 5e101dffe9f..40cfc248015 100644 --- a/apps/sim/tools/gitlab/update_user.ts +++ b/apps/sim/tools/gitlab/update_user.ts @@ -2,6 +2,7 @@ import type { GitLabUpdateUserParams, GitLabUserResponse } from '@/tools/gitlab/ import { getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const gitlabUpdateUserTool: ToolConfig = { id: 'gitlab_update_user', @@ -59,7 +60,8 @@ export const gitlabUpdateUserTool: ToolConfig `${getGitLabApiBase(params.host)}/users/${params.userId}`, + url: (params) => + `${getGitLabApiBase(params.host)}/users/${safeUrlPathSegment(params.userId, 'userId')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/gitlab/user_status_actions.ts b/apps/sim/tools/gitlab/user_status_actions.ts index 6df5dc64736..c12fdb5cf25 100644 --- a/apps/sim/tools/gitlab/user_status_actions.ts +++ b/apps/sim/tools/gitlab/user_status_actions.ts @@ -2,6 +2,7 @@ import type { GitLabUserActionParams, GitLabUserActionResponse } from '@/tools/g import { getGitLabApiBase } from '@/tools/gitlab/utils' import { GITLAB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' /** * The GitLab admin user-state endpoints (`POST /users/:id/{block,unblock,...}`) @@ -44,7 +45,8 @@ function createUserStatusActionTool( }, request: { - url: (params) => `${getGitLabApiBase(params.host)}/users/${params.userId}/${action}`, + url: (params) => + `${getGitLabApiBase(params.host)}/users/${safeUrlPathSegment(params.userId, 'userId')}/${action}`, method: 'POST', headers: (params) => ({ 'PRIVATE-TOKEN': params.accessToken, diff --git a/apps/sim/tools/gitlab/utils.ts b/apps/sim/tools/gitlab/utils.ts index 0fe64c7ccf3..e72dfaf42c7 100644 --- a/apps/sim/tools/gitlab/utils.ts +++ b/apps/sim/tools/gitlab/utils.ts @@ -182,8 +182,12 @@ export type GitLabResourceType = 'project' | 'group' * first makes both inputs converge on the same single-encoded result; * without it, a pre-encoded `%2F` gets re-encoded to `%252F`, GitLab decodes * that once server-side to the literal string `%2F`, and the lookup 404s. + * A `.` or `..` id is rejected: encoding leaves dot segments intact, and the + * URL parser would resolve them away into a different endpoint. + * + * @throws When the id is a dot segment. */ -function encodeGitLabResourceId(resourceId: string | number): string { +export function encodeGitLabResourceId(resourceId: string | number): string { const raw = String(resourceId).trim() let decoded = raw try { @@ -191,6 +195,9 @@ function encodeGitLabResourceId(resourceId: string | number): string { } catch { // Not a valid percent-encoding (e.g. a bare `%`) - treat as already raw. } + if (decoded.trim() === '.' || decoded.trim() === '..') { + throw new Error(`GitLab project or group ID cannot be "${decoded.trim()}"`) + } return encodeURIComponent(decoded) } diff --git a/apps/sim/tools/incidentio/actions_create.ts b/apps/sim/tools/incidentio/actions_create.ts index 06a0a061752..27fbfd55352 100644 --- a/apps/sim/tools/incidentio/actions_create.ts +++ b/apps/sim/tools/incidentio/actions_create.ts @@ -45,7 +45,7 @@ export const actionsCreateTool: ToolConfig< }, request: { - url: 'https://api.incident.io/v2/actions', + url: 'https://api.incident.io/v3/actions', method: 'POST', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/actions_list.ts b/apps/sim/tools/incidentio/actions_list.ts index e3bc7031d76..04f91d1932c 100644 --- a/apps/sim/tools/incidentio/actions_list.ts +++ b/apps/sim/tools/incidentio/actions_list.ts @@ -1,7 +1,11 @@ -import type { - IncidentioActionsListParams, - IncidentioActionsListResponse, +import { + INCIDENTIO_ACTION_SUMMARY_OUTPUT_PROPERTIES, + INCIDENTIO_CURSOR_PAGINATION_OUTPUT, + INCIDENTIO_V3_MAX_PAGE_SIZE, + type IncidentioActionsListParams, + type IncidentioActionsListResponse, } from '@/tools/incidentio/types' +import { collectIncidentioPages, mapIncidentioActionSummary } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -11,7 +15,8 @@ export const actionsListTool: ToolConfig< > = { id: 'incidentio_actions_list', name: 'incident.io Actions List', - description: 'List actions from incident.io. Optionally filter by incident ID.', + description: + 'List actions from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 actions, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -33,13 +38,27 @@ export const actionsListTool: ToolConfig< required: false, visibility: 'user-or-llm', description: - 'Filter actions by incident mode (standard, retrospective, test, tutorial, or stream)', + 'Filter actions by incident mode (standard, retrospective, test, tutorial, or stream). When omitted, actions from standard and retrospective incidents are returned.', + }, + page_size: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: + 'Number of actions per page, 1-250. Setting it fetches a single page instead of following pages automatically', + }, + after: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Pagination cursor from a previous page\'s pagination_meta.after (e.g., "01FDAG4SAP5TYPT98WGR2N7W91")', }, }, request: { url: (params) => { - const url = new URL('https://api.incident.io/v2/actions') + const url = new URL('https://api.incident.io/v3/actions') if (params.incident_id) { url.searchParams.append('incident_id', params.incident_id.trim()) @@ -49,6 +68,12 @@ export const actionsListTool: ToolConfig< url.searchParams.append('incident_mode', params.incident_mode) } + url.searchParams.append('page_size', String(params.page_size || INCIDENTIO_V3_MAX_PAGE_SIZE)) + + if (params.after) { + url.searchParams.append('after', params.after.trim()) + } + return url.toString() }, method: 'GET', @@ -64,38 +89,37 @@ export const actionsListTool: ToolConfig< return { success: true, output: { - actions: - data.actions?.map((action: any) => ({ - id: action.id, - description: action.description || '', - assignee: action.assignee - ? { - id: action.assignee.id, - name: action.assignee.name, - email: action.assignee.email, - } - : undefined, - status: action.status, - due_at: action.due_at, - created_at: action.created_at, - updated_at: action.updated_at, - incident_id: action.incident_id, - creator: action.creator - ? { - id: action.creator.id, - name: action.creator.name, - email: action.creator.email, - } - : undefined, - completed_at: action.completed_at, - external_issue_reference: action.external_issue_reference - ? { - provider: action.external_issue_reference.provider, - issue_name: action.external_issue_reference.issue_name, - issue_permalink: action.external_issue_reference.issue_permalink, - } - : undefined, - })) || [], + actions: Array.isArray(data.actions) ? data.actions.map(mapIncidentioActionSummary) : [], + pagination_meta: data.pagination_meta, + }, + } + }, + + postProcess: async (result, params, executeTool) => { + const firstAfter = result.output.pagination_meta?.after + if (params.page_size || params.after || !firstAfter) return result + + const collected = await collectIncidentioPages( + { items: result.output.actions, after: firstAfter }, + 'actions', + (after) => + executeTool('incidentio_actions_list', { + ...params, + after, + page_size: INCIDENTIO_V3_MAX_PAGE_SIZE, + }) + ) + if ('error' in collected) { + return { success: false, output: result.output, error: collected.error } + } + return { + success: true, + output: { + actions: collected.items, + pagination_meta: result.output.pagination_meta && { + ...result.output.pagination_meta, + after: collected.after, + }, }, } }, @@ -106,48 +130,9 @@ export const actionsListTool: ToolConfig< description: 'List of actions', items: { type: 'object', - properties: { - id: { type: 'string', description: 'Action ID' }, - description: { type: 'string', description: 'Action description' }, - assignee: { - type: 'object', - description: 'Assigned user', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - status: { type: 'string', description: 'Action status' }, - due_at: { type: 'string', description: 'Due date/time' }, - created_at: { type: 'string', description: 'Creation timestamp' }, - updated_at: { type: 'string', description: 'Last update timestamp' }, - incident_id: { type: 'string', description: 'Associated incident ID' }, - creator: { - type: 'object', - description: 'User who created the action', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - completed_at: { type: 'string', description: 'Completion timestamp' }, - external_issue_reference: { - type: 'object', - description: 'External issue tracking reference', - optional: true, - properties: { - provider: { - type: 'string', - description: 'Issue tracking provider (e.g., Jira, Linear)', - }, - issue_name: { type: 'string', description: 'Issue identifier' }, - issue_permalink: { type: 'string', description: 'URL to the external issue' }, - }, - }, - }, + properties: INCIDENTIO_ACTION_SUMMARY_OUTPUT_PROPERTIES, }, }, + pagination_meta: INCIDENTIO_CURSOR_PAGINATION_OUTPUT, }, } diff --git a/apps/sim/tools/incidentio/actions_show.ts b/apps/sim/tools/incidentio/actions_show.ts index 4612d51ca5e..ba4c75814c8 100644 --- a/apps/sim/tools/incidentio/actions_show.ts +++ b/apps/sim/tools/incidentio/actions_show.ts @@ -1,9 +1,12 @@ -import type { - IncidentioActionsShowParams, - IncidentioActionsShowResponse, +import { + INCIDENTIO_ACTION_SUMMARY_OUTPUT_PROPERTIES, + type IncidentioActionsShowParams, + type IncidentioActionsShowResponse, } from '@/tools/incidentio/types' +import { mapIncidentioActionSummary } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const actionsShowTool: ToolConfig< IncidentioActionsShowParams, @@ -31,7 +34,7 @@ export const actionsShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/actions/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v3/actions/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -45,37 +48,7 @@ export const actionsShowTool: ToolConfig< return { success: true, output: { - action: { - id: data.action.id, - description: data.action.description || '', - assignee: data.action.assignee - ? { - id: data.action.assignee.id, - name: data.action.assignee.name, - email: data.action.assignee.email, - } - : undefined, - status: data.action.status, - due_at: data.action.due_at, - created_at: data.action.created_at, - updated_at: data.action.updated_at, - incident_id: data.action.incident_id, - creator: data.action.creator - ? { - id: data.action.creator.id, - name: data.action.creator.name, - email: data.action.creator.email, - } - : undefined, - completed_at: data.action.completed_at, - external_issue_reference: data.action.external_issue_reference - ? { - provider: data.action.external_issue_reference.provider, - issue_name: data.action.external_issue_reference.issue_name, - issue_permalink: data.action.external_issue_reference.issue_permalink, - } - : undefined, - }, + action: mapIncidentioActionSummary(data.action), }, } }, @@ -84,47 +57,7 @@ export const actionsShowTool: ToolConfig< action: { type: 'object', description: 'Action details', - properties: { - id: { type: 'string', description: 'Action ID' }, - description: { type: 'string', description: 'Action description' }, - assignee: { - type: 'object', - description: 'Assigned user', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - status: { type: 'string', description: 'Action status' }, - due_at: { type: 'string', description: 'Due date/time' }, - created_at: { type: 'string', description: 'Creation timestamp' }, - updated_at: { type: 'string', description: 'Last update timestamp' }, - incident_id: { type: 'string', description: 'Associated incident ID' }, - creator: { - type: 'object', - description: 'User who created the action', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - completed_at: { type: 'string', description: 'Completion timestamp' }, - external_issue_reference: { - type: 'object', - description: 'External issue tracking reference', - optional: true, - properties: { - provider: { - type: 'string', - description: 'Issue tracking provider (e.g., Jira, Linear)', - }, - issue_name: { type: 'string', description: 'Issue identifier' }, - issue_permalink: { type: 'string', description: 'URL to the external issue' }, - }, - }, - }, + properties: INCIDENTIO_ACTION_SUMMARY_OUTPUT_PROPERTIES, }, }, } diff --git a/apps/sim/tools/incidentio/actions_update.ts b/apps/sim/tools/incidentio/actions_update.ts index 9427ffbcaef..b6cbdb5871e 100644 --- a/apps/sim/tools/incidentio/actions_update.ts +++ b/apps/sim/tools/incidentio/actions_update.ts @@ -5,6 +5,7 @@ import { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const actionsUpdateTool: ToolConfig< IncidentioActionsUpdateParams, @@ -53,7 +54,7 @@ export const actionsUpdateTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/actions/${encodeURIComponent(params.id.trim())}`, + url: (params) => `https://api.incident.io/v3/actions/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/alerts_list.ts b/apps/sim/tools/incidentio/alerts_list.ts index 66fb1e8cd78..d3df97ac7d4 100644 --- a/apps/sim/tools/incidentio/alerts_list.ts +++ b/apps/sim/tools/incidentio/alerts_list.ts @@ -29,7 +29,7 @@ export const alertsListTool: ToolConfig `https://api.incident.io/v2/custom_fields/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/custom_fields/${safeUrlPathSegment(params.id, 'id')}`, method: 'DELETE', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/custom_fields_list.ts b/apps/sim/tools/incidentio/custom_fields_list.ts index a3980d04412..34050c2b895 100644 --- a/apps/sim/tools/incidentio/custom_fields_list.ts +++ b/apps/sim/tools/incidentio/custom_fields_list.ts @@ -40,7 +40,6 @@ export const customFieldsListTool: ToolConfig = { id: 'incidentio_custom_fields_show', @@ -25,7 +26,8 @@ export const customFieldsShowTool: ToolConfig `https://api.incident.io/v2/custom_fields/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/custom_fields/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -46,7 +48,6 @@ export const customFieldsShowTool: ToolConfig `https://api.incident.io/v2/custom_fields/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/custom_fields/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', @@ -69,7 +71,6 @@ export const customFieldsUpdateTool: ToolConfig< field_type: data.custom_field.field_type, created_at: data.custom_field.created_at, updated_at: data.custom_field.updated_at, - options: data.custom_field.options, }, }, } diff --git a/apps/sim/tools/incidentio/escalation_paths_create.ts b/apps/sim/tools/incidentio/escalation_paths_create.ts index f902a8cb765..6a4c8b5a8f4 100644 --- a/apps/sim/tools/incidentio/escalation_paths_create.ts +++ b/apps/sim/tools/incidentio/escalation_paths_create.ts @@ -1,6 +1,7 @@ -import type { - IncidentioEscalationPathsCreateParams, - IncidentioEscalationPathsCreateResponse, +import { + INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, + type IncidentioEscalationPathsCreateParams, + type IncidentioEscalationPathsCreateResponse, } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -33,13 +34,14 @@ export const escalationPathsCreateTool: ToolConfig< required: true, visibility: 'user-or-llm', description: - 'Array of escalation levels with targets and time to acknowledge in seconds. Each level should have: targets (array of {id, type, schedule_id?, user_id?, urgency}) and time_to_ack_seconds (number)', + 'Array of escalation path nodes. Each node needs a unique "id" and a "type" (level, notify_channel, delay, if_else, repeat, voicemail, escalation_path); a level node nests its targets under "level", e.g. [{"id":"lvl1","type":"level","level":{"targets":[{"id":"","type":"schedule","schedule_mode":"currently_on_call","urgency":"high"}],"time_to_ack_seconds":300}}]. Target type is schedule, user, slack_channel, or msteams_channel; urgency is high or low.', }, working_hours: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'Optional working hours configuration. Array of {weekday, start_time, end_time}', + description: + 'Optional. Array of working-hours windows, each {id, name, timezone, weekday_intervals: [{weekday, start_time, end_time}]}, e.g. [{"id":"wh","name":"Business hours","timezone":"Europe/London","weekday_intervals":[{"weekday":"monday","start_time":"09:00","end_time":"17:00"}]}]', }, }, @@ -79,58 +81,7 @@ export const escalationPathsCreateTool: ToolConfig< escalation_path: { type: 'object', description: 'The created escalation path', - properties: { - id: { type: 'string', description: 'The escalation path ID' }, - name: { type: 'string', description: 'The escalation path name' }, - path: { - type: 'array', - description: 'Array of escalation levels', - items: { - type: 'object', - properties: { - targets: { - type: 'array', - description: 'Targets for this level', - items: { - type: 'object', - properties: { - id: { type: 'string', description: 'Target ID' }, - type: { type: 'string', description: 'Target type' }, - schedule_id: { - type: 'string', - description: 'Schedule ID if type is schedule', - optional: true, - }, - user_id: { - type: 'string', - description: 'User ID if type is user', - optional: true, - }, - urgency: { type: 'string', description: 'Urgency level' }, - }, - }, - }, - time_to_ack_seconds: { - type: 'number', - description: 'Time to acknowledge in seconds', - }, - }, - }, - }, - working_hours: { - type: 'array', - description: 'Working hours configuration', - optional: true, - items: { - type: 'object', - properties: { - weekday: { type: 'string', description: 'Day of week' }, - start_time: { type: 'string', description: 'Start time' }, - end_time: { type: 'string', description: 'End time' }, - }, - }, - }, - }, + properties: INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, }, }, } diff --git a/apps/sim/tools/incidentio/escalation_paths_delete.ts b/apps/sim/tools/incidentio/escalation_paths_delete.ts index b2cd64e620b..b2a4504c8cf 100644 --- a/apps/sim/tools/incidentio/escalation_paths_delete.ts +++ b/apps/sim/tools/incidentio/escalation_paths_delete.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const escalationPathsDeleteTool: ToolConfig< IncidentioEscalationPathsDeleteParams, @@ -31,7 +32,8 @@ export const escalationPathsDeleteTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/escalation_paths/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/escalation_paths/${safeUrlPathSegment(params.id, 'id')}`, method: 'DELETE', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/escalation_paths_list.ts b/apps/sim/tools/incidentio/escalation_paths_list.ts index c6efa8b1993..b113bd20d9a 100644 --- a/apps/sim/tools/incidentio/escalation_paths_list.ts +++ b/apps/sim/tools/incidentio/escalation_paths_list.ts @@ -1,6 +1,7 @@ -import type { - IncidentioEscalationPathsListParams, - IncidentioEscalationPathsListResponse, +import { + INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, + type IncidentioEscalationPathsListParams, + type IncidentioEscalationPathsListResponse, } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -26,7 +27,7 @@ export const escalationPathsListTool: ToolConfig< type: 'number', required: false, visibility: 'user-or-llm', - description: 'Number of escalation paths to return per page', + description: 'Number of escalation paths to return per page (max 25)', }, after: { type: 'string', @@ -73,16 +74,7 @@ export const escalationPathsListTool: ToolConfig< description: 'List of escalation paths', items: { type: 'object', - properties: { - id: { type: 'string', description: 'The escalation path ID' }, - name: { type: 'string', description: 'The escalation path name' }, - path: { type: 'array', description: 'Array of escalation levels' }, - working_hours: { - type: 'array', - description: 'Working hours configuration', - optional: true, - }, - }, + properties: INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, }, }, pagination_meta: { diff --git a/apps/sim/tools/incidentio/escalation_paths_show.ts b/apps/sim/tools/incidentio/escalation_paths_show.ts index b6d2cc1b38a..b793b2d695b 100644 --- a/apps/sim/tools/incidentio/escalation_paths_show.ts +++ b/apps/sim/tools/incidentio/escalation_paths_show.ts @@ -1,9 +1,11 @@ -import type { - IncidentioEscalationPathsShowParams, - IncidentioEscalationPathsShowResponse, +import { + INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, + type IncidentioEscalationPathsShowParams, + type IncidentioEscalationPathsShowResponse, } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const escalationPathsShowTool: ToolConfig< IncidentioEscalationPathsShowParams, @@ -31,7 +33,8 @@ export const escalationPathsShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/escalation_paths/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/escalation_paths/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -54,58 +57,7 @@ export const escalationPathsShowTool: ToolConfig< escalation_path: { type: 'object', description: 'The escalation path details', - properties: { - id: { type: 'string', description: 'The escalation path ID' }, - name: { type: 'string', description: 'The escalation path name' }, - path: { - type: 'array', - description: 'Array of escalation levels', - items: { - type: 'object', - properties: { - targets: { - type: 'array', - description: 'Targets for this level', - items: { - type: 'object', - properties: { - id: { type: 'string', description: 'Target ID' }, - type: { type: 'string', description: 'Target type' }, - schedule_id: { - type: 'string', - description: 'Schedule ID if type is schedule', - optional: true, - }, - user_id: { - type: 'string', - description: 'User ID if type is user', - optional: true, - }, - urgency: { type: 'string', description: 'Urgency level' }, - }, - }, - }, - time_to_ack_seconds: { - type: 'number', - description: 'Time to acknowledge in seconds', - }, - }, - }, - }, - working_hours: { - type: 'array', - description: 'Working hours configuration', - optional: true, - items: { - type: 'object', - properties: { - weekday: { type: 'string', description: 'Day of week' }, - start_time: { type: 'string', description: 'Start time' }, - end_time: { type: 'string', description: 'End time' }, - }, - }, - }, - }, + properties: INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, }, }, } diff --git a/apps/sim/tools/incidentio/escalation_paths_update.ts b/apps/sim/tools/incidentio/escalation_paths_update.ts index 84160749f18..4bf54784cc7 100644 --- a/apps/sim/tools/incidentio/escalation_paths_update.ts +++ b/apps/sim/tools/incidentio/escalation_paths_update.ts @@ -1,9 +1,11 @@ -import type { - IncidentioEscalationPathsUpdateParams, - IncidentioEscalationPathsUpdateResponse, +import { + INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, + type IncidentioEscalationPathsUpdateParams, + type IncidentioEscalationPathsUpdateResponse, } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const escalationPathsUpdateTool: ToolConfig< IncidentioEscalationPathsUpdateParams, @@ -39,18 +41,20 @@ export const escalationPathsUpdateTool: ToolConfig< required: true, visibility: 'user-or-llm', description: - 'New escalation path configuration. Array of escalation levels with targets and time_to_ack_seconds', + 'New escalation path configuration. Array of escalation path nodes. Each node needs a unique "id" and a "type" (level, notify_channel, delay, if_else, repeat, voicemail, escalation_path); a level node nests its targets under "level", e.g. [{"id":"lvl1","type":"level","level":{"targets":[{"id":"","type":"schedule","schedule_mode":"currently_on_call","urgency":"high"}],"time_to_ack_seconds":300}}]. Target type is schedule, user, slack_channel, or msteams_channel; urgency is high or low.', }, working_hours: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'New working hours configuration. Array of {weekday, start_time, end_time}', + description: + 'New working hours configuration. Array of working-hours windows, each {id, name, timezone, weekday_intervals: [{weekday, start_time, end_time}]}, e.g. [{"id":"wh","name":"Business hours","timezone":"Europe/London","weekday_intervals":[{"weekday":"monday","start_time":"09:00","end_time":"17:00"}]}]', }, }, request: { - url: (params) => `https://api.incident.io/v2/escalation_paths/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/escalation_paths/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', @@ -85,58 +89,7 @@ export const escalationPathsUpdateTool: ToolConfig< escalation_path: { type: 'object', description: 'The updated escalation path', - properties: { - id: { type: 'string', description: 'The escalation path ID' }, - name: { type: 'string', description: 'The escalation path name' }, - path: { - type: 'array', - description: 'Array of escalation levels', - items: { - type: 'object', - properties: { - targets: { - type: 'array', - description: 'Targets for this level', - items: { - type: 'object', - properties: { - id: { type: 'string', description: 'Target ID' }, - type: { type: 'string', description: 'Target type' }, - schedule_id: { - type: 'string', - description: 'Schedule ID if type is schedule', - optional: true, - }, - user_id: { - type: 'string', - description: 'User ID if type is user', - optional: true, - }, - urgency: { type: 'string', description: 'Urgency level' }, - }, - }, - }, - time_to_ack_seconds: { - type: 'number', - description: 'Time to acknowledge in seconds', - }, - }, - }, - }, - working_hours: { - type: 'array', - description: 'Working hours configuration', - optional: true, - items: { - type: 'object', - properties: { - weekday: { type: 'string', description: 'Day of week' }, - start_time: { type: 'string', description: 'Start time' }, - end_time: { type: 'string', description: 'End time' }, - }, - }, - }, - }, + properties: INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES, }, }, } diff --git a/apps/sim/tools/incidentio/escalations_create.ts b/apps/sim/tools/incidentio/escalations_create.ts index 017505f8895..894466d7150 100644 --- a/apps/sim/tools/incidentio/escalations_create.ts +++ b/apps/sim/tools/incidentio/escalations_create.ts @@ -2,6 +2,7 @@ import type { IncidentioEscalationsCreateParams, IncidentioEscalationsCreateResponse, } from '@/tools/incidentio/types' +import { parseIncidentioList } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -11,7 +12,8 @@ export const escalationsCreateTool: ToolConfig< > = { id: 'incidentio_escalations_create', name: 'Create Escalation', - description: 'Create a new escalation policy in incident.io', + description: + 'Page users or an escalation path (create an escalation) in incident.io. Provide either escalation_path_id or user_ids, not both. To create a reusable escalation policy, use Create Escalation Path instead.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -46,7 +48,20 @@ export const escalationsCreateTool: ToolConfig< required: false, visibility: 'user-or-llm', description: - 'Comma-separated list of user IDs to notify (required if escalation_path_id not provided)', + 'Comma-separated list of user IDs to page directly (required if escalation_path_id not provided)', + }, + incident_id: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'ID of an incident to link this escalation to; it appears in the escalation\'s related incidents (e.g., "01H0J1EXE7AXZ2C93K61WBPYEH")', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Additional details included with the page (e.g., "Database CPU above 90%")', }, }, @@ -58,7 +73,7 @@ export const escalationsCreateTool: ToolConfig< Authorization: `Bearer ${params.apiKey}`, }), body: (params) => { - const body: Record = { + const body: Record = { idempotency_key: params.idempotency_key, title: params.title, } @@ -68,9 +83,12 @@ export const escalationsCreateTool: ToolConfig< } if (params.user_ids) { - body.user_ids = params.user_ids.split(',').map((id: string) => id.trim()) + body.user_ids = parseIncidentioList(params.user_ids) } + if (params.incident_id) body.incident_id = params.incident_id.trim() + if (params.description) body.description = params.description + return body }, }, diff --git a/apps/sim/tools/incidentio/escalations_list.ts b/apps/sim/tools/incidentio/escalations_list.ts index 436741720a4..baf8237f0ae 100644 --- a/apps/sim/tools/incidentio/escalations_list.ts +++ b/apps/sim/tools/incidentio/escalations_list.ts @@ -11,7 +11,8 @@ export const escalationsListTool: ToolConfig< > = { id: 'incidentio_escalations_list', name: 'List Escalations', - description: 'List all escalation policies in incident.io', + description: + 'List escalations (pages sent to people) in incident.io. For escalation policies, use List Escalation Paths.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -26,7 +27,7 @@ export const escalationsListTool: ToolConfig< type: 'number', required: false, visibility: 'user-or-llm', - description: 'Number of escalations to return per page', + description: 'Number of escalations to return per page (max 50)', }, after: { type: 'string', diff --git a/apps/sim/tools/incidentio/escalations_show.ts b/apps/sim/tools/incidentio/escalations_show.ts index 867ecf1b6d9..d9dad694aca 100644 --- a/apps/sim/tools/incidentio/escalations_show.ts +++ b/apps/sim/tools/incidentio/escalations_show.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const escalationsShowTool: ToolConfig< IncidentioEscalationsShowParams, @@ -11,7 +12,8 @@ export const escalationsShowTool: ToolConfig< > = { id: 'incidentio_escalations_show', name: 'Show Escalation', - description: 'Get details of a specific escalation policy in incident.io', + description: + 'Get an escalation (a page sent to people) in incident.io. For an escalation policy, use Show Escalation Path.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -26,12 +28,13 @@ export const escalationsShowTool: ToolConfig< type: 'string', required: true, visibility: 'user-or-llm', - description: 'The ID of the escalation policy (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")', + description: 'The ID of the escalation (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")', }, }, request: { - url: (params) => `https://api.incident.io/v2/escalations/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/escalations/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/follow_ups_create.ts b/apps/sim/tools/incidentio/follow_ups_create.ts index 96ed38a0e49..7baac5cb8da 100644 --- a/apps/sim/tools/incidentio/follow_ups_create.ts +++ b/apps/sim/tools/incidentio/follow_ups_create.ts @@ -3,6 +3,7 @@ import { type IncidentioFollowUpsCreateParams, type IncidentioFollowUpsCreateResponse, } from '@/tools/incidentio/types' +import { parseIncidentioList } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -81,7 +82,7 @@ export const followUpsCreateTool: ToolConfig< }, request: { - url: 'https://api.incident.io/v2/follow_ups', + url: 'https://api.incident.io/v3/follow_ups', method: 'POST', headers: (params) => ({ 'Content-Type': 'application/json', @@ -105,12 +106,7 @@ export const followUpsCreateTool: ToolConfig< if (params.external_issue_reference_id) { body.external_issue_reference_id = params.external_issue_reference_id.trim() } - if (params.labels) { - body.labels = params.labels - .split(',') - .map((label) => label.trim()) - .filter(Boolean) - } + if (params.labels) body.labels = parseIncidentioList(params.labels) return body }, diff --git a/apps/sim/tools/incidentio/follow_ups_list.ts b/apps/sim/tools/incidentio/follow_ups_list.ts index dfab9d0132e..04500e3654a 100644 --- a/apps/sim/tools/incidentio/follow_ups_list.ts +++ b/apps/sim/tools/incidentio/follow_ups_list.ts @@ -1,7 +1,11 @@ -import type { - IncidentioFollowUpsListParams, - IncidentioFollowUpsListResponse, +import { + INCIDENTIO_CURSOR_PAGINATION_OUTPUT, + INCIDENTIO_FOLLOW_UP_SUMMARY_OUTPUT_PROPERTIES, + INCIDENTIO_V3_MAX_PAGE_SIZE, + type IncidentioFollowUpsListParams, + type IncidentioFollowUpsListResponse, } from '@/tools/incidentio/types' +import { collectIncidentioPages, mapIncidentioFollowUpSummary } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' @@ -11,7 +15,8 @@ export const followUpsListTool: ToolConfig< > = { id: 'incidentio_follow_ups_list', name: 'incident.io Follow-ups List', - description: 'List follow-ups from incident.io. Optionally filter by incident ID.', + description: + 'List follow-ups from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 follow-ups, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -33,13 +38,27 @@ export const followUpsListTool: ToolConfig< required: false, visibility: 'user-or-llm', description: - 'Filter follow-ups by incident mode (standard, retrospective, test, tutorial, or stream)', + 'Filter follow-ups by incident mode (standard, retrospective, test, tutorial, or stream). When omitted, follow-ups from standard and retrospective incidents are returned.', + }, + page_size: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: + 'Number of follow-ups per page, 1-250. Setting it fetches a single page instead of following pages automatically', + }, + after: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Pagination cursor from a previous page\'s pagination_meta.after (e.g., "01FDAG4SAP5TYPT98WGR2N7W91")', }, }, request: { url: (params) => { - const url = new URL('https://api.incident.io/v2/follow_ups') + const url = new URL('https://api.incident.io/v3/follow_ups') if (params.incident_id) { url.searchParams.append('incident_id', params.incident_id.trim()) @@ -49,6 +68,12 @@ export const followUpsListTool: ToolConfig< url.searchParams.append('incident_mode', params.incident_mode) } + url.searchParams.append('page_size', String(params.page_size || INCIDENTIO_V3_MAX_PAGE_SIZE)) + + if (params.after) { + url.searchParams.append('after', params.after.trim()) + } + return url.toString() }, method: 'GET', @@ -64,47 +89,39 @@ export const followUpsListTool: ToolConfig< return { success: true, output: { - follow_ups: - data.follow_ups?.map((followUp: any) => ({ - id: followUp.id, - title: followUp.title || '', - description: followUp.description, - assignee: followUp.assignee - ? { - id: followUp.assignee.id, - name: followUp.assignee.name, - email: followUp.assignee.email, - } - : undefined, - status: followUp.status, - priority: followUp.priority - ? { - id: followUp.priority.id, - name: followUp.priority.name, - description: followUp.priority.description, - rank: followUp.priority.rank, - } - : undefined, - created_at: followUp.created_at, - updated_at: followUp.updated_at, - incident_id: followUp.incident_id, - creator: followUp.creator - ? { - id: followUp.creator.id, - name: followUp.creator.name, - email: followUp.creator.email, - } - : undefined, - completed_at: followUp.completed_at, - labels: followUp.labels || [], - external_issue_reference: followUp.external_issue_reference - ? { - provider: followUp.external_issue_reference.provider, - issue_name: followUp.external_issue_reference.issue_name, - issue_permalink: followUp.external_issue_reference.issue_permalink, - } - : undefined, - })) || [], + follow_ups: Array.isArray(data.follow_ups) + ? data.follow_ups.map(mapIncidentioFollowUpSummary) + : [], + pagination_meta: data.pagination_meta, + }, + } + }, + + postProcess: async (result, params, executeTool) => { + const firstAfter = result.output.pagination_meta?.after + if (params.page_size || params.after || !firstAfter) return result + + const collected = await collectIncidentioPages( + { items: result.output.follow_ups, after: firstAfter }, + 'follow_ups', + (after) => + executeTool('incidentio_follow_ups_list', { + ...params, + after, + page_size: INCIDENTIO_V3_MAX_PAGE_SIZE, + }) + ) + if ('error' in collected) { + return { success: false, output: result.output, error: collected.error } + } + return { + success: true, + output: { + follow_ups: collected.items, + pagination_meta: result.output.pagination_meta && { + ...result.output.pagination_meta, + after: collected.after, + }, }, } }, @@ -115,60 +132,9 @@ export const followUpsListTool: ToolConfig< description: 'List of follow-ups', items: { type: 'object', - properties: { - id: { type: 'string', description: 'Follow-up ID' }, - title: { type: 'string', description: 'Follow-up title' }, - description: { type: 'string', description: 'Follow-up description' }, - assignee: { - type: 'object', - description: 'Assigned user', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - status: { type: 'string', description: 'Follow-up status' }, - priority: { - type: 'object', - description: 'Follow-up priority', - optional: true, - properties: { - id: { type: 'string', description: 'Priority ID' }, - name: { type: 'string', description: 'Priority name' }, - description: { type: 'string', description: 'Priority description' }, - rank: { type: 'number', description: 'Priority rank' }, - }, - }, - created_at: { type: 'string', description: 'Creation timestamp' }, - updated_at: { type: 'string', description: 'Last update timestamp' }, - incident_id: { type: 'string', description: 'Associated incident ID' }, - creator: { - type: 'object', - description: 'User who created the follow-up', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - completed_at: { type: 'string', description: 'Completion timestamp' }, - labels: { - type: 'array', - description: 'Labels associated with the follow-up', - items: { type: 'string' }, - }, - external_issue_reference: { - type: 'object', - description: 'External issue tracking reference', - properties: { - provider: { type: 'string', description: 'External provider name' }, - issue_name: { type: 'string', description: 'External issue name or ID' }, - issue_permalink: { type: 'string', description: 'Permalink to external issue' }, - }, - }, - }, + properties: INCIDENTIO_FOLLOW_UP_SUMMARY_OUTPUT_PROPERTIES, }, }, + pagination_meta: INCIDENTIO_CURSOR_PAGINATION_OUTPUT, }, } diff --git a/apps/sim/tools/incidentio/follow_ups_show.ts b/apps/sim/tools/incidentio/follow_ups_show.ts index 6dce2324cd6..9743a19aa84 100644 --- a/apps/sim/tools/incidentio/follow_ups_show.ts +++ b/apps/sim/tools/incidentio/follow_ups_show.ts @@ -1,9 +1,12 @@ -import type { - IncidentioFollowUpsShowParams, - IncidentioFollowUpsShowResponse, +import { + INCIDENTIO_FOLLOW_UP_SUMMARY_OUTPUT_PROPERTIES, + type IncidentioFollowUpsShowParams, + type IncidentioFollowUpsShowResponse, } from '@/tools/incidentio/types' +import { mapIncidentioFollowUpSummary } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const followUpsShowTool: ToolConfig< IncidentioFollowUpsShowParams, @@ -31,7 +34,7 @@ export const followUpsShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/follow_ups/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v3/follow_ups/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -45,46 +48,7 @@ export const followUpsShowTool: ToolConfig< return { success: true, output: { - follow_up: { - id: data.follow_up.id, - title: data.follow_up.title || '', - description: data.follow_up.description, - assignee: data.follow_up.assignee - ? { - id: data.follow_up.assignee.id, - name: data.follow_up.assignee.name, - email: data.follow_up.assignee.email, - } - : undefined, - status: data.follow_up.status, - priority: data.follow_up.priority - ? { - id: data.follow_up.priority.id, - name: data.follow_up.priority.name, - description: data.follow_up.priority.description, - rank: data.follow_up.priority.rank, - } - : undefined, - created_at: data.follow_up.created_at, - updated_at: data.follow_up.updated_at, - incident_id: data.follow_up.incident_id, - creator: data.follow_up.creator - ? { - id: data.follow_up.creator.id, - name: data.follow_up.creator.name, - email: data.follow_up.creator.email, - } - : undefined, - completed_at: data.follow_up.completed_at, - labels: data.follow_up.labels || [], - external_issue_reference: data.follow_up.external_issue_reference - ? { - provider: data.follow_up.external_issue_reference.provider, - issue_name: data.follow_up.external_issue_reference.issue_name, - issue_permalink: data.follow_up.external_issue_reference.issue_permalink, - } - : undefined, - }, + follow_up: mapIncidentioFollowUpSummary(data.follow_up), }, } }, @@ -93,59 +57,7 @@ export const followUpsShowTool: ToolConfig< follow_up: { type: 'object', description: 'Follow-up details', - properties: { - id: { type: 'string', description: 'Follow-up ID' }, - title: { type: 'string', description: 'Follow-up title' }, - description: { type: 'string', description: 'Follow-up description' }, - assignee: { - type: 'object', - description: 'Assigned user', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - status: { type: 'string', description: 'Follow-up status' }, - priority: { - type: 'object', - description: 'Follow-up priority', - optional: true, - properties: { - id: { type: 'string', description: 'Priority ID' }, - name: { type: 'string', description: 'Priority name' }, - description: { type: 'string', description: 'Priority description' }, - rank: { type: 'number', description: 'Priority rank' }, - }, - }, - created_at: { type: 'string', description: 'Creation timestamp' }, - updated_at: { type: 'string', description: 'Last update timestamp' }, - incident_id: { type: 'string', description: 'Associated incident ID' }, - creator: { - type: 'object', - description: 'User who created the follow-up', - properties: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, - }, - completed_at: { type: 'string', description: 'Completion timestamp' }, - labels: { - type: 'array', - description: 'Labels associated with the follow-up', - items: { type: 'string' }, - }, - external_issue_reference: { - type: 'object', - description: 'External issue tracking reference', - properties: { - provider: { type: 'string', description: 'External provider name' }, - issue_name: { type: 'string', description: 'External issue name or ID' }, - issue_permalink: { type: 'string', description: 'Permalink to external issue' }, - }, - }, - }, + properties: INCIDENTIO_FOLLOW_UP_SUMMARY_OUTPUT_PROPERTIES, }, }, } diff --git a/apps/sim/tools/incidentio/follow_ups_update.ts b/apps/sim/tools/incidentio/follow_ups_update.ts index 8b3457e2af0..03caf146fc4 100644 --- a/apps/sim/tools/incidentio/follow_ups_update.ts +++ b/apps/sim/tools/incidentio/follow_ups_update.ts @@ -3,8 +3,10 @@ import { type IncidentioFollowUpsUpdateParams, type IncidentioFollowUpsUpdateResponse, } from '@/tools/incidentio/types' +import { parseIncidentioList } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const followUpsUpdateTool: ToolConfig< IncidentioFollowUpsUpdateParams, @@ -82,8 +84,7 @@ export const followUpsUpdateTool: ToolConfig< }, request: { - url: (params) => - `https://api.incident.io/v2/follow_ups/${encodeURIComponent(params.id.trim())}`, + url: (params) => `https://api.incident.io/v3/follow_ups/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', @@ -104,12 +105,7 @@ export const followUpsUpdateTool: ToolConfig< if (params.follow_up_priority_option_id) { body.follow_up_priority_option_id = params.follow_up_priority_option_id.trim() } - if (params.labels) { - body.labels = params.labels - .split(',') - .map((label) => label.trim()) - .filter(Boolean) - } + if (params.labels) body.labels = parseIncidentioList(params.labels) return body }, diff --git a/apps/sim/tools/incidentio/incident_alerts_list.ts b/apps/sim/tools/incidentio/incident_alerts_list.ts index 70d1d9780db..0a7b38eecce 100644 --- a/apps/sim/tools/incidentio/incident_alerts_list.ts +++ b/apps/sim/tools/incidentio/incident_alerts_list.ts @@ -30,7 +30,7 @@ export const incidentAlertsListTool: ToolConfig< type: 'number', required: false, visibility: 'user-or-llm', - description: 'Number of results per page (e.g., 10, 25, 50). Default: 25', + description: 'Number of results per page (e.g., 10, 25, 50; max 50). Default: 25', }, after: { type: 'string', diff --git a/apps/sim/tools/incidentio/incident_roles_create.ts b/apps/sim/tools/incidentio/incident_roles_create.ts index f5a53a648c6..d3cd146b81b 100644 --- a/apps/sim/tools/incidentio/incident_roles_create.ts +++ b/apps/sim/tools/incidentio/incident_roles_create.ts @@ -95,7 +95,11 @@ export const incidentRolesCreateTool: ToolConfig< description: 'Short form abbreviation of the role', }, role_type: { type: 'string', description: 'The type of role' }, - required: { type: 'boolean', description: 'Whether the role is required' }, + required: { + type: 'boolean', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, created_at: { type: 'string', description: 'When the role was created' }, updated_at: { type: 'string', description: 'When the role was last updated' }, }, diff --git a/apps/sim/tools/incidentio/incident_roles_delete.ts b/apps/sim/tools/incidentio/incident_roles_delete.ts index 54d87c9ce18..d5af00950dc 100644 --- a/apps/sim/tools/incidentio/incident_roles_delete.ts +++ b/apps/sim/tools/incidentio/incident_roles_delete.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentRolesDeleteTool: ToolConfig< IncidentioIncidentRolesDeleteParams, @@ -31,7 +32,8 @@ export const incidentRolesDeleteTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incident_roles/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/incident_roles/${safeUrlPathSegment(params.id, 'id')}`, method: 'DELETE', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/incident_roles_list.ts b/apps/sim/tools/incidentio/incident_roles_list.ts index a56e48aea0f..43f191e494c 100644 --- a/apps/sim/tools/incidentio/incident_roles_list.ts +++ b/apps/sim/tools/incidentio/incident_roles_list.ts @@ -67,7 +67,11 @@ export const incidentRolesListTool: ToolConfig< description: 'Short form abbreviation of the role', }, role_type: { type: 'string', description: 'The type of role' }, - required: { type: 'boolean', description: 'Whether the role is required' }, + required: { + type: 'boolean', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, created_at: { type: 'string', description: 'When the role was created' }, updated_at: { type: 'string', description: 'When the role was last updated' }, }, diff --git a/apps/sim/tools/incidentio/incident_roles_show.ts b/apps/sim/tools/incidentio/incident_roles_show.ts index 313d743aaf8..117731ee745 100644 --- a/apps/sim/tools/incidentio/incident_roles_show.ts +++ b/apps/sim/tools/incidentio/incident_roles_show.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentRolesShowTool: ToolConfig< IncidentioIncidentRolesShowParams, @@ -31,7 +32,8 @@ export const incidentRolesShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incident_roles/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/incident_roles/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -71,7 +73,11 @@ export const incidentRolesShowTool: ToolConfig< description: 'Short form abbreviation of the role', }, role_type: { type: 'string', description: 'The type of role' }, - required: { type: 'boolean', description: 'Whether the role is required' }, + required: { + type: 'boolean', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, created_at: { type: 'string', description: 'When the role was created' }, updated_at: { type: 'string', description: 'When the role was last updated' }, }, diff --git a/apps/sim/tools/incidentio/incident_roles_update.ts b/apps/sim/tools/incidentio/incident_roles_update.ts index 25db7b3634f..24efe88d611 100644 --- a/apps/sim/tools/incidentio/incident_roles_update.ts +++ b/apps/sim/tools/incidentio/incident_roles_update.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentRolesUpdateTool: ToolConfig< IncidentioIncidentRolesUpdateParams, @@ -55,7 +56,8 @@ export const incidentRolesUpdateTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incident_roles/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/incident_roles/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', @@ -101,7 +103,11 @@ export const incidentRolesUpdateTool: ToolConfig< description: 'Short form abbreviation of the role', }, role_type: { type: 'string', description: 'The type of role' }, - required: { type: 'boolean', description: 'Whether the role is required' }, + required: { + type: 'boolean', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, created_at: { type: 'string', description: 'When the role was created' }, updated_at: { type: 'string', description: 'When the role was last updated' }, }, diff --git a/apps/sim/tools/incidentio/incident_timestamps_list.ts b/apps/sim/tools/incidentio/incident_timestamps_list.ts index 28900d6c49d..a6c8fa2c391 100644 --- a/apps/sim/tools/incidentio/incident_timestamps_list.ts +++ b/apps/sim/tools/incidentio/incident_timestamps_list.ts @@ -54,8 +54,16 @@ export const incidentTimestampsListTool: ToolConfig< id: { type: 'string', description: 'The timestamp ID' }, name: { type: 'string', description: 'The timestamp name' }, rank: { type: 'number', description: 'The rank/order of the timestamp' }, - created_at: { type: 'string', description: 'When the timestamp was created' }, - updated_at: { type: 'string', description: 'When the timestamp was last updated' }, + created_at: { + type: 'string', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, + updated_at: { + type: 'string', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, }, }, }, diff --git a/apps/sim/tools/incidentio/incident_timestamps_show.ts b/apps/sim/tools/incidentio/incident_timestamps_show.ts index c75548f1f56..26b18dc0722 100644 --- a/apps/sim/tools/incidentio/incident_timestamps_show.ts +++ b/apps/sim/tools/incidentio/incident_timestamps_show.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentTimestampsShowTool: ToolConfig< IncidentioIncidentTimestampsShowParams, @@ -31,7 +32,8 @@ export const incidentTimestampsShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incident_timestamps/${params.id.trim()}`, + url: (params) => + `https://api.incident.io/v2/incident_timestamps/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -58,8 +60,16 @@ export const incidentTimestampsShowTool: ToolConfig< id: { type: 'string', description: 'The timestamp ID' }, name: { type: 'string', description: 'The timestamp name' }, rank: { type: 'number', description: 'The rank/order of the timestamp' }, - created_at: { type: 'string', description: 'When the timestamp was created' }, - updated_at: { type: 'string', description: 'When the timestamp was last updated' }, + created_at: { + type: 'string', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, + updated_at: { + type: 'string', + description: 'Not returned by the incident.io API; always empty', + optional: true, + }, }, }, }, diff --git a/apps/sim/tools/incidentio/incidents_create.ts b/apps/sim/tools/incidentio/incidents_create.ts index 0d4bad9a187..0d41bebc26e 100644 --- a/apps/sim/tools/incidentio/incidents_create.ts +++ b/apps/sim/tools/incidentio/incidents_create.ts @@ -12,7 +12,7 @@ export const incidentsCreateTool: ToolConfig< id: 'incidentio_incidents_create', name: 'incident.io Incidents Create', description: - 'Create a new incident in incident.io. Requires idempotency_key, severity_id, and visibility. Optionally accepts name, summary, type, and status.', + 'Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -45,7 +45,7 @@ export const incidentsCreateTool: ToolConfig< }, severity_id: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', description: 'ID of the severity level (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")', }, @@ -77,12 +77,12 @@ export const incidentsCreateTool: ToolConfig< Authorization: `Bearer ${params.apiKey}`, }), body: (params) => { - const body: Record = { + const body: Record = { idempotency_key: params.idempotency_key, - severity_id: params.severity_id, visibility: params.visibility, } + if (params.severity_id) body.severity_id = params.severity_id if (params.name) body.name = params.name if (params.summary) body.summary = params.summary if (params.incident_type_id) body.incident_type_id = params.incident_type_id diff --git a/apps/sim/tools/incidentio/incidents_show.ts b/apps/sim/tools/incidentio/incidents_show.ts index 19ccb05ac5b..f64bdc9ab75 100644 --- a/apps/sim/tools/incidentio/incidents_show.ts +++ b/apps/sim/tools/incidentio/incidents_show.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentsShowTool: ToolConfig< IncidentioIncidentsShowParams, @@ -32,7 +33,7 @@ export const incidentsShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incidents/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/incidents/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -89,6 +90,16 @@ export const incidentsShowTool: ToolConfig< value_text: value.value_text, value_link: value.value_link, value_numeric: value.value_numeric, + value_option: value.value_option + ? { id: value.value_option.id, value: value.value_option.value } + : undefined, + value_catalog_entry: value.value_catalog_entry + ? { + id: value.value_catalog_entry.id, + name: value.value_catalog_entry.name, + external_id: value.value_catalog_entry.external_id, + } + : undefined, })), })), incident_role_assignments: incident.incident_role_assignments?.map((assignment: any) => ({ @@ -158,7 +169,8 @@ export const incidentsShowTool: ToolConfig< visibility: { type: 'string', description: 'Incident visibility' }, custom_field_entries: { type: 'array', - description: 'Custom field values for the incident', + description: + 'Custom field values for the incident. Each value carries one of value_text, value_link, value_numeric, value_option ({id, value}), or value_catalog_entry ({id, name, external_id}).', }, incident_role_assignments: { type: 'array', diff --git a/apps/sim/tools/incidentio/incidents_update.ts b/apps/sim/tools/incidentio/incidents_update.ts index 41e5d88f97c..1d932f119ca 100644 --- a/apps/sim/tools/incidentio/incidents_update.ts +++ b/apps/sim/tools/incidentio/incidents_update.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const incidentsUpdateTool: ToolConfig< IncidentioIncidentsUpdateParams, @@ -12,7 +13,7 @@ export const incidentsUpdateTool: ToolConfig< id: 'incidentio_incidents_update', name: 'incident.io Incidents Update', description: - 'Update an existing incident in incident.io. Can update name, summary, severity, status, or type.', + 'Update an existing incident in incident.io. Can update name, summary, severity, or status.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, @@ -58,7 +59,8 @@ export const incidentsUpdateTool: ToolConfig< type: 'string', required: false, visibility: 'user-or-llm', - description: 'Updated incident type ID', + description: + "Not applied: incident.io does not support changing an incident's type after creation, so this value is ignored.", }, notify_incident_channel: { type: 'boolean', @@ -69,23 +71,21 @@ export const incidentsUpdateTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/incidents/${params.id.trim()}/actions/edit`, + url: (params) => + `https://api.incident.io/v2/incidents/${safeUrlPathSegment(params.id, 'id')}/actions/edit`, method: 'POST', headers: (params) => ({ 'Content-Type': 'application/json', Authorization: `Bearer ${params.apiKey}`, }), body: (params) => { - // Create incident object - const incident: Record = {} + const incident: Record = {} if (params.name) incident.name = params.name if (params.summary) incident.summary = params.summary if (params.severity_id) incident.severity_id = params.severity_id if (params.incident_status_id) incident.incident_status_id = params.incident_status_id - if (params.incident_type_id) incident.incident_type_id = params.incident_type_id - // Wrap in incident object with required notify_incident_channel return { incident, notify_incident_channel: params.notify_incident_channel, diff --git a/apps/sim/tools/incidentio/requests.test.ts b/apps/sim/tools/incidentio/requests.test.ts new file mode 100644 index 00000000000..316a5a02a80 --- /dev/null +++ b/apps/sim/tools/incidentio/requests.test.ts @@ -0,0 +1,168 @@ +import { describe, expect, it } from 'vitest' +import { actionsListTool } from '@/tools/incidentio/actions_list' +import { escalationsCreateTool } from '@/tools/incidentio/escalations_create' +import { followUpsListTool } from '@/tools/incidentio/follow_ups_list' +import { followUpsShowTool } from '@/tools/incidentio/follow_ups_show' +import { incidentsUpdateTool } from '@/tools/incidentio/incidents_update' +import { workflowsShowTool } from '@/tools/incidentio/workflows_show' +import { workflowsUpdateTool } from '@/tools/incidentio/workflows_update' +import type { ToolConfig, ToolResponse } from '@/tools/types' + +function requestUrl(tool: ToolConfig, params: Record): URL { + const { url } = tool.request + return new URL(typeof url === 'function' ? url(params) : url) +} + +function requestBody(tool: ToolConfig, params: Record): Record { + const body = tool.request.body + if (!body) throw new Error(`${tool.id} has no request body`) + return body(params) as Record +} + +async function transform(tool: ToolConfig, payload: unknown) { + if (!tool.transformResponse) throw new Error(`${tool.id} has no transformResponse`) + return tool.transformResponse(new Response(JSON.stringify(payload))) +} + +describe('incident.io requests', () => { + it('lists actions from the paginated v3 endpoint (v2 is removed on 2026-12-31)', () => { + const url = requestUrl(actionsListTool, { apiKey: 'k', page_size: 100, after: 'act_9' }) + expect(url.pathname).toBe('/v3/actions') + expect(url.searchParams.get('page_size')).toBe('100') + expect(url.searchParams.get('after')).toBe('act_9') + }) + + it('requests a full page of actions and follow-ups unless the caller pages explicitly', () => { + expect(requestUrl(actionsListTool, { apiKey: 'k' }).searchParams.get('page_size')).toBe('250') + expect(requestUrl(followUpsListTool, { apiKey: 'k' }).searchParams.get('page_size')).toBe('250') + }) + + it('reads the follow-up creator from the actor envelope', async () => { + const result = await transform(followUpsShowTool, { + follow_up: { + id: 'fu_1', + title: 'Add alerting', + status: 'outstanding', + labels: [], + creator: { api_key: { id: 'key_1', name: 'Deploy bot' } }, + }, + }) + expect(result.output.follow_up.creator).toMatchObject({ + id: 'key_1', + name: 'Deploy bot', + api_key: { id: 'key_1', name: 'Deploy bot' }, + }) + }) + + it('outputs the workflow trigger name, not the trigger object', async () => { + const result = await transform(workflowsShowTool, { + workflow: { id: 'wf_1', trigger: { name: 'incident.updated', label: 'Incident Updated' } }, + }) + expect(result.output.workflow.trigger).toBe('incident.updated') + }) + + it('accepts already-structured workflow JSON params from a model', () => { + const body = requestBody(workflowsUpdateTool, { + apiKey: 'k', + id: 'wf_1', + name: 'Notify', + once_for: [], + condition_groups: [], + steps: [{ name: 'slack.post_message' }], + expressions: '[]', + runs_on_incident_modes: ['standard'], + }) + expect(body.steps).toEqual([{ name: 'slack.post_message' }]) + expect(body.once_for).toEqual([]) + expect(body.expressions).toEqual([]) + }) + + it('accepts escalation user_ids as an array', () => { + const body = requestBody(escalationsCreateTool, { + apiKey: 'k', + idempotency_key: 'i', + title: 'DB down', + user_ids: ['u1', ' u2 '], + }) + expect(body.user_ids).toEqual(['u1', 'u2']) + }) + + it('never sends an incident type on edit, which incident.io does not support', () => { + const body = requestBody(incidentsUpdateTool, { + apiKey: 'k', + id: 'inc_1', + incident_type_id: 'type_1', + notify_incident_channel: false, + }) + expect(body.incident).toEqual({}) + }) +}) + +describe('incident.io list auto-pagination', () => { + type ExecuteTool = Parameters>[2] + + /** Serves `pageCount` pages of one follow-up each, chained by cursor. */ + function pagedFollowUps(pageCount: number) { + const calls: Record[] = [] + const page = (n: number): ToolResponse => ({ + success: true, + output: { + follow_ups: [{ id: `fu_${n}` }], + pagination_meta: { page_size: 250, after: n < pageCount ? `fu_${n}` : undefined }, + }, + }) + const executeTool: ExecuteTool = async (_toolId, params) => { + calls.push(params) + return page(Number(String(params.after).slice(3)) + 1) + } + return { first: page(1), calls, executeTool } + } + + async function postProcess( + tool: ToolConfig, + result: ToolResponse, + params: object, + executeTool: ExecuteTool + ) { + if (!tool.postProcess) throw new Error(`${tool.id} has no postProcess`) + return tool.postProcess(result, params, executeTool) + } + + it('returns every follow-up, not just the oldest page, when the caller does not page', async () => { + const { first, calls, executeTool } = pagedFollowUps(3) + const result = await postProcess(followUpsListTool, first, { apiKey: 'k' }, executeTool) + expect(result.output.follow_ups.map((f: { id: string }) => f.id)).toEqual([ + 'fu_1', + 'fu_2', + 'fu_3', + ]) + expect(result.output.pagination_meta.after).toBeUndefined() + expect(calls[0]).toMatchObject({ apiKey: 'k', after: 'fu_1', page_size: 250 }) + }) + + it('stops at 2,500 records and leaves the cursor to resume from', async () => { + const { first, calls, executeTool } = pagedFollowUps(12) + const result = await postProcess(followUpsListTool, first, { apiKey: 'k' }, executeTool) + expect(calls).toHaveLength(9) + expect(result.output.follow_ups).toHaveLength(10) + expect(result.output.pagination_meta.after).toBe('fu_10') + }) + + it('fetches one page when the caller sets page_size or after', async () => { + const { first, calls, executeTool } = pagedFollowUps(3) + await postProcess(followUpsListTool, first, { apiKey: 'k', page_size: 50 }, executeTool) + await postProcess(actionsListTool, first, { apiKey: 'k', after: 'act_1' }, executeTool) + expect(calls).toHaveLength(0) + }) + + it('fails instead of returning a partial list when a later page fails', async () => { + const first: ToolResponse = { + success: true, + output: { actions: [{ id: 'act_1' }], pagination_meta: { page_size: 250, after: 'act_1' } }, + } + const failing: ExecuteTool = async () => ({ success: false, output: {}, error: 'rate limited' }) + const result = await postProcess(actionsListTool, first, { apiKey: 'k' }, failing) + expect(result.success).toBe(false) + expect(result.error).toBe('rate limited') + }) +}) diff --git a/apps/sim/tools/incidentio/schedules_delete.ts b/apps/sim/tools/incidentio/schedules_delete.ts index 570d71bd667..d74b77ba039 100644 --- a/apps/sim/tools/incidentio/schedules_delete.ts +++ b/apps/sim/tools/incidentio/schedules_delete.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const schedulesDeleteTool: ToolConfig< IncidentioSchedulesDeleteParams, @@ -31,7 +32,7 @@ export const schedulesDeleteTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/schedules/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/schedules/${safeUrlPathSegment(params.id, 'id')}`, method: 'DELETE', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/schedules_list.ts b/apps/sim/tools/incidentio/schedules_list.ts index ce4a4215897..d2944e5abb7 100644 --- a/apps/sim/tools/incidentio/schedules_list.ts +++ b/apps/sim/tools/incidentio/schedules_list.ts @@ -66,6 +66,7 @@ export const schedulesListTool: ToolConfig< ? { after: data.pagination_meta.after, page_size: data.pagination_meta.page_size, + total_record_count: data.pagination_meta.total_record_count, } : undefined, }, @@ -138,6 +139,11 @@ export const schedulesListTool: ToolConfig< properties: { after: { type: 'string', description: 'Cursor for next page', optional: true }, page_size: { type: 'number', description: 'Number of results per page' }, + total_record_count: { + type: 'number', + description: 'Total number of schedules', + optional: true, + }, }, }, }, diff --git a/apps/sim/tools/incidentio/schedules_show.ts b/apps/sim/tools/incidentio/schedules_show.ts index 5ecf4c5b7ae..94ac2c4e34b 100644 --- a/apps/sim/tools/incidentio/schedules_show.ts +++ b/apps/sim/tools/incidentio/schedules_show.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const schedulesShowTool: ToolConfig< IncidentioSchedulesShowParams, @@ -31,7 +32,7 @@ export const schedulesShowTool: ToolConfig< }, request: { - url: (params) => `https://api.incident.io/v2/schedules/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/schedules/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/schedules_update.ts b/apps/sim/tools/incidentio/schedules_update.ts index 489ca18a9cb..4ead860fa85 100644 --- a/apps/sim/tools/incidentio/schedules_update.ts +++ b/apps/sim/tools/incidentio/schedules_update.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const schedulesUpdateTool: ToolConfig< IncidentioSchedulesUpdateParams, @@ -45,12 +46,12 @@ export const schedulesUpdateTool: ToolConfig< required: false, visibility: 'user-or-llm', description: - 'Schedule configuration as JSON string with rotations. Example: {"rotations": [{"name": "Primary", "users": [{"id": "user_id"}], "handover_start_at": "2024-01-01T09:00:00Z", "handovers": [{"interval": 1, "interval_type": "weekly"}]}]}', + 'Schedule configuration as JSON with rotations. Sending it replaces the entire configuration, including any scheduled future versions of its rotations, so fetch the schedule first and include every version you want to keep. Example: {"rotations": [{"name": "Primary", "users": [{"id": "user_id"}], "handover_start_at": "2024-01-01T09:00:00Z", "handovers": [{"interval": 1, "interval_type": "weekly"}]}]}', }, }, request: { - url: (params) => `https://api.incident.io/v2/schedules/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/schedules/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/types.ts b/apps/sim/tools/incidentio/types.ts index d505ddb9a90..5bcd173a35c 100644 --- a/apps/sim/tools/incidentio/types.ts +++ b/apps/sim/tools/incidentio/types.ts @@ -265,6 +265,18 @@ export const INCIDENTIO_ALERT_OUTPUT_PROPERTIES = { optional: true, items: { type: 'object' }, }, + tags: { + type: 'array', + description: 'Tags someone has applied to this alert', + optional: true, + items: { + type: 'object', + properties: { + id: { type: 'string', description: 'Tag ID' }, + name: { type: 'string', description: 'Tag name' }, + }, + }, + }, } as const satisfies Record /** @@ -429,7 +441,7 @@ export interface IncidentioIncidentsCreateParams extends IncidentioBaseParams { idempotency_key: string name?: string summary?: string - severity_id: string + severity_id?: string incident_type_id?: string incident_status_id?: string visibility: string @@ -501,39 +513,47 @@ export interface IncidentioIncidentsUpdateResponse extends ToolResponse { export interface IncidentioActionsListParams extends IncidentioBaseParams { incident_id?: string incident_mode?: 'standard' | 'retrospective' | 'test' | 'tutorial' | 'stream' + page_size?: number + after?: string } -interface IncidentioAction { +/** + * Who created an action or follow-up, as the list/show tools output it: `id`/`name`/`email` are + * read from whichever actor is set, and the raw actor envelope is passed through alongside. + */ +export interface IncidentioLegacyCreator { + id?: string + name?: string + email?: string + user?: IncidentioSlimUser + api_key?: { id: string; name: string } + workflow?: { id: string; name: string } + alert?: { id: string; title: string } +} + +/** A user an action or follow-up is assigned to, as the list/show tools output it. */ +interface IncidentioSummaryAssignee { + id: string + name: string + email?: string +} + +export interface IncidentioActionSummary { id: string description: string - assignee?: { - id: string - name: string - email: string - role?: string - slack_user_id?: string - } + assignee?: IncidentioSummaryAssignee status: string - due_at?: string created_at: string updated_at: string incident_id?: string - creator?: { - id: string - name: string - email: string - } + creator?: IncidentioLegacyCreator completed_at?: string - external_issue_reference?: { - provider: string - issue_name: string - issue_permalink: string - } } export interface IncidentioActionsListResponse extends ToolResponse { output: { - actions: IncidentioAction[] + actions: IncidentioActionSummary[] + pagination_meta?: IncidentioPaginationMeta } } @@ -543,7 +563,7 @@ export interface IncidentioActionsShowParams extends IncidentioBaseParams { export interface IncidentioActionsShowResponse extends ToolResponse { output: { - action: IncidentioAction + action: IncidentioActionSummary } } @@ -551,36 +571,35 @@ export interface IncidentioActionsShowResponse extends ToolResponse { export interface IncidentioFollowUpsListParams extends IncidentioBaseParams { incident_id?: string incident_mode?: 'standard' | 'retrospective' | 'test' | 'tutorial' | 'stream' + page_size?: number + after?: string } -interface IncidentioFollowUp { +export interface IncidentioFollowUpSummary { id: string title: string description?: string - assignee?: { + assignee?: IncidentioSummaryAssignee + assignee_team?: { id: string; name: string } + status: string + priority?: { id: string name: string - email: string - role?: string - slack_user_id?: string + description?: string + rank: number } - status: string - priority?: { + category?: { id: string name: string - description: string + description?: string rank: number } created_at: string updated_at: string incident_id?: string - creator?: { - id: string - name: string - email: string - } + creator?: IncidentioLegacyCreator completed_at?: string - labels?: string[] + labels: string[] external_issue_reference?: { provider: string issue_name: string @@ -590,7 +609,8 @@ interface IncidentioFollowUp { export interface IncidentioFollowUpsListResponse extends ToolResponse { output: { - follow_ups: IncidentioFollowUp[] + follow_ups: IncidentioFollowUpSummary[] + pagination_meta?: IncidentioPaginationMeta } } @@ -600,7 +620,7 @@ export interface IncidentioFollowUpsShowParams extends IncidentioBaseParams { export interface IncidentioFollowUpsShowResponse extends ToolResponse { output: { - follow_up: IncidentioFollowUp + follow_up: IncidentioFollowUpSummary } } @@ -789,6 +809,7 @@ export interface IncidentioUsersListParams extends IncidentioBaseParams { after?: string email?: string slack_user_id?: string + include_inactive?: boolean } interface IncidentioUser { @@ -796,6 +817,8 @@ interface IncidentioUser { name: string email: string role: string + slack_user_id?: string + is_active?: boolean } export interface IncidentioUsersListResponse extends ToolResponse { @@ -896,7 +919,9 @@ export interface IncidentioEscalationsCreateParams extends IncidentioBaseParams idempotency_key: string title: string escalation_path_id?: string - user_ids?: string + user_ids?: string | string[] + incident_id?: string + description?: string } export interface IncidentioEscalationsCreateResponse extends ToolResponse { @@ -932,10 +957,7 @@ interface IncidentioSchedule { export interface IncidentioSchedulesListResponse extends ToolResponse { output: { schedules: IncidentioSchedule[] - pagination_meta?: { - after?: string - page_size: number - } + pagination_meta?: IncidentioPaginationMeta } } @@ -1191,28 +1213,38 @@ export interface IncidentioScheduleOverridesCreateResponse extends ToolResponse } // Escalation Paths types -interface IncidentioEscalationPathTarget { +/** A node of an escalation path. Only the field matching `type` is set. */ +interface IncidentioEscalationPathNode { id: string type: string - schedule_id?: string - user_id?: string - urgency: string + level?: { + targets: Array<{ id: string; type: string; urgency: string; schedule_mode?: string }> + time_to_ack_seconds?: number + } + notify_channel?: unknown + delay?: unknown + if_else?: unknown + repeat?: unknown + escalation_path?: unknown } -interface IncidentioEscalationPathLevel { - targets: IncidentioEscalationPathTarget[] - time_to_ack_seconds: number +/** A named working-hours window an escalation path can refer to. */ +interface IncidentioWeekdayIntervalConfig { + id: string + name: string + timezone: string + weekday_intervals: Array<{ weekday: string; start_time: string; end_time: string }> } interface IncidentioEscalationPath { id: string name: string - path: IncidentioEscalationPathLevel[] - working_hours?: Array<{ - weekday: string - start_time: string - end_time: string - }> + kind?: string + team_ids?: string[] + path: IncidentioEscalationPathNode[] + working_hours?: IncidentioWeekdayIntervalConfig[] + repeat_config?: unknown + current_responders?: IncidentioSlimUser[] } export interface IncidentioEscalationPathsListParams extends IncidentioBaseParams { @@ -1232,21 +1264,8 @@ export interface IncidentioEscalationPathsListResponse extends ToolResponse { export interface IncidentioEscalationPathsCreateParams extends IncidentioBaseParams { name: string - path: Array<{ - targets: Array<{ - id: string - type: string - schedule_id?: string - user_id?: string - urgency: string - }> - time_to_ack_seconds: number - }> - working_hours?: Array<{ - weekday: string - start_time: string - end_time: string - }> + path: IncidentioEscalationPathNode[] + working_hours?: IncidentioWeekdayIntervalConfig[] } export interface IncidentioEscalationPathsCreateResponse extends ToolResponse { @@ -1268,21 +1287,8 @@ export interface IncidentioEscalationPathsShowResponse extends ToolResponse { export interface IncidentioEscalationPathsUpdateParams extends IncidentioBaseParams { id: string name: string - path: Array<{ - targets: Array<{ - id: string - type: string - schedule_id?: string - user_id?: string - urgency: string - }> - time_to_ack_seconds: number - }> - working_hours?: Array<{ - weekday: string - start_time: string - end_time: string - }> + path: IncidentioEscalationPathNode[] + working_hours?: IncidentioWeekdayIntervalConfig[] } export interface IncidentioEscalationPathsUpdateResponse extends ToolResponse { @@ -1784,6 +1790,242 @@ export const INCIDENTIO_ACTION_RECORD_OUTPUT_PROPERTIES = { updated_at: { type: 'string', description: 'When the action was last updated' }, } as const satisfies Record +const INCIDENTIO_SUMMARY_ASSIGNEE_OUTPUT: OutputProperty = { + type: 'object', + description: 'Assigned user', + optional: true, + properties: { + id: { type: 'string', description: 'User ID' }, + name: { type: 'string', description: 'User name' }, + email: { type: 'string', description: 'User email', optional: true }, + }, +} + +/** + * Output definition for the creator of an action or follow-up as the list/show tools output it. + * `id`, `name`, and `email` are read from whichever actor is set; the actor keys are passed through. + */ +const INCIDENTIO_LEGACY_CREATOR_OUTPUT_PROPERTIES = { + id: { + type: 'string', + description: 'ID of the user, API key, workflow, or alert', + optional: true, + }, + name: { + type: 'string', + description: 'Name of the user, API key, or workflow (or the alert title)', + optional: true, + }, + email: { type: 'string', description: 'User email, when a user created it', optional: true }, + ...INCIDENTIO_ACTOR_OUTPUT_PROPERTIES, +} as const satisfies Record + +const INCIDENTIO_SUMMARY_EXTERNAL_ISSUE_REFERENCE_OUTPUT: OutputProperty = { + type: 'object', + description: 'External issue tracking reference', + optional: true, + properties: { + provider: { type: 'string', description: 'Issue tracking provider (e.g., Jira, Linear)' }, + issue_name: { type: 'string', description: 'Issue identifier' }, + issue_permalink: { type: 'string', description: 'URL to the external issue' }, + }, +} + +/** Output definition for an action as the list/show tools output it. */ +export const INCIDENTIO_ACTION_SUMMARY_OUTPUT_PROPERTIES = { + id: { type: 'string', description: 'Action ID' }, + description: { type: 'string', description: 'Action description' }, + assignee: INCIDENTIO_SUMMARY_ASSIGNEE_OUTPUT, + status: { type: 'string', description: 'Action status' }, + due_at: { + type: 'string', + description: 'Deprecated: incident.io actions have no due date, so this is never set', + optional: true, + }, + created_at: { type: 'string', description: 'Creation timestamp' }, + updated_at: { type: 'string', description: 'Last update timestamp' }, + incident_id: { type: 'string', description: 'Associated incident ID' }, + creator: { + type: 'object', + description: 'Who created the action', + properties: INCIDENTIO_LEGACY_CREATOR_OUTPUT_PROPERTIES, + }, + completed_at: { type: 'string', description: 'Completion timestamp', optional: true }, + external_issue_reference: { + ...INCIDENTIO_SUMMARY_EXTERNAL_ISSUE_REFERENCE_OUTPUT, + description: 'Deprecated: incident.io actions have no external issue, so this is never set', + }, +} as const satisfies Record + +/** Output definition for a follow-up as the list/show tools output it. */ +export const INCIDENTIO_FOLLOW_UP_SUMMARY_OUTPUT_PROPERTIES = { + id: { type: 'string', description: 'Follow-up ID' }, + title: { type: 'string', description: 'Follow-up title' }, + description: { type: 'string', description: 'Follow-up description', optional: true }, + assignee: INCIDENTIO_SUMMARY_ASSIGNEE_OUTPUT, + assignee_team: { + type: 'object', + description: 'The team the follow-up is assigned to', + optional: true, + properties: { + id: { type: 'string', description: 'Team ID' }, + name: { type: 'string', description: 'Team name' }, + }, + }, + status: { type: 'string', description: 'Follow-up status' }, + priority: { + type: 'object', + description: 'Follow-up priority', + optional: true, + properties: { + id: { type: 'string', description: 'Priority ID' }, + name: { type: 'string', description: 'Priority name' }, + description: { type: 'string', description: 'Priority description', optional: true }, + rank: { type: 'number', description: 'Priority rank' }, + }, + }, + category: { + type: 'object', + description: 'Follow-up category', + optional: true, + properties: { + id: { type: 'string', description: 'Category ID' }, + name: { type: 'string', description: 'Category name' }, + description: { type: 'string', description: 'Category description', optional: true }, + rank: { type: 'number', description: 'Category rank' }, + }, + }, + created_at: { type: 'string', description: 'Creation timestamp' }, + updated_at: { type: 'string', description: 'Last update timestamp' }, + incident_id: { type: 'string', description: 'Associated incident ID' }, + creator: { + type: 'object', + description: 'Who created the follow-up', + properties: INCIDENTIO_LEGACY_CREATOR_OUTPUT_PROPERTIES, + }, + completed_at: { type: 'string', description: 'Completion timestamp', optional: true }, + labels: { + type: 'array', + description: 'Labels associated with the follow-up', + items: { type: 'string' }, + }, + external_issue_reference: INCIDENTIO_SUMMARY_EXTERNAL_ISSUE_REFERENCE_OUTPUT, +} as const satisfies Record + +/** + * Output definition for escalation path objects. + * @see https://api-docs.incident.io/ + */ +export const INCIDENTIO_ESCALATION_PATH_OUTPUT_PROPERTIES = { + id: { type: 'string', description: 'The escalation path ID' }, + name: { type: 'string', description: 'The escalation path name' }, + kind: { type: 'string', description: 'Path kind (standalone, templated)', optional: true }, + team_ids: { + type: 'array', + description: 'IDs of the teams that own this escalation path', + optional: true, + items: { type: 'string' }, + }, + path: { + type: 'array', + description: 'Nodes that form the levels and branches of the path', + items: { + type: 'object', + properties: { + id: { type: 'string', description: 'Node ID, unique within the path' }, + type: { + type: 'string', + description: + 'Node type (level, notify_channel, delay, if_else, repeat, voicemail, escalation_path)', + }, + level: { + type: 'object', + description: 'For a level node: who to page and how long to wait for an ack', + optional: true, + properties: { + targets: { + type: 'array', + description: 'Users, schedules, or channels to page', + items: { + type: 'object', + properties: { + id: { type: 'string', description: 'Target ID' }, + type: { + type: 'string', + description: 'Target type (schedule, user, slack_channel, msteams_channel)', + }, + urgency: { type: 'string', description: 'Urgency (high, low)' }, + schedule_mode: { + type: 'string', + description: 'For schedule targets, which users to page', + optional: true, + }, + }, + }, + }, + time_to_ack_seconds: { + type: 'number', + description: 'Seconds to wait for an ack before moving on', + optional: true, + }, + }, + }, + notify_channel: { type: 'json', description: 'For a notify_channel node', optional: true }, + delay: { type: 'json', description: 'For a delay node', optional: true }, + if_else: { type: 'json', description: 'For an if_else node', optional: true }, + repeat: { type: 'json', description: 'For a repeat node', optional: true }, + escalation_path: { + type: 'json', + description: 'For an escalation_path node', + optional: true, + }, + }, + }, + }, + working_hours: { + type: 'array', + description: 'Working-hours windows the path can refer to', + optional: true, + items: { + type: 'object', + properties: { + id: { type: 'string', description: 'Window ID' }, + name: { type: 'string', description: 'Window name' }, + timezone: { type: 'string', description: 'Timezone the intervals are in' }, + weekday_intervals: { + type: 'array', + description: 'Intervals, each {weekday, start_time, end_time}', + items: { type: 'object' }, + }, + }, + }, + }, + repeat_config: { type: 'json', description: 'How the path repeats', optional: true }, + current_responders: { + type: 'array', + description: 'Users currently on call for this path', + optional: true, + items: { type: 'object', properties: INCIDENTIO_USER_OUTPUT_PROPERTIES }, + }, +} as const satisfies Record + +/** + * Largest `page_size` the v3 actions and follow-ups lists accept. Their v2 predecessors returned every + * record, so these tools request a full page unless the caller sets one. + */ +export const INCIDENTIO_V3_MAX_PAGE_SIZE = 250 + +/** Output definition for the cursor pagination of the v3 list endpoints. */ +export const INCIDENTIO_CURSOR_PAGINATION_OUTPUT: OutputProperty = { + type: 'object', + description: 'Pagination metadata. Pass `after` back to fetch the next page.', + optional: true, + properties: { + after: { type: 'string', description: 'Cursor for the next page', optional: true }, + page_size: { type: 'number', description: 'Number of results per page' }, + }, +} + /** * Whoever caused something to happen. Exactly one of these is populated, so consumers should * check each in turn rather than assuming a user. @@ -1848,7 +2090,7 @@ export interface IncidentioFollowUpsCreateParams extends IncidentioBaseParams { follow_up_category_id?: string follow_up_priority_option_id?: string external_issue_reference_id?: string - labels?: string + labels?: string | string[] } export interface IncidentioFollowUpsCreateResponse extends ToolResponse { @@ -1866,7 +2108,7 @@ export interface IncidentioFollowUpsUpdateParams extends IncidentioBaseParams { assignee_team_id?: string follow_up_category_id?: string follow_up_priority_option_id?: string - labels?: string + labels?: string | string[] } export interface IncidentioFollowUpsUpdateResponse extends ToolResponse { diff --git a/apps/sim/tools/incidentio/users_list.ts b/apps/sim/tools/incidentio/users_list.ts index c5f8f9fe1a4..e2390244b82 100644 --- a/apps/sim/tools/incidentio/users_list.ts +++ b/apps/sim/tools/incidentio/users_list.ts @@ -45,6 +45,13 @@ export const usersListTool: ToolConfig = { id: 'incidentio_users_show', @@ -30,7 +31,7 @@ export const usersShowTool: ToolConfig `https://api.incident.io/v2/users/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/users/${safeUrlPathSegment(params.id, 'id')}`, method: 'GET', headers: (params) => ({ 'Content-Type': 'application/json', @@ -49,6 +50,8 @@ export const usersShowTool: ToolConfig | undefined { + return value && typeof value === 'object' && !Array.isArray(value) + ? (value as Record) + : undefined +} function toStringValue(value: unknown): string { return typeof value === 'string' ? value : String(value ?? '') @@ -18,36 +30,156 @@ function toBooleanValue(value: unknown): boolean { return value === true } +/** + * Splits a comma-separated list param into trimmed, non-empty entries. An array (as a model sends + * for a list-shaped field) is accepted as is. + */ +export function parseIncidentioList(value: string | string[]): string[] { + const entries = Array.isArray(value) ? value : String(value).split(',') + return entries.map((entry) => String(entry).trim()).filter(Boolean) +} + +/** + * Parses a JSON-typed param. A value that is already structured (an array or object sent by a + * model, or a resolved block-output reference) is returned as is; only strings are parsed. + */ export function parseIncidentioJsonParam( - jsonString: string | undefined, + value: unknown, paramName: string, defaultValue: unknown ): unknown { - if (jsonString === undefined || jsonString === '') return defaultValue + if (value === undefined || value === null || value === '') return defaultValue + if (typeof value !== 'string') return value try { - return JSON.parse(jsonString) + return JSON.parse(value) } catch (error) { throw new Error(`Invalid JSON for ${paramName}: ${getErrorMessage(error)}`) } } -export function parseRequiredIncidentioJsonParam( - jsonString: string | undefined, - paramName: string -): unknown { - if (jsonString === undefined || jsonString === '') { +export function parseRequiredIncidentioJsonParam(value: unknown, paramName: string): unknown { + if (value === undefined || value === null || value === '') { throw new Error(`Missing required JSON for ${paramName}`) } - return parseIncidentioJsonParam(jsonString, paramName, undefined) + return parseIncidentioJsonParam(value, paramName, undefined) +} + +/** + * Maps the API's actor envelope (`{ user | api_key | workflow | alert }`) onto the creator shape the + * list/show tools have always declared: `id`/`name`/`email` come from whichever actor is set, and + * the raw actor keys are passed through alongside them. + */ +export function mapIncidentioCreator(value: unknown): IncidentioLegacyCreator | undefined { + const creator = asRecord(value) + if (!creator) return undefined + const user = asRecord(creator.user) + const apiKey = asRecord(creator.api_key) + const workflow = asRecord(creator.workflow) + const alert = asRecord(creator.alert) + const source = user ?? apiKey ?? workflow ?? alert + return { + id: toOptionalStringValue(source?.id), + name: toOptionalStringValue(source?.name) ?? toOptionalStringValue(alert?.title), + email: toOptionalStringValue(user?.email), + user: creator.user as IncidentioLegacyCreator['user'], + api_key: creator.api_key as IncidentioLegacyCreator['api_key'], + workflow: creator.workflow as IncidentioLegacyCreator['workflow'], + alert: creator.alert as IncidentioLegacyCreator['alert'], + } +} + +function mapAssignee(value: unknown): IncidentioActionSummary['assignee'] { + const assignee = asRecord(value) + if (!assignee) return undefined + return { + id: toStringValue(assignee.id), + name: toStringValue(assignee.name), + email: toOptionalStringValue(assignee.email), + } +} + +function mapExternalIssueReference( + value: unknown +): IncidentioFollowUpSummary['external_issue_reference'] { + const reference = asRecord(value) + if (!reference) return undefined + return { + provider: toStringValue(reference.provider), + issue_name: toStringValue(reference.issue_name), + issue_permalink: toStringValue(reference.issue_permalink), + } +} + +/** Maps an action as returned by `GET /v3/actions[/{id}]` onto the list/show output shape. */ +export function mapIncidentioActionSummary(value: unknown): IncidentioActionSummary { + const action = asRecord(value) ?? {} + return { + id: toStringValue(action.id), + description: toOptionalStringValue(action.description) ?? '', + assignee: mapAssignee(action.assignee), + status: toStringValue(action.status), + created_at: toStringValue(action.created_at), + updated_at: toStringValue(action.updated_at), + incident_id: toOptionalStringValue(action.incident_id), + creator: mapIncidentioCreator(action.creator), + completed_at: toOptionalStringValue(action.completed_at), + } +} + +/** Maps a follow-up as returned by `GET /v3/follow_ups[/{id}]` onto the list/show output shape. */ +export function mapIncidentioFollowUpSummary(value: unknown): IncidentioFollowUpSummary { + const followUp = asRecord(value) ?? {} + const priority = asRecord(followUp.priority) + const assigneeTeam = asRecord(followUp.assignee_team) + const category = asRecord(followUp.category) + return { + id: toStringValue(followUp.id), + title: toOptionalStringValue(followUp.title) ?? '', + description: toOptionalStringValue(followUp.description), + assignee: mapAssignee(followUp.assignee), + assignee_team: assigneeTeam + ? { id: toStringValue(assigneeTeam.id), name: toStringValue(assigneeTeam.name) } + : undefined, + status: toStringValue(followUp.status), + priority: priority + ? { + id: toStringValue(priority.id), + name: toStringValue(priority.name), + description: toOptionalStringValue(priority.description), + rank: toNumberValue(priority.rank), + } + : undefined, + category: category + ? { + id: toStringValue(category.id), + name: toStringValue(category.name), + description: toOptionalStringValue(category.description), + rank: toNumberValue(category.rank), + } + : undefined, + created_at: toStringValue(followUp.created_at), + updated_at: toStringValue(followUp.updated_at), + incident_id: toOptionalStringValue(followUp.incident_id), + creator: mapIncidentioCreator(followUp.creator), + completed_at: toOptionalStringValue(followUp.completed_at), + labels: toArray(followUp.labels), + external_issue_reference: mapExternalIssueReference(followUp.external_issue_reference), + } +} + +/** The API returns the trigger as `{ name, label }`; the output keeps the name string. */ +function mapWorkflowTrigger(value: unknown): string { + const trigger = asRecord(value) + return trigger ? toStringValue(trigger.name) : toStringValue(value) } export function mapIncidentioWorkflow(workflow: Record): Workflow { return { id: toStringValue(workflow.id), name: toStringValue(workflow.name), - trigger: toStringValue(workflow.trigger), + trigger: mapWorkflowTrigger(workflow.trigger), once_for: toArray(workflow.once_for), version: toNumberValue(workflow.version), expressions: toArray(workflow.expressions), @@ -65,3 +197,31 @@ export function mapIncidentioWorkflow(workflow: Record): Workfl shortform: toOptionalStringValue(workflow.shortform), } } + +/** Most pages a list tool follows on its own: 2,500 records at the v3 maximum page size. */ +const INCIDENTIO_AUTO_PAGE_LIMIT = 10 + +type IncidentioCollectedPages = { items: T[]; after?: string } | { error: string } + +/** + * Follows `pagination_meta.after` cursors from a first v3 list page until the list is exhausted or + * {@link INCIDENTIO_AUTO_PAGE_LIMIT} pages are read. The v3 list endpoints return records oldest + * first, so stopping at one page would drop the newest records the deprecated v2 endpoints returned. + * Returns the collected items with the cursor left to resume from (unset when complete), or the + * error of the first page that failed. + */ +export async function collectIncidentioPages( + first: { items: T[]; after?: string }, + itemsKey: string, + fetchPage: (after: string) => Promise +): Promise> { + const items = [...first.items] + let after = first.after + for (let pages = 1; after && pages < INCIDENTIO_AUTO_PAGE_LIMIT; pages++) { + const page = await fetchPage(after) + if (!page.success) return { error: page.error || 'Failed to fetch the next page' } + items.push(...toArray(page.output[itemsKey])) + after = toOptionalStringValue(asRecord(page.output.pagination_meta)?.after) + } + return { items, after } +} diff --git a/apps/sim/tools/incidentio/workflows_delete.ts b/apps/sim/tools/incidentio/workflows_delete.ts index 0cb1537e341..6d43d6aea55 100644 --- a/apps/sim/tools/incidentio/workflows_delete.ts +++ b/apps/sim/tools/incidentio/workflows_delete.ts @@ -1,6 +1,7 @@ import type { WorkflowsDeleteParams, WorkflowsDeleteResponse } from '@/tools/incidentio/types' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const workflowsDeleteTool: ToolConfig = { id: 'incidentio_workflows_delete', @@ -25,7 +26,7 @@ export const workflowsDeleteTool: ToolConfig `https://api.incident.io/v2/workflows/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/workflows/${safeUrlPathSegment(params.id, 'id')}`, method: 'DELETE', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/incidentio/workflows_show.ts b/apps/sim/tools/incidentio/workflows_show.ts index 4074e0fd827..48a57cd094a 100644 --- a/apps/sim/tools/incidentio/workflows_show.ts +++ b/apps/sim/tools/incidentio/workflows_show.ts @@ -3,6 +3,7 @@ import { INCIDENTIO_WORKFLOW_OUTPUT_PROPERTIES } from '@/tools/incidentio/types' import { mapIncidentioWorkflow } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const workflowsShowTool: ToolConfig = { id: 'incidentio_workflows_show', @@ -34,7 +35,9 @@ export const workflowsShowTool: ToolConfig { - const url = new URL(`https://api.incident.io/v2/workflows/${params.id.trim()}`) + const url = new URL( + `https://api.incident.io/v2/workflows/${safeUrlPathSegment(params.id, 'id')}` + ) if (params.skip_step_upgrades !== undefined) { url.searchParams.set('skip_step_upgrades', String(params.skip_step_upgrades)) } diff --git a/apps/sim/tools/incidentio/workflows_update.ts b/apps/sim/tools/incidentio/workflows_update.ts index 7826996e39d..11ff73096ac 100644 --- a/apps/sim/tools/incidentio/workflows_update.ts +++ b/apps/sim/tools/incidentio/workflows_update.ts @@ -7,6 +7,7 @@ import { } from '@/tools/incidentio/utils' import { INCIDENTIO_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const workflowsUpdateTool: ToolConfig = { id: 'incidentio_workflows_update', @@ -103,7 +104,7 @@ export const workflowsUpdateTool: ToolConfig `https://api.incident.io/v2/workflows/${params.id.trim()}`, + url: (params) => `https://api.incident.io/v2/workflows/${safeUrlPathSegment(params.id, 'id')}`, method: 'PUT', headers: (params) => ({ 'Content-Type': 'application/json', diff --git a/apps/sim/tools/linear/archive_label.ts b/apps/sim/tools/linear/archive_label.ts index 0f9f9fa3e89..d66cb7bf111 100644 --- a/apps/sim/tools/linear/archive_label.ts +++ b/apps/sim/tools/linear/archive_label.ts @@ -8,7 +8,8 @@ export const linearArchiveLabelTool: ToolConfig< > = { id: 'linear_archive_label', name: 'Linear Archive Label', - description: 'Archive a label in Linear', + description: + 'Archive (retire) a label in Linear. A retired label can no longer be newly assigned but stays on issues that already use it.', version: '1.0.0', oauth: { @@ -39,8 +40,8 @@ export const linearArchiveLabelTool: ToolConfig< }, body: (params) => ({ query: ` - mutation ArchiveLabel($id: String!) { - issueLabelArchive(id: $id) { + mutation RetireLabel($id: String!) { + issueLabelRetire(id: $id) { success } } @@ -63,9 +64,9 @@ export const linearArchiveLabelTool: ToolConfig< } return { - success: data.data.issueLabelArchive.success, + success: data.data.issueLabelRetire.success, output: { - success: data.data.issueLabelArchive.success, + success: data.data.issueLabelRetire.success, labelId: params?.labelId, }, } diff --git a/apps/sim/tools/linear/create_customer_request.ts b/apps/sim/tools/linear/create_customer_request.ts index 2414440241c..fd4c7a8f924 100644 --- a/apps/sim/tools/linear/create_customer_request.ts +++ b/apps/sim/tools/linear/create_customer_request.ts @@ -41,15 +41,17 @@ export const linearCreateCustomerRequestTool: ToolConfig< }, issueId: { type: 'string', - required: false, + required: true, visibility: 'user-or-llm', - description: 'Issue ID to link this request to', + description: + 'Issue to link this request to (UUID or identifier such as ENG-123). Linear requires it for API calls.', }, projectId: { type: 'string', required: false, visibility: 'user-or-llm', - description: 'Project ID to link this request to', + description: + 'Deprecated and ignored: Linear no longer accepts a project on customer requests.', }, }, @@ -78,9 +80,6 @@ export const linearCreateCustomerRequestTool: ToolConfig< if (params.issueId != null && params.issueId !== '') { input.issueId = params.issueId } - if (params.projectId != null && params.projectId !== '') { - input.projectId = params.projectId - } return { query: ` diff --git a/apps/sim/tools/linear/create_customer_tier.ts b/apps/sim/tools/linear/create_customer_tier.ts index 5335c509db6..124114fbee1 100644 --- a/apps/sim/tools/linear/create_customer_tier.ts +++ b/apps/sim/tools/linear/create_customer_tier.ts @@ -86,7 +86,7 @@ export const linearCreateCustomerTierTool: ToolConfig< mutation CustomerTierCreate($input: CustomerTierCreateInput!) { customerTierCreate(input: $input) { success - customerTier { + tier { id name displayName @@ -129,7 +129,7 @@ export const linearCreateCustomerTierTool: ToolConfig< return { success: true, output: { - customerTier: result.customerTier, + customerTier: result.tier, }, } }, diff --git a/apps/sim/tools/linear/create_cycle.ts b/apps/sim/tools/linear/create_cycle.ts index 04e23390ba3..4ca8d80281a 100644 --- a/apps/sim/tools/linear/create_cycle.ts +++ b/apps/sim/tools/linear/create_cycle.ts @@ -7,7 +7,8 @@ export const linearCreateCycleTool: ToolConfig = { id: 'linear_delete_project_status', - name: 'Linear Delete Project Status', - description: 'Delete a project status in Linear', + name: 'Linear Archive Project Status', + description: + 'Archive a project status in Linear (Linear does not support deleting one). The status must have no active projects and must not be the last status of its type.', version: '1.0.0', oauth: { @@ -24,7 +25,7 @@ export const linearDeleteProjectStatusTool: ToolConfig< type: 'string', required: true, visibility: 'user-or-llm', - description: 'Project status ID to delete', + description: 'Project status ID to archive', }, }, @@ -42,8 +43,8 @@ export const linearDeleteProjectStatusTool: ToolConfig< }, body: (params) => ({ query: ` - mutation ProjectStatusDelete($id: String!) { - projectStatusDelete(id: $id) { + mutation ProjectStatusArchive($id: String!) { + projectStatusArchive(id: $id) { success } } @@ -60,12 +61,12 @@ export const linearDeleteProjectStatusTool: ToolConfig< if (data.errors) { return { success: false, - error: data.errors[0]?.message || 'Failed to delete project status', + error: data.errors[0]?.message || 'Failed to archive project status', output: {}, } } - const result = data.data.projectStatusDelete + const result = data.data.projectStatusArchive return { success: result.success, output: { @@ -77,7 +78,7 @@ export const linearDeleteProjectStatusTool: ToolConfig< outputs: { success: { type: 'boolean', - description: 'Whether the deletion was successful', + description: 'Whether the archive was successful', }, }, } diff --git a/apps/sim/tools/linear/get_issue.ts b/apps/sim/tools/linear/get_issue.ts index 8f6840e99fa..99e2938d09c 100644 --- a/apps/sim/tools/linear/get_issue.ts +++ b/apps/sim/tools/linear/get_issue.ts @@ -45,6 +45,7 @@ export const linearGetIssueTool: ToolConfig { - // Note: ProjectFilter does not support filtering by team directly - // We need to filter projects client-side by team if teamId is provided + const teamId = typeof params.teamId === 'string' ? params.teamId.trim() : '' return { query: ` - query ListProjects($first: Int, $after: String, $includeArchived: Boolean) { - projects(first: $first, after: $after, includeArchived: $includeArchived) { + query ListProjects( + $first: Int + $after: String + $includeArchived: Boolean + $filter: ProjectFilter + ) { + projects( + first: $first + after: $after + includeArchived: $includeArchived + filter: $filter + ) { nodes { id name description state + status { + id + name + type + } priority startDate targetDate @@ -97,12 +111,13 @@ export const linearListProjectsTool: ToolConfig< first: params.first ? Number(params.first) : 50, after: params.after?.trim() || undefined, includeArchived: params.includeArchived || false, + filter: teamId ? { accessibleTeams: { some: { id: { eq: teamId } } } } : undefined, }, } }, }, - transformResponse: async (response, params) => { + transformResponse: async (response) => { const data = await response.json() if (data.errors) { @@ -114,11 +129,12 @@ export const linearListProjectsTool: ToolConfig< } const result = data.data.projects - let projects = result.nodes.map((project: any) => ({ + const projects = result.nodes.map((project: any) => ({ id: project.id, name: project.name, description: project.description, state: project.state, + status: project.status, priority: project.priority, startDate: project.startDate, targetDate: project.targetDate, @@ -130,13 +146,6 @@ export const linearListProjectsTool: ToolConfig< teams: project.teams?.nodes || [], })) - // Filter by teamId client-side if provided - if (params?.teamId) { - projects = projects.filter((project: any) => - project.teams.some((team: any) => team.id === params.teamId) - ) - } - return { success: true, output: { @@ -155,7 +164,7 @@ export const linearListProjectsTool: ToolConfig< description: 'Array of projects', items: { type: 'object', - properties: PROJECT_FULL_OUTPUT_PROPERTIES, + properties: PROJECT_DETAIL_OUTPUT_PROPERTIES, }, }, pageInfo: PAGE_INFO_OUTPUT, diff --git a/apps/sim/tools/linear/requests.test.ts b/apps/sim/tools/linear/requests.test.ts new file mode 100644 index 00000000000..94c000675ef --- /dev/null +++ b/apps/sim/tools/linear/requests.test.ts @@ -0,0 +1,170 @@ +import { describe, expect, it } from 'vitest' +import { linearArchiveLabelTool } from '@/tools/linear/archive_label' +import { linearCreateCustomerRequestTool } from '@/tools/linear/create_customer_request' +import { linearCreateCustomerTierTool } from '@/tools/linear/create_customer_tier' +import { linearDeleteProjectStatusTool } from '@/tools/linear/delete_project_status' +import { linearListProjectsTool } from '@/tools/linear/list_projects' +import { linearUpdateCustomerRequestTool } from '@/tools/linear/update_customer_request' +import { linearUpdateCustomerStatusTool } from '@/tools/linear/update_customer_status' +import { linearUpdateCustomerTierTool } from '@/tools/linear/update_customer_tier' +import { linearUpdateNotificationTool } from '@/tools/linear/update_notification' +import { linearUpdateProjectTool } from '@/tools/linear/update_project' +import type { ToolConfig, ToolResponse } from '@/tools/types' + +interface GraphqlBody { + query: string + variables: { input?: Record; filter?: unknown } +} + +function graphqlBody(tool: ToolConfig, params: P): GraphqlBody { + const build = tool.request.body + if (!build) throw new Error(`${tool.id} has no request body`) + return build(params) as GraphqlBody +} + +async function transform( + tool: ToolConfig, + payload: unknown, + params?: P +): Promise { + if (!tool.transformResponse) throw new Error(`${tool.id} has no transformResponse`) + return tool.transformResponse(new Response(JSON.stringify(payload)), params) +} + +describe('Linear customer tier and status payloads', () => { + it('returns the tier Linear sends back from customerTierCreate', async () => { + const tier = { id: 't1', name: 'Enterprise' } + const result = await transform(linearCreateCustomerTierTool, { + data: { customerTierCreate: { success: true, tier } }, + }) + expect(result.success).toBe(true) + expect(result.output.customerTier).toEqual(tier) + }) + + it('returns the tier Linear sends back from customerTierUpdate', async () => { + const tier = { id: 't1', name: 'Pro' } + const result = await transform(linearUpdateCustomerTierTool, { + data: { customerTierUpdate: { success: true, tier } }, + }) + expect(result.output.customerTier).toEqual(tier) + }) + + it('returns the status Linear sends back from customerStatusUpdate', async () => { + const status = { id: 's1', name: 'Active' } + const result = await transform(linearUpdateCustomerStatusTool, { + data: { customerStatusUpdate: { success: true, status } }, + }) + expect(result.output.customerStatus).toEqual(status) + }) +}) + +describe('Linear archive mutations', () => { + it('retires the label and reports the retire result', async () => { + const body = graphqlBody(linearArchiveLabelTool, { labelId: 'l1', accessToken: 'tok' }) + expect(body.query).toContain('issueLabelRetire(id: $id)') + const result = await transform( + linearArchiveLabelTool, + { data: { issueLabelRetire: { success: true } } }, + { labelId: 'l1' } + ) + expect(result.success).toBe(true) + expect(result.output).toEqual({ success: true, labelId: 'l1' }) + }) + + it('archives the project status and reports the archive result', async () => { + const body = graphqlBody(linearDeleteProjectStatusTool, { statusId: 'ps1', accessToken: 'tok' }) + expect(body.query).toContain('projectStatusArchive(id: $id)') + const result = await transform(linearDeleteProjectStatusTool, { + data: { projectStatusArchive: { success: true } }, + }) + expect(result.success).toBe(true) + }) +}) + +describe('Linear list projects team filter', () => { + it('filters by team on the server so pagination matches the filtered set', () => { + const body = graphqlBody(linearListProjectsTool, { teamId: ' team-1 ', accessToken: 'tok' }) + expect(body.variables.filter).toEqual({ + accessibleTeams: { some: { id: { eq: 'team-1' } } }, + }) + }) + + it('returns every project on the page Linear returns', async () => { + const result = await transform( + linearListProjectsTool, + { + data: { + projects: { + nodes: [{ id: 'p1', teams: { nodes: [{ id: 'other-team' }] } }], + pageInfo: { hasNextPage: false, endCursor: null }, + }, + }, + }, + { teamId: 'team-1' } + ) + expect(result.output.projects.map((project: { id: string }) => project.id)).toEqual(['p1']) + }) +}) + +describe('Linear update project status', () => { + it('sends statusId, never the removed state input', () => { + const body = graphqlBody(linearUpdateProjectTool, { + projectId: 'p1', + statusId: 'ps1', + state: 'started', + accessToken: 'tok', + }) + expect(body.variables.input).toEqual({ statusId: 'ps1' }) + }) + + it('fails before calling Linear when only a state is given', () => { + expect(() => + graphqlBody(linearUpdateProjectTool, { + projectId: 'p1', + state: 'started', + accessToken: 'tok', + }) + ).toThrow('statusId') + }) +}) + +describe('Linear customer requests', () => { + it('never sends projectId, which the create input no longer accepts', () => { + const body = graphqlBody(linearCreateCustomerRequestTool, { + customerId: 'c1', + issueId: 'ENG-1', + projectId: 'p1', + accessToken: 'tok', + }) + expect(body.variables.input).not.toHaveProperty('projectId') + }) + + it('never sends projectId, which the update input does not accept', () => { + const body = graphqlBody(linearUpdateCustomerRequestTool, { + customerNeedId: 'n1', + projectId: 'p1', + accessToken: 'tok', + }) + expect(body.variables.input).not.toHaveProperty('projectId') + }) +}) + +describe('Linear update notification', () => { + it('reads the issue through the IssueNotification fragment', () => { + const body = graphqlBody(linearUpdateNotificationTool, { + notificationId: 'n1', + accessToken: 'tok', + }) + expect(body.query).toMatch(/\.\.\. on IssueNotification \{\s*issue \{/) + }) + + it('marks a notification read now when readAt is blank', () => { + const body = graphqlBody(linearUpdateNotificationTool, { + notificationId: 'n1', + readAt: '', + accessToken: 'tok', + }) + expect(typeof body.variables.input?.readAt).toBe('string') + expect(body.variables.input?.readAt).not.toBe('') + }) +}) diff --git a/apps/sim/tools/linear/types.ts b/apps/sim/tools/linear/types.ts index b941502ddce..952fa60032d 100644 --- a/apps/sim/tools/linear/types.ts +++ b/apps/sim/tools/linear/types.ts @@ -178,7 +178,21 @@ export const PROJECT_FULL_OUTPUT_PROPERTIES = { description: { type: 'string', description: 'Project description' }, state: { type: 'string', - description: 'Project state (planned, started, paused, completed, canceled)', + description: + 'Deprecated project state (planned, started, paused, completed, canceled); prefer status', + }, + status: { + type: 'object', + description: 'Current project status', + optional: true, + properties: { + id: { type: 'string', description: 'Project status ID' }, + name: { type: 'string', description: 'Project status name' }, + type: { + type: 'string', + description: 'Status type (backlog, planned, started, paused, completed, canceled)', + }, + }, }, priority: { type: 'number', description: 'Project priority (0-4)' }, startDate: { type: 'string', description: 'Start date (YYYY-MM-DD)' }, @@ -195,6 +209,16 @@ export const PROJECT_FULL_OUTPUT_PROPERTIES = { }, } as const satisfies Record +/** + * Output definition for project objects that also carry lifecycle timestamps (get project, list projects) + */ +export const PROJECT_DETAIL_OUTPUT_PROPERTIES = { + ...PROJECT_FULL_OUTPUT_PROPERTIES, + completedAt: { type: 'string', description: 'Completion timestamp (ISO 8601)' }, + canceledAt: { type: 'string', description: 'Cancellation timestamp (ISO 8601)' }, + archivedAt: { type: 'string', description: 'Archive timestamp (ISO 8601)' }, +} as const satisfies Record + /** * Output definition for nested issue objects (minimal) */ @@ -723,6 +747,7 @@ export interface LinearUpdateProjectParams { name?: string description?: string state?: string + statusId?: string leadId?: string startDate?: string targetDate?: string diff --git a/apps/sim/tools/linear/update_customer_request.ts b/apps/sim/tools/linear/update_customer_request.ts index ad380abf66d..28fe740aa65 100644 --- a/apps/sim/tools/linear/update_customer_request.ts +++ b/apps/sim/tools/linear/update_customer_request.ts @@ -55,7 +55,8 @@ export const linearUpdateCustomerRequestTool: ToolConfig< type: 'string', required: false, visibility: 'user-or-llm', - description: 'New project ID to link this request to', + description: + 'Deprecated and ignored: Linear no longer accepts a project on customer requests.', }, }, @@ -87,9 +88,6 @@ export const linearUpdateCustomerRequestTool: ToolConfig< if (params.issueId != null && params.issueId !== '') { input.issueId = params.issueId } - if (params.projectId != null && params.projectId !== '') { - input.projectId = params.projectId - } return { query: ` diff --git a/apps/sim/tools/linear/update_customer_status.ts b/apps/sim/tools/linear/update_customer_status.ts index 7a30933330d..d3e224015ac 100644 --- a/apps/sim/tools/linear/update_customer_status.ts +++ b/apps/sim/tools/linear/update_customer_status.ts @@ -95,7 +95,7 @@ export const linearUpdateCustomerStatusTool: ToolConfig< mutation CustomerStatusUpdate($id: String!, $input: CustomerStatusUpdateInput!) { customerStatusUpdate(id: $id, input: $input) { success - customerStatus { + status { id name description @@ -132,7 +132,7 @@ export const linearUpdateCustomerStatusTool: ToolConfig< return { success: result.success, output: { - customerStatus: result.customerStatus, + customerStatus: result.status, }, } }, diff --git a/apps/sim/tools/linear/update_customer_tier.ts b/apps/sim/tools/linear/update_customer_tier.ts index de72c7e501c..c30d06832e3 100644 --- a/apps/sim/tools/linear/update_customer_tier.ts +++ b/apps/sim/tools/linear/update_customer_tier.ts @@ -94,7 +94,7 @@ export const linearUpdateCustomerTierTool: ToolConfig< mutation CustomerTierUpdate($id: String!, $input: CustomerTierUpdateInput!) { customerTierUpdate(id: $id, input: $input) { success - customerTier { + tier { id name displayName @@ -130,7 +130,7 @@ export const linearUpdateCustomerTierTool: ToolConfig< return { success: result.success, output: { - customerTier: result.customerTier, + customerTier: result.tier, }, } }, diff --git a/apps/sim/tools/linear/update_notification.ts b/apps/sim/tools/linear/update_notification.ts index a298f2f0cc5..2780fab56ff 100644 --- a/apps/sim/tools/linear/update_notification.ts +++ b/apps/sim/tools/linear/update_notification.ts @@ -30,7 +30,8 @@ export const linearUpdateNotificationTool: ToolConfig< type: 'string', required: false, visibility: 'user-or-llm', - description: 'Timestamp to mark as read (ISO format). Pass null or omit to mark as unread', + description: + 'ISO timestamp to mark the notification read at. Omit it to mark it read now; pass null to mark it unread.', }, }, @@ -49,8 +50,7 @@ export const linearUpdateNotificationTool: ToolConfig< body: (params) => { const input: Record = {} - // If readAt is provided, use it; if explicitly null, mark as unread; if omitted, mark as read now - if (params.readAt !== undefined) { + if (params.readAt !== undefined && params.readAt !== '') { input.readAt = params.readAt } else { input.readAt = new Date().toISOString() @@ -66,9 +66,11 @@ export const linearUpdateNotificationTool: ToolConfig< type createdAt readAt - issue { - id - title + ... on IssueNotification { + issue { + id + title + } } } } @@ -119,7 +121,11 @@ export const linearUpdateNotificationTool: ToolConfig< type: { type: 'string', description: 'Notification type' }, createdAt: { type: 'string', description: 'Creation timestamp' }, readAt: { type: 'string', description: 'Read timestamp' }, - issue: { type: 'object', description: 'Related issue' }, + issue: { + type: 'object', + description: 'Related issue (only for issue notifications)', + optional: true, + }, }, }, }, diff --git a/apps/sim/tools/linear/update_project.ts b/apps/sim/tools/linear/update_project.ts index 31ca7a9529a..3fcbe0f7a28 100644 --- a/apps/sim/tools/linear/update_project.ts +++ b/apps/sim/tools/linear/update_project.ts @@ -40,7 +40,15 @@ export const linearUpdateProjectTool: ToolConfig< type: 'string', required: false, visibility: 'user-or-llm', - description: 'Project state (planned, started, completed, canceled)', + description: + 'Deprecated: Linear no longer accepts a project state on update. Use statusId instead; a state given without statusId fails with an error.', + }, + statusId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Project status ID to move the project to (see List Project Statuses). Omit to keep the current status.', }, leadId: { type: 'string', @@ -89,8 +97,12 @@ export const linearUpdateProjectTool: ToolConfig< if (params.description != null && params.description !== '') { input.description = params.description } - if (params.state != null && params.state !== '') { - input.state = params.state + if (params.statusId != null && params.statusId !== '') { + input.statusId = params.statusId + } else if (params.state != null && params.state !== '') { + throw new Error( + 'Linear no longer accepts a project state. Set a project status ID (statusId) instead; List Project Statuses returns the available IDs.' + ) } if (params.leadId != null && params.leadId !== '') { input.leadId = params.leadId @@ -115,6 +127,11 @@ export const linearUpdateProjectTool: ToolConfig< name description state + status { + id + name + type + } priority startDate targetDate @@ -170,6 +187,7 @@ export const linearUpdateProjectTool: ToolConfig< name: project.name, description: project.description, state: project.state, + status: project.status, priority: project.priority, startDate: project.startDate, targetDate: project.targetDate, diff --git a/apps/sim/tools/pagerduty/add_note.ts b/apps/sim/tools/pagerduty/add_note.ts index 07f7b2921f9..ed9e25b7c6b 100644 --- a/apps/sim/tools/pagerduty/add_note.ts +++ b/apps/sim/tools/pagerduty/add_note.ts @@ -1,6 +1,7 @@ import type { PagerDutyAddNoteParams, PagerDutyAddNoteResponse } from '@/tools/pagerduty/types' import { PAGERDUTY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const addNoteTool: ToolConfig = { id: 'pagerduty_add_note', @@ -37,7 +38,8 @@ export const addNoteTool: ToolConfig `https://api.pagerduty.com/incidents/${params.incidentId.trim()}/notes`, + url: (params) => + `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.incidentId, 'incidentId')}/notes`, method: 'POST', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, diff --git a/apps/sim/tools/pagerduty/get_incident.ts b/apps/sim/tools/pagerduty/get_incident.ts index e27e1532237..a6f145d0e4f 100644 --- a/apps/sim/tools/pagerduty/get_incident.ts +++ b/apps/sim/tools/pagerduty/get_incident.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/pagerduty/types' import { PAGERDUTY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const getIncidentTool: ToolConfig = { @@ -30,7 +31,7 @@ export const getIncidentTool: ToolConfig - `https://api.pagerduty.com/incidents/${params.incidentId.trim()}?include[]=services`, + `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.incidentId, 'incidentId')}?include[]=services`, method: 'GET', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, diff --git a/apps/sim/tools/pagerduty/get_service.ts b/apps/sim/tools/pagerduty/get_service.ts index 23acca1473c..870191c0e25 100644 --- a/apps/sim/tools/pagerduty/get_service.ts +++ b/apps/sim/tools/pagerduty/get_service.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/pagerduty/types' import { PAGERDUTY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const getServiceTool: ToolConfig = { id: 'pagerduty_get_service', @@ -29,7 +30,7 @@ export const getServiceTool: ToolConfig - `https://api.pagerduty.com/services/${params.serviceId.trim()}?include[]=escalation_policies`, + `https://api.pagerduty.com/services/${safeUrlPathSegment(params.serviceId, 'serviceId')}?include[]=escalation_policies`, method: 'GET', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, diff --git a/apps/sim/tools/pagerduty/list_escalation_policies.ts b/apps/sim/tools/pagerduty/list_escalation_policies.ts index ad0b6c89b3c..55029fa1593 100644 --- a/apps/sim/tools/pagerduty/list_escalation_policies.ts +++ b/apps/sim/tools/pagerduty/list_escalation_policies.ts @@ -1,3 +1,4 @@ +import { toBooleanFromInput } from '@sim/utils/coerce' import type { PagerDutyListEscalationPoliciesParams, PagerDutyListEscalationPoliciesResponse, @@ -40,6 +41,13 @@ export const listEscalationPoliciesTool: ToolConfig< visibility: 'user-or-llm', description: 'Offset to start pagination search results', }, + includeTotal: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: + 'Populate the total result count in the response (PagerDuty returns null for total unless requested; slower)', + }, }, request: { @@ -48,6 +56,7 @@ export const listEscalationPoliciesTool: ToolConfig< if (params.query) query.set('query', params.query) if (params.limit) query.set('limit', params.limit) if (params.offset) query.set('offset', params.offset) + if (toBooleanFromInput(params.includeTotal)) query.set('total', 'true') const qs = query.toString() return `https://api.pagerduty.com/escalation_policies${qs ? `?${qs}` : ''}` }, diff --git a/apps/sim/tools/pagerduty/list_incident_alerts.ts b/apps/sim/tools/pagerduty/list_incident_alerts.ts index facd1551901..64c3eadeef9 100644 --- a/apps/sim/tools/pagerduty/list_incident_alerts.ts +++ b/apps/sim/tools/pagerduty/list_incident_alerts.ts @@ -1,9 +1,11 @@ +import { toBooleanFromInput } from '@sim/utils/coerce' import type { PagerDutyListIncidentAlertsParams, PagerDutyListIncidentAlertsResponse, } from '@/tools/pagerduty/types' import { PAGERDUTY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listIncidentAlertsTool: ToolConfig< PagerDutyListIncidentAlertsParams, @@ -46,6 +48,13 @@ export const listIncidentAlertsTool: ToolConfig< visibility: 'user-or-llm', description: 'Offset to start pagination search results', }, + includeTotal: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: + 'Populate the total result count in the response (PagerDuty returns null for total unless requested; slower)', + }, }, request: { @@ -58,8 +67,9 @@ export const listIncidentAlertsTool: ToolConfig< } if (params.limit) query.set('limit', params.limit) if (params.offset) query.set('offset', params.offset) + if (toBooleanFromInput(params.includeTotal)) query.set('total', 'true') const qs = query.toString() - return `https://api.pagerduty.com/incidents/${params.incidentId.trim()}/alerts${qs ? `?${qs}` : ''}` + return `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.incidentId, 'incidentId')}/alerts${qs ? `?${qs}` : ''}` }, method: 'GET', headers: (params) => ({ diff --git a/apps/sim/tools/pagerduty/list_incidents.ts b/apps/sim/tools/pagerduty/list_incidents.ts index 097a0c68799..9d99abb1b45 100644 --- a/apps/sim/tools/pagerduty/list_incidents.ts +++ b/apps/sim/tools/pagerduty/list_incidents.ts @@ -1,3 +1,4 @@ +import { toBooleanFromInput } from '@sim/utils/coerce' import type { PagerDutyListIncidentsParams, PagerDutyListIncidentsResponse, @@ -70,6 +71,13 @@ export const listIncidentsTool: ToolConfig< visibility: 'user-or-llm', description: 'Offset to start pagination search results', }, + includeTotal: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: + 'Populate the total result count in the response (PagerDuty returns null for total unless requested; slower)', + }, }, request: { @@ -95,6 +103,7 @@ export const listIncidentsTool: ToolConfig< if (params.sortBy) query.set('sort_by', params.sortBy) if (params.limit) query.set('limit', params.limit) if (params.offset) query.set('offset', params.offset) + if (toBooleanFromInput(params.includeTotal)) query.set('total', 'true') query.append('include[]', 'services') const qs = query.toString() return `https://api.pagerduty.com/incidents${qs ? `?${qs}` : ''}` diff --git a/apps/sim/tools/pagerduty/list_oncalls.ts b/apps/sim/tools/pagerduty/list_oncalls.ts index ba1fb8db0be..c00745b65c4 100644 --- a/apps/sim/tools/pagerduty/list_oncalls.ts +++ b/apps/sim/tools/pagerduty/list_oncalls.ts @@ -1,3 +1,4 @@ +import { toBooleanFromInput } from '@sim/utils/coerce' import type { PagerDutyListOncallsParams, PagerDutyListOncallsResponse, @@ -56,6 +57,13 @@ export const listOncallsTool: ToolConfig `https://api.pagerduty.com/incidents/${params.targetIncidentId.trim()}/merge`, + url: (params) => + `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.targetIncidentId, 'targetIncidentId')}/merge`, method: 'PUT', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, diff --git a/apps/sim/tools/pagerduty/requests.test.ts b/apps/sim/tools/pagerduty/requests.test.ts new file mode 100644 index 00000000000..113fcb0401e --- /dev/null +++ b/apps/sim/tools/pagerduty/requests.test.ts @@ -0,0 +1,107 @@ +import { describe, expect, it } from 'vitest' +import { getIncidentTool } from '@/tools/pagerduty/get_incident' +import { listIncidentsTool } from '@/tools/pagerduty/list_incidents' +import { mergeIncidentsTool } from '@/tools/pagerduty/merge_incidents' +import { sendEventTool } from '@/tools/pagerduty/send_event' +import type { + PagerDutyListIncidentsParams, + PagerDutySendEventParams, + PagerDutyUpdateIncidentParams, +} from '@/tools/pagerduty/types' +import { updateIncidentTool } from '@/tools/pagerduty/update_incident' +import type { ToolConfig } from '@/tools/types' + +function buildUrl

(tool: ToolConfig

, params: P): string { + const { url } = tool.request + return typeof url === 'function' ? url(params) : url +} + +function buildBody

(tool: ToolConfig

, params: P): Record { + const body = tool.request.body + if (!body) throw new Error('tool has no request body') + return body(params) as Record +} + +describe('PagerDuty path ids', () => { + it.each(['..', '../users', '.'])('rejects dot-segment incident id %j', (incidentId) => { + expect(() => buildUrl(getIncidentTool, { apiKey: 'k', incidentId })).toThrow(/incidentId/) + }) + + it('encodes an id containing a query delimiter instead of truncating the path', () => { + const url = buildUrl(mergeIncidentsTool, { + apiKey: 'k', + fromEmail: 'a@b.co', + targetIncidentId: 'P1?x=1', + sourceIncidentIds: 'P2', + }) + expect(new URL(url).pathname).toBe('/incidents/P1%3Fx%3D1/merge') + }) +}) + +describe('PagerDuty update incident', () => { + const base: PagerDutyUpdateIncidentParams = { + apiKey: 'k', + fromEmail: 'a@b.co', + incidentId: 'P1', + resolution: 'root cause fixed', + } + + it('drops a leftover resolution when the status is not resolved', () => { + const body = buildBody(updateIncidentTool, { ...base, status: 'acknowledged' }) + expect(body.incident).not.toHaveProperty('resolution') + expect(body.incident).toMatchObject({ status: 'acknowledged' }) + }) + + it('sends the resolution when resolving', () => { + const body = buildBody(updateIncidentTool, { ...base, status: 'resolved' }) + expect(body.incident).toMatchObject({ status: 'resolved', resolution: 'root cause fixed' }) + }) +}) + +describe('PagerDuty list total', () => { + const base: PagerDutyListIncidentsParams = { apiKey: 'k' } + + it.each([true, 'true'])('requests the total count for includeTotal=%j', (includeTotal) => { + const url = new URL(buildUrl(listIncidentsTool, { ...base, includeTotal })) + expect(url.searchParams.get('total')).toBe('true') + }) + + it.each([undefined, false, 'false'])('omits total for includeTotal=%j', (includeTotal) => { + const url = new URL(buildUrl(listIncidentsTool, { ...base, includeTotal })) + expect(url.searchParams.has('total')).toBe(false) + }) +}) + +describe('PagerDuty send event custom details', () => { + const trigger: PagerDutySendEventParams = { + routingKey: 'r', + eventAction: 'trigger', + summary: 'disk full', + source: 'host-1', + severity: 'critical', + } + + it.each([ + ['an object from a tool call', { region: 'us-east-1', errors: 3 }], + ['a JSON string from the block', '{"region":"us-east-1","errors":3}'], + ])('sends custom_details from %s', (_label, customDetails) => { + const body = buildBody(sendEventTool, { + ...trigger, + customDetails, + timestamp: '2026-01-01T00:00:00Z', + }) + expect(body.payload).toMatchObject({ + custom_details: { region: 'us-east-1', errors: 3 }, + timestamp: '2026-01-01T00:00:00Z', + }) + }) + + it.each(['not json', '[1,2]'])( + 'rejects custom details %j that are not a JSON object', + (value) => { + expect(() => buildBody(sendEventTool, { ...trigger, customDetails: value })).toThrow( + /customDetails/ + ) + } + ) +}) diff --git a/apps/sim/tools/pagerduty/send_event.ts b/apps/sim/tools/pagerduty/send_event.ts index 2b4e7a1c2d2..ced6d2ccb30 100644 --- a/apps/sim/tools/pagerduty/send_event.ts +++ b/apps/sim/tools/pagerduty/send_event.ts @@ -1,6 +1,27 @@ +import { isPlainRecord } from '@sim/utils/object' import type { PagerDutySendEventParams, PagerDutySendEventResponse } from '@/tools/pagerduty/types' import type { ToolConfig } from '@/tools/types' +/** + * Normalizes `custom_details`, which the Events API v2 schema types as an object. Block inputs + * arrive as a JSON string; tool calls may send the object itself. + */ +function parseCustomDetails(value: unknown): Record | undefined { + if (value === undefined || value === null || value === '') return undefined + let parsed: unknown = value + if (typeof value === 'string') { + try { + parsed = JSON.parse(value) + } catch { + throw new Error('customDetails must be a valid JSON object') + } + } + if (!isPlainRecord(parsed)) { + throw new Error('customDetails must be a JSON object') + } + return parsed +} + export const sendEventTool: ToolConfig = { id: 'pagerduty_send_event', name: 'PagerDuty Send Event', @@ -66,6 +87,20 @@ export const sendEventTool: ToolConfig `https://api.pagerduty.com/incidents/${params.incidentId.trim()}/snooze`, + url: (params) => + `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.incidentId, 'incidentId')}/snooze`, method: 'POST', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, diff --git a/apps/sim/tools/pagerduty/types.ts b/apps/sim/tools/pagerduty/types.ts index a03ff404e63..01a07340387 100644 --- a/apps/sim/tools/pagerduty/types.ts +++ b/apps/sim/tools/pagerduty/types.ts @@ -26,6 +26,7 @@ export interface PagerDutyListIncidentsParams extends PagerDutyBaseParams { sortBy?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListIncidentsResponse extends ToolResponse { @@ -154,6 +155,7 @@ export interface PagerDutyListServicesParams extends PagerDutyBaseParams { query?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListServicesResponse extends ToolResponse { @@ -207,6 +209,7 @@ export interface PagerDutyListOncallsParams extends PagerDutyBaseParams { until?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListOncallsResponse extends ToolResponse { @@ -235,6 +238,7 @@ export interface PagerDutyListEscalationPoliciesParams extends PagerDutyBasePara query?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListEscalationPoliciesResponse extends ToolResponse { @@ -260,6 +264,7 @@ export interface PagerDutyListSchedulesParams extends PagerDutyBaseParams { query?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListSchedulesResponse extends ToolResponse { @@ -284,6 +289,7 @@ export interface PagerDutyListUsersParams extends PagerDutyBaseParams { query?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListUsersResponse extends ToolResponse { @@ -346,6 +352,7 @@ export interface PagerDutyListIncidentAlertsParams extends PagerDutyBaseParams { statuses?: string limit?: string offset?: string + includeTotal?: boolean | string } export interface PagerDutyListIncidentAlertsResponse extends ToolResponse { @@ -380,6 +387,8 @@ export interface PagerDutySendEventParams { component?: string group?: string class?: string + timestamp?: string + customDetails?: Record | string } export interface PagerDutySendEventResponse extends ToolResponse { diff --git a/apps/sim/tools/pagerduty/update_incident.ts b/apps/sim/tools/pagerduty/update_incident.ts index 10533bd8902..0253bf59bcf 100644 --- a/apps/sim/tools/pagerduty/update_incident.ts +++ b/apps/sim/tools/pagerduty/update_incident.ts @@ -4,6 +4,7 @@ import type { } from '@/tools/pagerduty/types' import { PAGERDUTY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const updateIncidentTool: ToolConfig< PagerDutyUpdateIncidentParams, @@ -68,7 +69,8 @@ export const updateIncidentTool: ToolConfig< }, request: { - url: (params) => `https://api.pagerduty.com/incidents/${params.incidentId.trim()}`, + url: (params) => + `https://api.pagerduty.com/incidents/${safeUrlPathSegment(params.incidentId, 'incidentId')}`, method: 'PUT', headers: (params) => ({ Authorization: `Token token=${params.apiKey}`, @@ -88,10 +90,7 @@ export const updateIncidentTool: ToolConfig< if (params.escalationLevel) { incident.escalation_level = Number(params.escalationLevel) } - if (params.resolution) { - if (params.status !== 'resolved') { - throw new Error('resolution can only be set when status is resolved') - } + if (params.resolution && params.status === 'resolved') { incident.resolution = params.resolution } return { incident } diff --git a/apps/sim/tools/sentry/events_get.ts b/apps/sim/tools/sentry/events_get.ts index 1646d5d6cfd..35c007d0f3b 100644 --- a/apps/sim/tools/sentry/events_get.ts +++ b/apps/sim/tools/sentry/events_get.ts @@ -2,6 +2,7 @@ import type { SentryGetEventParams, SentryGetEventResponse } from '@/tools/sentr import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const getEventTool: ToolConfig = { id: 'sentry_events_get', @@ -41,7 +42,7 @@ export const getEventTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/projects/${params.organizationSlug}/${params.projectSlug}/events/${params.eventId}/`, + `${SENTRY_REGIONS.apiBase(params.region)}/projects/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/${safeUrlPathSegment(params.projectSlug, 'projectSlug')}/events/${safeUrlPathSegment(params.eventId, 'eventId')}/`, method: 'GET', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, diff --git a/apps/sim/tools/sentry/events_list.ts b/apps/sim/tools/sentry/events_list.ts index c0165cc2121..a9647b84469 100644 --- a/apps/sim/tools/sentry/events_list.ts +++ b/apps/sim/tools/sentry/events_list.ts @@ -2,6 +2,7 @@ import type { SentryListEventsParams, SentryListEventsResponse } from '@/tools/s import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listEventsTool: ToolConfig = { id: 'sentry_events_list', @@ -54,7 +55,8 @@ export const listEventsTool: ToolConfig = { id: 'sentry_issues_get', @@ -35,7 +36,7 @@ export const getIssueTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/issues/${params.issueId}/`, + `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/issues/${safeUrlPathSegment(params.issueId, 'issueId')}/`, method: 'GET', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, diff --git a/apps/sim/tools/sentry/issues_list.ts b/apps/sim/tools/sentry/issues_list.ts index 755540c01d0..d3f07078a47 100644 --- a/apps/sim/tools/sentry/issues_list.ts +++ b/apps/sim/tools/sentry/issues_list.ts @@ -2,6 +2,7 @@ import type { SentryListIssuesParams, SentryListIssuesResponse } from '@/tools/s import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listIssuesTool: ToolConfig = { id: 'sentry_issues_list', @@ -29,8 +30,7 @@ export const listIssuesTool: ToolConfig { - const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/issues/` + const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/issues/` const queryParams: string[] = [] if (params.projectSlug && params.projectSlug !== null && params.projectSlug !== '') { @@ -188,6 +188,8 @@ export const listIssuesTool: ToolConfig = { id: 'sentry_issues_update', @@ -38,6 +39,12 @@ export const updateIssueTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/issues/${params.issueId}/`, + `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/issues/${safeUrlPathSegment(params.issueId, 'issueId')}/`, method: 'PUT', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, @@ -80,6 +87,10 @@ export const updateIssueTool: ToolConfig = { @@ -61,7 +62,7 @@ export const createProjectTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/teams/${params.organizationSlug}/${params.teamSlug}/projects/`, + `${SENTRY_REGIONS.apiBase(params.region)}/teams/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/${safeUrlPathSegment(params.teamSlug, 'teamSlug')}/projects/`, method: 'POST', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, @@ -157,7 +158,9 @@ export const createProjectTool: ToolConfig = { id: 'sentry_projects_get', @@ -35,7 +36,7 @@ export const getProjectTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/projects/${params.organizationSlug}/${params.projectSlug}/`, + `${SENTRY_REGIONS.apiBase(params.region)}/projects/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/${safeUrlPathSegment(params.projectSlug, 'projectSlug')}/`, method: 'GET', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, diff --git a/apps/sim/tools/sentry/projects_list.ts b/apps/sim/tools/sentry/projects_list.ts index fdd33a72211..d7d32762ab3 100644 --- a/apps/sim/tools/sentry/projects_list.ts +++ b/apps/sim/tools/sentry/projects_list.ts @@ -2,6 +2,7 @@ import type { SentryListProjectsParams, SentryListProjectsResponse } from '@/too import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listProjectsTool: ToolConfig = { id: 'sentry_projects_list', @@ -41,7 +42,7 @@ export const listProjectsTool: ToolConfig { - const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/projects/` + const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/projects/` const queryParams: string[] = [] if (params.cursor && params.cursor !== null && params.cursor !== '') { @@ -126,6 +127,8 @@ export const listProjectsTool: ToolConfig = { @@ -72,7 +73,7 @@ export const updateProjectTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/projects/${params.organizationSlug}/${params.projectSlug}/`, + `${SENTRY_REGIONS.apiBase(params.region)}/projects/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/${safeUrlPathSegment(params.projectSlug, 'projectSlug')}/`, method: 'PUT', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, diff --git a/apps/sim/tools/sentry/releases_create.ts b/apps/sim/tools/sentry/releases_create.ts index 46cf2d29c18..0dd4d46be8a 100644 --- a/apps/sim/tools/sentry/releases_create.ts +++ b/apps/sim/tools/sentry/releases_create.ts @@ -2,6 +2,27 @@ import type { SentryCreateReleaseParams, SentryCreateReleaseResponse } from '@/t import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' + +const COMMITS_FORMAT_ERROR = + 'Commits must be a JSON array of commit objects, e.g. [{"id":"abc123","message":"Fix bug"}]' + +/** + * Accepts commits as an array (a resolved block reference or a model value) or as a JSON array + * string, and rejects anything else instead of creating the release without its commits. + */ +function parseCommits(value: SentryCreateReleaseParams['commits']): unknown[] | undefined { + if (Array.isArray(value)) return value + if (typeof value !== 'string' || value.trim() === '') return undefined + let parsed: unknown + try { + parsed = JSON.parse(value) + } catch { + throw new Error(COMMITS_FORMAT_ERROR) + } + if (!Array.isArray(parsed)) throw new Error(COMMITS_FORMAT_ERROR) + return parsed +} export const createReleaseTool: ToolConfig = { @@ -69,19 +90,19 @@ export const createReleaseTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/releases/`, + `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/releases/`, method: 'POST', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, 'Content-Type': 'application/json', }), body: (params) => { + const projects = Array.isArray(params.projects) + ? params.projects + : String(params.projects ?? '').split(',') const body: Record = { version: params.version, - projects: params.projects - .split(',') - .map((p: string) => p.trim()) - .filter((p: string) => p.length > 0), + projects: projects.map((p) => String(p).trim()).filter((p) => p.length > 0), } if (params.ref && params.ref !== null && params.ref !== '') { @@ -96,10 +117,9 @@ export const createReleaseTool: ToolConfig = { id: 'sentry_releases_deploy', @@ -66,7 +67,7 @@ export const createDeployTool: ToolConfig - `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/releases/${encodeURIComponent(params.version)}/deploys/`, + `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/releases/${safeUrlPathSegment(params.version, 'version', { allowSeparators: true })}/deploys/`, method: 'POST', headers: (params) => ({ Authorization: `Bearer ${params.apiKey}`, diff --git a/apps/sim/tools/sentry/releases_list.ts b/apps/sim/tools/sentry/releases_list.ts index 71be2b01e09..4e54eb042a1 100644 --- a/apps/sim/tools/sentry/releases_list.ts +++ b/apps/sim/tools/sentry/releases_list.ts @@ -2,6 +2,7 @@ import type { SentryListReleasesParams, SentryListReleasesResponse } from '@/too import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listReleasesTool: ToolConfig = { id: 'sentry_releases_list', @@ -29,8 +30,7 @@ export const listReleasesTool: ToolConfig { - const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/releases/` + const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/releases/` const queryParams: string[] = [] if (params.projectSlug && params.projectSlug !== null && params.projectSlug !== '') { @@ -166,6 +166,8 @@ export const listReleasesTool: ToolConfig) { + return createReleaseTool.request.body?.({ + ...AUTH, + version: '1.0.0', + projects: 'web', + ...overrides, + }) +} + +function issueUrl(params: SentryGetIssueParams) { + const { url } = getIssueTool.request + return typeof url === 'function' ? url(params) : url +} + +describe('sentry_releases_create body', () => { + it('sends commits that arrive as an array from a block reference', () => { + const commits = [{ id: 'abc123', message: 'Fix bug' }] + expect(releaseBody({ commits })).toMatchObject({ commits }) + }) + + it('rejects malformed commits JSON instead of creating the release without commits', () => { + expect(() => releaseBody({ commits: '[{"id":"abc123"},]' })).toThrow(/JSON array/) + }) + + it('accepts projects that arrive as an array', () => { + expect(releaseBody({ projects: ['web', ' api ', ''] })).toMatchObject({ + projects: ['web', 'api'], + }) + }) +}) + +describe('sentry path segments', () => { + it('rejects an issue id that would rewrite the request path', () => { + expect(() => issueUrl({ ...AUTH, issueId: '123/../../projects/acme/other' })).toThrow(/issueId/) + }) +}) + +describe('sentry list pagination', () => { + it('exposes the next cursor at the top level, where the block output points', async () => { + const response = new Response('[]', { + headers: { + Link: '; rel="next"; results="true"; cursor="0:100:0"', + }, + }) + const result = await listIssuesTool.transformResponse?.(response) + expect(result?.output).toMatchObject({ nextCursor: '0:100:0', hasMore: true }) + }) +}) diff --git a/apps/sim/tools/sentry/teams_list.ts b/apps/sim/tools/sentry/teams_list.ts index 75b048a00f7..3e73028f67e 100644 --- a/apps/sim/tools/sentry/teams_list.ts +++ b/apps/sim/tools/sentry/teams_list.ts @@ -2,6 +2,7 @@ import type { SentryListTeamsParams, SentryListTeamsResponse } from '@/tools/sen import { SENTRY_REGIONS } from '@/tools/sentry/utils' import { SENTRY_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' import type { ToolConfig } from '@/tools/types' +import { safeUrlPathSegment } from '@/tools/url-path' export const listTeamsTool: ToolConfig = { id: 'sentry_teams_list', @@ -47,7 +48,7 @@ export const listTeamsTool: ToolConfig { - const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${params.organizationSlug}/teams/` + const baseUrl = `${SENTRY_REGIONS.apiBase(params.region)}/organizations/${safeUrlPathSegment(params.organizationSlug, 'organizationSlug')}/teams/` const queryParams: string[] = [] if (params.query && params.query !== null && params.query !== '') { @@ -115,6 +116,8 @@ export const listTeamsTool: ToolConfig { title: 'Try one', }) }) + + it('omits thread_ts for session channels, which Slack rejects it for', () => { + const base = { accessToken: 'xoxb-token', authMethod: 'bot_token', botToken: '', channel: 'C1' } + expect( + requestOf(slackSetAgentSessionStatusV2Tool).body?.({ ...base, status: 'processing' }) + ).toEqual({ channel_id: 'C1', status: 'processing' }) + expect(requestOf(slackRenameAgentSessionV2Tool).body?.({ ...base, title: 'Trip' })).toEqual({ + channel_id: 'C1', + title: 'Trip', + }) + }) }) diff --git a/apps/sim/tools/slack/close_conversation.ts b/apps/sim/tools/slack/close_conversation.ts index 6706385757e..47536049ae7 100644 --- a/apps/sim/tools/slack/close_conversation.ts +++ b/apps/sim/tools/slack/close_conversation.ts @@ -5,7 +5,8 @@ import { createSlackWebApiTool } from '@/tools/slack/web-api' export const slackCloseConversationTool = createSlackWebApiTool({ id: 'slack_close_conversation', name: 'Slack Close Conversation', - description: 'Close a direct message or group direct message for the authenticated identity.', + description: + 'Close a direct message or group direct message for the authenticated identity. The Sim app can close 1:1 direct messages only; closing a group direct message needs a custom bot with the mpim:write scope.', endpoint: 'conversations.close', method: 'POST', oauth: { required: true, provider: 'slack', requiredScopes: [] }, diff --git a/apps/sim/tools/slack/create_user_group.ts b/apps/sim/tools/slack/create_user_group.ts index 357b7f2b818..91fb72ab091 100644 --- a/apps/sim/tools/slack/create_user_group.ts +++ b/apps/sim/tools/slack/create_user_group.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' import { usergroupOutput, usergroupSchema } from '@/tools/slack/web-api-responses' /** https://docs.slack.dev/reference/methods/usergroups.create/ */ @@ -34,13 +34,15 @@ export const slackCreateUserGroupTool = createSlackWebApiTool({ type: 'json', required: false, visibility: 'user-or-llm', - description: 'Default Channel IDs', + description: + 'Default channel IDs for the group, as a JSON array (["C123"]) or a comma-separated string (C123,C456)', }, additional_channels: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'Additional Channel IDs', + description: + 'Channel IDs where members can add group members, as a JSON array or a comma-separated string', }, enable_section: { type: 'boolean', @@ -65,10 +67,10 @@ export const slackCreateUserGroupTool = createSlackWebApiTool({ name: z.string().trim().min(1), handle: z.string().trim().min(1).optional(), description: z.string().optional(), - channels: slackJson(z.array(slackId)) + channels: slackIdList(z.array(slackId)) .transform((ids) => ids.join(',')) .optional(), - additional_channels: slackJson(z.array(slackId)) + additional_channels: slackIdList(z.array(slackId)) .transform((ids) => ids.join(',')) .optional(), enable_section: z.boolean().optional(), diff --git a/apps/sim/tools/slack/ephemeral_message.ts b/apps/sim/tools/slack/ephemeral_message.ts index ddb225a4123..2c0470dc3f6 100644 --- a/apps/sim/tools/slack/ephemeral_message.ts +++ b/apps/sim/tools/slack/ephemeral_message.ts @@ -4,6 +4,16 @@ import type { } from '@/tools/slack/types' import type { InternalToolConfig } from '@/tools/types' +/** Block Kit blocks arrive parsed from workflow data or as the JSON editor's serialized string. */ +function parseEphemeralBlocks(blocks: SlackEphemeralMessageParams['blocks']): unknown { + if (typeof blocks !== 'string') return blocks || undefined + try { + return JSON.parse(blocks) + } catch { + throw new Error('Block Kit Blocks must be valid JSON') + } +} + export const slackEphemeralMessageTool: InternalToolConfig< SlackEphemeralMessageParams, SlackEphemeralMessageResponse @@ -81,8 +91,7 @@ export const slackEphemeralMessageTool: InternalToolConfig< user: params.user?.trim(), text: params.text, thread_ts: params.threadTs?.trim() || undefined, - blocks: - typeof params.blocks === 'string' ? JSON.parse(params.blocks) : params.blocks || undefined, + blocks: parseEphemeralBlocks(params.blocks), }), }, diff --git a/apps/sim/tools/slack/get_channel_history.ts b/apps/sim/tools/slack/get_channel_history.ts index 5036fcf2280..f550ff0241f 100644 --- a/apps/sim/tools/slack/get_channel_history.ts +++ b/apps/sim/tools/slack/get_channel_history.ts @@ -85,7 +85,7 @@ export const slackGetChannelHistoryTool: InternalToolConfig< type: 'number', required: false, visibility: 'user-or-llm', - description: 'Maximum number of pages to fetch before stopping (default: 10)', + description: 'Maximum number of pages to fetch before stopping (default: 10, max: 50)', }, }, diff --git a/apps/sim/tools/slack/get_team_dnd_info.ts b/apps/sim/tools/slack/get_team_dnd_info.ts index c451783a203..7d5cc22ecb0 100644 --- a/apps/sim/tools/slack/get_team_dnd_info.ts +++ b/apps/sim/tools/slack/get_team_dnd_info.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' import { dndSchema } from '@/tools/slack/web-api-responses' /** https://docs.slack.dev/reference/methods/dnd.teamInfo/ */ @@ -16,7 +16,13 @@ export const slackGetTeamDndInfoTool = createSlackWebApiTool({ credentialKind: 'service-account', }, params: { - users: { type: 'json', required: true, visibility: 'user-or-llm', description: 'User IDs' }, + users: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: + 'Slack user IDs to read, up to 50, as a JSON array (["U123","W456"]) or a comma-separated string (U123,W456)', + }, team_id: { type: 'string', required: false, @@ -25,7 +31,7 @@ export const slackGetTeamDndInfoTool = createSlackWebApiTool({ }, }, input: z.object({ - users: slackJson(z.array(slackId).min(1)).transform((ids) => ids.join(',')), + users: slackIdList(z.array(slackId).min(1).max(50)).transform((ids) => ids.join(',')), team_id: z.string().trim().min(1).optional(), }), output: z.object({ ok: z.literal(true), users: z.record(z.string(), dndSchema) }), diff --git a/apps/sim/tools/slack/get_thread_replies.ts b/apps/sim/tools/slack/get_thread_replies.ts index da55e062b6c..42f04765142 100644 --- a/apps/sim/tools/slack/get_thread_replies.ts +++ b/apps/sim/tools/slack/get_thread_replies.ts @@ -91,7 +91,7 @@ export const slackGetThreadRepliesTool: InternalToolConfig< type: 'number', required: false, visibility: 'user-or-llm', - description: 'Maximum number of pages to fetch before stopping (default: 10)', + description: 'Maximum number of pages to fetch before stopping (default: 10, max: 50)', }, }, diff --git a/apps/sim/tools/slack/open_conversation.ts b/apps/sim/tools/slack/open_conversation.ts index bc6819167c8..c07e328cebd 100644 --- a/apps/sim/tools/slack/open_conversation.ts +++ b/apps/sim/tools/slack/open_conversation.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' import { conversationOutput, conversationSchema } from '@/tools/slack/web-api-responses' /** https://docs.slack.dev/reference/methods/conversations.open/ */ @@ -12,7 +12,13 @@ export const slackOpenConversationTool = createSlackWebApiTool({ method: 'POST', oauth: { required: true, provider: 'slack', requiredScopes: [] }, params: { - users: { type: 'json', required: false, visibility: 'user-or-llm', description: 'User IDs' }, + users: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + '1 to 8 Slack user IDs, as a JSON array or a comma-separated string. Omit channel.', + }, channel: { type: 'string', required: false, @@ -34,7 +40,7 @@ export const slackOpenConversationTool = createSlackWebApiTool({ }, input: z .object({ - users: slackJson(z.array(slackId).min(1).max(8)) + users: slackIdList(z.array(slackId).min(1).max(8)) .transform((ids) => ids.join(',')) .optional(), channel: z.string().trim().min(1).optional(), diff --git a/apps/sim/tools/slack/open_view.ts b/apps/sim/tools/slack/open_view.ts index 3f70d041450..6afc0951002 100644 --- a/apps/sim/tools/slack/open_view.ts +++ b/apps/sim/tools/slack/open_view.ts @@ -37,10 +37,10 @@ export const slackOpenViewTool: ToolConfig 200) throw new Error('Session Title must be 200 characters or fewer') return { channel_id: requireSlackString(params.channel, 'Channel'), - thread_ts: requireSlackString(params.threadTs, 'Thread Timestamp'), + ...optionalSlackThreadTs(params.threadTs), title, } }, diff --git a/apps/sim/tools/slack/revoke_canvas_access.ts b/apps/sim/tools/slack/revoke_canvas_access.ts index f3e10d93546..d3b3f2642fa 100644 --- a/apps/sim/tools/slack/revoke_canvas_access.ts +++ b/apps/sim/tools/slack/revoke_canvas_access.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' /** https://docs.slack.dev/reference/methods/canvases.access.delete/ */ export const slackRevokeCanvasAccessTool = createSlackWebApiTool({ @@ -17,19 +17,24 @@ export const slackRevokeCanvasAccessTool = createSlackWebApiTool({ visibility: 'user-or-llm', description: 'Canvas ID', }, - user_ids: { type: 'json', required: false, visibility: 'user-or-llm', description: 'User IDs' }, + user_ids: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'One Slack user ID to remove, as ["U123"] or U123. Omit channel_ids.', + }, channel_ids: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'Channel IDs', + description: 'One Slack channel ID to remove, as ["C123"] or C123. Omit user_ids.', }, }, input: z .object({ canvas_id: z.string().trim().min(1), - user_ids: slackJson(z.array(slackId).min(1)).optional(), - channel_ids: slackJson(z.array(slackId).min(1)).optional(), + user_ids: slackIdList(z.array(slackId).min(1).max(1)).optional(), + channel_ids: slackIdList(z.array(slackId).min(1).max(1)).optional(), }) .refine( (p) => p.user_ids !== undefined || p.channel_ids !== undefined, diff --git a/apps/sim/tools/slack/set_agent_session_status_v2.ts b/apps/sim/tools/slack/set_agent_session_status_v2.ts index e199b2553f5..e2d279ee4e7 100644 --- a/apps/sim/tools/slack/set_agent_session_status_v2.ts +++ b/apps/sim/tools/slack/set_agent_session_status_v2.ts @@ -5,6 +5,7 @@ import type { } from '@/tools/slack/types' import { assertSlackApiSuccess, + optionalSlackThreadTs, requireSlackAgentSessionStatus, requireSlackString, resolveSlackAccessToken, @@ -60,9 +61,10 @@ export const slackSetAgentSessionStatusV2Tool: ToolConfig< }, threadTs: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Timestamp of the thread associated with the agent session', + description: + 'Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in regular channels and DMs; omit for session channels.', }, status: { type: 'string', @@ -115,7 +117,7 @@ export const slackSetAgentSessionStatusV2Tool: ToolConfig< return { channel_id: requireSlackString(params.channel, 'Channel'), - thread_ts: requireSlackString(params.threadTs, 'Thread Timestamp'), + ...optionalSlackThreadTs(params.threadTs), status: requireSlackAgentSessionStatus(params.status), ...(title ? { title } : {}), ...(params.initiatorUserId?.trim() diff --git a/apps/sim/tools/slack/set_status.ts b/apps/sim/tools/slack/set_status.ts index b84a27571a8..9236d7c6b65 100644 --- a/apps/sim/tools/slack/set_status.ts +++ b/apps/sim/tools/slack/set_status.ts @@ -112,7 +112,7 @@ export const slackSetStatusTool: ToolConfig (p.user_ids !== undefined) !== (p.channel_ids !== undefined), diff --git a/apps/sim/tools/slack/types.ts b/apps/sim/tools/slack/types.ts index b947d65c992..f5c8daf5ec2 100644 --- a/apps/sim/tools/slack/types.ts +++ b/apps/sim/tools/slack/types.ts @@ -667,7 +667,7 @@ export type SlackAgentSessionStatus = 'active' | 'processing' | 'suspended' | 'c export interface SlackSetAgentSessionStatusV2Params extends SlackBaseParams { channel: string - threadTs: string + threadTs?: string status: SlackAgentSessionStatus title?: string initiatorUserId?: string @@ -678,7 +678,7 @@ export interface SlackSetAgentSessionStatusV2Params extends SlackBaseParams { export interface SlackRenameAgentSessionV2Params extends SlackBaseParams { channel: string - threadTs: string + threadTs?: string title: string } @@ -896,7 +896,7 @@ export interface SlackDeleteCanvasParams extends SlackBaseParams { } export interface SlackOpenViewParams extends SlackBaseParams { - triggerId: string + triggerId?: string interactivityPointer?: string view: object | string } @@ -909,7 +909,7 @@ export interface SlackUpdateViewParams extends SlackBaseParams { } export interface SlackPushViewParams extends SlackBaseParams { - triggerId: string + triggerId?: string interactivityPointer?: string view: object | string } diff --git a/apps/sim/tools/slack/unarchive_conversation.ts b/apps/sim/tools/slack/unarchive_conversation.ts index 61512f9b6e5..a7d7678780c 100644 --- a/apps/sim/tools/slack/unarchive_conversation.ts +++ b/apps/sim/tools/slack/unarchive_conversation.ts @@ -5,7 +5,8 @@ import { createSlackWebApiTool } from '@/tools/slack/web-api' export const slackUnarchiveConversationTool = createSlackWebApiTool({ id: 'slack_unarchive_conversation', name: 'Slack Unarchive Conversation', - description: 'Restore an archived Slack channel.', + description: + 'Restore an archived Slack channel. Slack does not currently let bot tokens unarchive conversations, so this fails with the Sim app or a custom bot until Slack lifts that limit.', endpoint: 'conversations.unarchive', method: 'POST', oauth: { required: true, provider: 'slack', requiredScopes: [] }, diff --git a/apps/sim/tools/slack/update_user_group.ts b/apps/sim/tools/slack/update_user_group.ts index f7788e4ca09..ab98bb04a34 100644 --- a/apps/sim/tools/slack/update_user_group.ts +++ b/apps/sim/tools/slack/update_user_group.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' import { usergroupOutput, usergroupSchema } from '@/tools/slack/web-api-responses' /** https://docs.slack.dev/reference/methods/usergroups.update/ */ @@ -40,13 +40,15 @@ export const slackUpdateUserGroupTool = createSlackWebApiTool({ type: 'json', required: false, visibility: 'user-or-llm', - description: 'Default Channel IDs', + description: + 'Default channel IDs for the group, as a JSON array (["C123"]) or a comma-separated string (C123,C456)', }, additional_channels: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'Additional Channel IDs', + description: + 'Channel IDs where members can add group members, as a JSON array or a comma-separated string', }, enable_section: { type: 'boolean', @@ -73,10 +75,10 @@ export const slackUpdateUserGroupTool = createSlackWebApiTool({ name: z.string().trim().min(1).optional(), handle: z.string().trim().min(1).optional(), description: z.string().optional(), - channels: slackJson(z.array(slackId)) + channels: slackIdList(z.array(slackId)) .transform((ids) => ids.join(',')) .optional(), - additional_channels: slackJson(z.array(slackId)) + additional_channels: slackIdList(z.array(slackId)) .transform((ids) => ids.join(',')) .optional(), enable_section: z.boolean().optional(), diff --git a/apps/sim/tools/slack/update_user_group_members.ts b/apps/sim/tools/slack/update_user_group_members.ts index a47f32f559f..152db74eae3 100644 --- a/apps/sim/tools/slack/update_user_group_members.ts +++ b/apps/sim/tools/slack/update_user_group_members.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { createSlackWebApiTool, slackId, slackJson } from '@/tools/slack/web-api' +import { createSlackWebApiTool, slackId, slackIdList } from '@/tools/slack/web-api' import { usergroupOutput, usergroupSchema } from '@/tools/slack/web-api-responses' /** https://docs.slack.dev/reference/methods/usergroups.users.update/ */ @@ -23,7 +23,13 @@ export const slackUpdateUserGroupMembersTool = createSlackWebApiTool({ visibility: 'user-or-llm', description: 'User Group ID', }, - users: { type: 'json', required: true, visibility: 'user-or-llm', description: 'User IDs' }, + users: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: + 'The complete member list as Slack user IDs, in a JSON array or a comma-separated string', + }, additional_channels: { type: 'json', required: false, @@ -51,8 +57,8 @@ export const slackUpdateUserGroupMembersTool = createSlackWebApiTool({ }, input: z.object({ usergroup: z.string().trim().min(1), - users: slackJson(z.array(slackId).min(1)).transform((ids) => ids.join(',')), - additional_channels: slackJson(z.array(slackId)) + users: slackIdList(z.array(slackId).min(1)).transform((ids) => ids.join(',')), + additional_channels: slackIdList(z.array(slackId)) .transform((ids) => ids.join(',')) .optional(), is_shared: z.boolean().optional(), diff --git a/apps/sim/tools/slack/utils.ts b/apps/sim/tools/slack/utils.ts index 199a1098c59..5d166867439 100644 --- a/apps/sim/tools/slack/utils.ts +++ b/apps/sim/tools/slack/utils.ts @@ -2,6 +2,7 @@ import { interruptibleSleep } from '@sim/utils/helpers' import { isRecordLike } from '@sim/utils/object' import { parseRetryAfter } from '@sim/utils/retry' import { outboundFetch } from '@/lib/core/network/outbound-fetch.server' +import { readResponseJsonWithLimit } from '@/lib/core/utils/stream-limits' import type { SlackAgentSessionStatus, SlackCanvasFile, @@ -62,6 +63,17 @@ export function requireSlackString(value: unknown, label: string): string { return value.trim() } +/** + * The `thread_ts` body field for Agent Sessions methods, which Slack requires for thread-based + * sessions and rejects for session channels; omitted when no timestamp is supplied. + */ +export function optionalSlackThreadTs(value: unknown): { thread_ts?: string } { + if (value === undefined || value === null || value === '') return {} + if (typeof value !== 'string') throw new Error('Thread Timestamp must be a string') + const trimmed = value.trim() + return trimmed ? { thread_ts: trimmed } : {} +} + /** Validates an Agent Sessions status after workflow variables have resolved. */ export function requireSlackAgentSessionStatus(value: unknown): SlackAgentSessionStatus { if ( @@ -187,6 +199,15 @@ export const mapSlackMessage = (msg: any) => ({ /** Maximum messages to request per page. Slack caps `conversations.*` at 999. */ const SLACK_PAGE_MAX = 999 + +/** + * Ceiling on pages one paginated read follows. Every page is held in memory until the read returns, + * so a model-chosen page count must not be able to buffer an entire workspace's history. + */ +const SLACK_MAX_PAGES_CEILING = 50 + +/** Byte cap on one `conversations.*` page (up to 999 messages with blocks and attachments). */ +const MAX_SLACK_PAGE_BYTES = 10 * 1024 * 1024 /** Hard ceiling on retries for a single rate-limited page. */ const SLACK_RATE_LIMIT_MAX_RETRIES = 5 @@ -215,7 +236,7 @@ export interface SlackPaginateOptions { limit: number /** Starting cursor; omit to begin from the first page. */ cursor?: string - /** Maximum number of pages to fetch before stopping. */ + /** Maximum number of pages to fetch before stopping, clamped to {@link SLACK_MAX_PAGES_CEILING}. */ maxPages: number /** Human-readable scope hint surfaced on `missing_scope`. */ missingScopeHint: string @@ -223,6 +244,13 @@ export interface SlackPaginateOptions { signal?: AbortSignal } +interface SlackMessagesPage { + ok?: boolean + error?: string + messages?: unknown[] + response_metadata?: { next_cursor?: string } +} + export interface SlackPaginateResult { messages: any[] nextCursor: string | null @@ -241,13 +269,14 @@ export async function fetchSlackMessagesPaginated( ): Promise { const { token, method, baseParams, limit, maxPages, missingScopeHint } = opts const perPage = Math.min(Math.max(Number(limit) || 0, 1), SLACK_PAGE_MAX) + const pageCeiling = Math.min(maxPages, SLACK_MAX_PAGES_CEILING) const messages: any[] = [] let cursor = opts.cursor?.trim() || undefined let nextCursor: string | null = null let pages = 0 - while (pages < maxPages) { + while (pages < pageCeiling) { const url = new URL(`https://slack.com/api/${method}`) for (const [key, value] of Object.entries(baseParams)) { const trimmed = typeof value === 'string' ? value.trim() : value @@ -275,7 +304,10 @@ export async function fetchSlackMessagesPaginated( break } - const data = await response.json() + const data = await readResponseJsonWithLimit(response, { + maxBytes: MAX_SLACK_PAGE_BYTES, + label: `Slack ${method} page`, + }) opts.signal?.throwIfAborted() if (!data.ok) { diff --git a/apps/sim/tools/slack/web-api.ts b/apps/sim/tools/slack/web-api.ts index c5ebb22ddbb..da5a0d45587 100644 --- a/apps/sim/tools/slack/web-api.ts +++ b/apps/sim/tools/slack/web-api.ts @@ -84,14 +84,34 @@ export function createSlackWebApiTool< export const slackId = z.string().trim().min(1, 'A Slack resource ID is required') +function parseSlackJson(value: string): unknown { + try { + return JSON.parse(value) + } catch { + throw new Error('Invalid JSON in Slack request') + } +} + /** JSON fields accept either parsed workflow data or the JSON editor's serialized value. */ export function slackJson(schema: Schema) { + return z.preprocess( + (value) => (typeof value === 'string' ? parseSlackJson(value) : value), + schema + ) +} + +/** + * Slack ID lists accept parsed workflow data, a JSON array string, or Slack's own comma-separated + * wire form (`U123,U456`). + */ +export function slackIdList(schema: Schema) { return z.preprocess((value) => { if (typeof value !== 'string') return value - try { - return JSON.parse(value) - } catch { - throw new Error('Invalid JSON in Slack request') - } + const trimmed = value.trim() + if (!trimmed || /^[[{"]/.test(trimmed)) return parseSlackJson(value) + return trimmed + .split(',') + .map((id) => id.trim()) + .filter(Boolean) }, schema) } diff --git a/apps/sim/tools/slack/workflow-operations.test.ts b/apps/sim/tools/slack/workflow-operations.test.ts index 2b15e5a4f4c..a6dd28b2c35 100644 --- a/apps/sim/tools/slack/workflow-operations.test.ts +++ b/apps/sim/tools/slack/workflow-operations.test.ts @@ -29,6 +29,7 @@ import { slackListUserGroupsTool } from '@/tools/slack/list_user_groups' import { slackLookupUserByEmailTool } from '@/tools/slack/lookup_user_by_email' import { slackMarkConversationReadTool } from '@/tools/slack/mark_conversation_read' import { slackOpenConversationTool } from '@/tools/slack/open_conversation' +import { slackOpenViewTool } from '@/tools/slack/open_view' import { slackPinMessageTool } from '@/tools/slack/pin_message' import { slackRemoveBookmarkTool } from '@/tools/slack/remove_bookmark' import { slackRevokeCanvasAccessTool } from '@/tools/slack/revoke_canvas_access' @@ -353,3 +354,47 @@ describe('Slack workflow API request contracts', () => { } }) }) + +describe('Slack ID list inputs', () => { + it("accepts Slack's comma-separated form and enforces documented list caps", () => { + const buildDndUrl = slackGetTeamDndInfoTool.request.url + if (typeof buildDndUrl !== 'function') throw new Error('dnd.teamInfo builds its URL') + const dndUrl = (users: unknown) => new URL(buildDndUrl({ ...auth, users } as never)) + expect(dndUrl('U1, W2').searchParams.get('users')).toBe('U1,W2') + expect(dndUrl(['U1', 'W2']).searchParams.get('users')).toBe('U1,W2') + expect(() => dndUrl(Array.from({ length: 51 }, (_, i) => `U${i}`))).toThrow() + expect(() => dndUrl('[not json')).toThrow('Invalid JSON in Slack request') + + const body = (tool: ToolConfig, params: Record) => + (tool.request.body as (p: Record) => unknown)({ ...auth, ...params }) + expect(body(slackCreateUserGroupTool, { name: 'Eng', channels: 'C1,C2' })).toMatchObject({ + channels: 'C1,C2', + }) + expect(() => + body(slackRevokeCanvasAccessTool, { canvas_id: 'F1', user_ids: 'U1,U2' }) + ).toThrow() + expect(() => + body(slackShareCanvasTool, { + canvas_id: 'F1', + access_level: 'read', + user_ids: Array.from({ length: 21 }, (_, i) => `U${i}`), + }) + ).toThrow() + }) +}) + +describe('Slack views.open targeting', () => { + it('accepts an interactivity pointer alone and rejects a call with neither target', () => { + const body = (params: Record) => + (slackOpenViewTool.request.body as (p: Record) => unknown)({ + ...auth, + view: { type: 'modal' }, + ...params, + }) + expect(body({ interactivityPointer: ' ptr-1 ' })).toEqual({ + view: { type: 'modal' }, + interactivity_pointer: 'ptr-1', + }) + expect(() => body({})).toThrow('Provide a Trigger ID or an Interactivity Pointer') + }) +}) From f0f943fae748486f41e1000c6caf0b412536249c Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 16:48:04 -0800 Subject: [PATCH 2/7] chore: regenerate tool metadata, docs and ratchet baselines --- .../content/docs/integrations/datadog.mdx | 11 +- .../docs/content/docs/integrations/github.mdx | 18 +- .../docs/content/docs/integrations/gitlab.mdx | 9 +- .../content/docs/integrations/incidentio.mdx | 377 +++++++++++++----- .../docs/content/docs/integrations/linear.mdx | 59 ++- .../content/docs/integrations/pagerduty.mdx | 9 + .../docs/content/docs/integrations/sentry.mdx | 33 +- apps/docs/content/docs/integrations/slack.mdx | 40 +- .../deployment-config/src/integrations.json | 42 +- scripts/check-explicit-any.baseline.json | 14 +- 10 files changed, 411 insertions(+), 201 deletions(-) diff --git a/apps/docs/content/docs/integrations/datadog.mdx b/apps/docs/content/docs/integrations/datadog.mdx index b143fadca99..eba115b3cc0 100644 --- a/apps/docs/content/docs/integrations/datadog.mdx +++ b/apps/docs/content/docs/integrations/datadog.mdx @@ -72,7 +72,7 @@ Query metric timeseries data from Datadog. Use for analyzing trends, creating re ### Datadog Create Event -Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences. +Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences. Uses the v1 events endpoint, which Datadog has deprecated and serves only to organizations that have used it before. @@ -95,7 +95,8 @@ Post an event to the Datadog event stream. Use for deployment notifications, ale | Parameter | Type | Description | | --------- | ---- | ----------- | | `event` | object | The created event details | -| ↳ `id` | number | Event ID | +| ↳ `id` | number | Event ID. Can lose precision above 2^53; prefer id_str | +| ↳ `id_str` | string | Event ID as an exact string | | ↳ `title` | string | Event title | | ↳ `text` | string | Event text | | ↳ `date_happened` | number | Unix timestamp when event occurred | @@ -280,7 +281,7 @@ Search and retrieve logs from Datadog. Use for troubleshooting, analysis, or mon | `query` | string | Yes | Log search query using Datadog query syntax \(e.g., "service:web-app status:error", "host:prod-* @http.status_code:500"\) | | `from` | string | Yes | Start time in ISO-8601 format or relative time \(e.g., "now-1h", "now-15m", "2024-01-15T10:00:00Z"\) | | `to` | string | Yes | End time in ISO-8601 format or relative time \(e.g., "now", "now-5m", "2024-01-15T12:00:00Z"\) | -| `limit` | number | No | Maximum number of logs to return \(e.g., 50, 100, max: 1000\) | +| `limit` | number | No | Maximum number of logs to return \(default: 50, max: 5000\) | | `cursor` | string | No | Pagination cursor from a previous call, taken from its nextLogId output. Omit for the first page. | | `sort` | string | No | Sort order: "timestamp" for oldest first, "-timestamp" for newest first | | `indexes` | string | No | Comma-separated list of log indexes to search | @@ -476,6 +477,7 @@ Get the details of a single incident by ID. Requires the Incident Management `in | ↳ `modified` | string | Last modification timestamp | | ↳ `resolved` | string | Resolution timestamp | | ↳ `time_to_resolve` | number | Seconds from creation to resolution | +| `included` | array | Related resources requested through include \(users, attachments\) | @@ -705,7 +707,7 @@ Update a service level objective. Reads the current SLO first and applies only t | --------- | ---- | -------- | ----------- | | `sloId` | string | Yes | The ID of the service level objective to update | | `name` | string | No | New name for the SLO. Leave blank to keep the current name. | -| `type` | string | No | SLO type: "metric" or "monitor". Leave blank to keep the current type. Changing type requires supplying the matching query or monitorIds. | +| `type` | string | No | SLO type: "metric" or "monitor". Leave blank to keep the current type. Changing type requires supplying the matching query or monitorIds. Converting to a "time_slice" SLO is not supported. | | `thresholds` | string | No | JSON array of thresholds replacing the stored ones, e.g. \[\{"timeframe": "30d", "target": 99.9, "warning": 99.95\}\]. Leave blank to keep the current thresholds. | | `description` | string | No | Description of the SLO | | `tags` | string | No | Comma-separated tags \(e.g., "env:prod,team:core"\) | @@ -785,6 +787,7 @@ Get an SLO’s history over a time window, including the overall SLI value and r | ↳ `monitors` | array | Per-monitor SLI data for multi-monitor SLOs | | ↳ `thresholds` | object | Thresholds keyed by timeframe | | `sliValue` | number | Overall SLI value over the window | +| `errors` | array | Errors Datadog hit while querying the history; the call can succeed with partial data | diff --git a/apps/docs/content/docs/integrations/github.mdx b/apps/docs/content/docs/integrations/github.mdx index 6d53cce14ca..003ceded586 100644 --- a/apps/docs/content/docs/integrations/github.mdx +++ b/apps/docs/content/docs/integrations/github.mdx @@ -113,6 +113,8 @@ Create comments on GitHub PRs | `path` | string | No | File path for review comment | | `commentType` | string | No | Type of comment \(pr_comment or file_comment\) | | `line` | number | No | Line number for review comment | +| `side` | string | No | Side of the diff \(LEFT or RIGHT\) | +| `commitId` | string | No | The SHA of the commit to comment on. Defaults to the pull request head commit. | #### Output @@ -629,7 +631,7 @@ Get the list of files changed in a pull request | ↳ `contents_url` | string | Contents API URL | | ↳ `patch` | string | Diff patch | | ↳ `previous_filename` | string | Previous filename \(for renames\) | -| `count` | number | Total number of files | +| `count` | number | Number of files in this page | @@ -1383,7 +1385,7 @@ Close an issue in a GitHub repository | `owner` | string | Yes | Repository owner | | `repo` | string | Yes | Repository name | | `issue_number` | number | Yes | Issue number | -| `state_reason` | string | No | Reason for closing: completed or not_planned | +| `state_reason` | string | No | Reason for closing: completed, not_planned, or duplicate | #### Output @@ -1946,7 +1948,7 @@ List workflow runs for a repository, or for a single workflow when a workflow ID | `actor` | string | No | Filter by user who triggered the workflow | | `branch` | string | No | Filter by branch name | | `event` | string | No | Filter by event type \(e.g., push, pull_request, workflow_dispatch\) | -| `status` | string | No | Filter by status \(queued, in_progress, completed, waiting, requested, pending\) | +| `status` | string | No | Filter by check run status or conclusion: queued, in_progress, completed, waiting, requested, pending, success, failure, cancelled, skipped, timed_out, action_required, neutral, or stale. Omit \(or pass "all"\) for every run. | | `per_page` | number | No | Number of results per page \(default: 30, max: 100\) | | `page` | number | No | Page number of results to fetch \(default: 1\) | @@ -2217,8 +2219,8 @@ Search for code across GitHub repositories. Use qualifiers like repo:owner/name, | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `q` | string | Yes | Search query with optional qualifiers \(repo:, language:, path:, extension:, user:, org:\) | -| `sort` | string | No | Sort by indexed date \(default: best match\) | -| `order` | string | No | Sort order: asc or desc \(default: desc\) | +| `sort` | string | No | Sort by "indexed" \(how recently GitHub indexed the file\); default is best match. GitHub has deprecated this parameter and is closing it down. | +| `order` | string | No | Sort order: asc or desc \(default: desc\). Ignored unless sort is set; GitHub has deprecated this parameter and is closing it down. | | `per_page` | number | No | Results per page \(max 100, default: 30\) | | `page` | number | No | Page number \(default: 1\) | @@ -2627,7 +2629,7 @@ List commits in a repository with optional filtering by SHA, path, author, commi ### GitHub Get Commit -Get detailed information about a specific commit including files changed and stats +Get detailed information about a specific commit including files changed and stats. GitHub returns at most the first 300 changed files of a larger commit. @@ -2723,8 +2725,8 @@ Compare two commits or branches to see the diff, commits between them, and chang | `repo` | string | Yes | Repository name | | `base` | string | Yes | Base branch/tag/SHA for comparison | | `head` | string | Yes | Head branch/tag/SHA for comparison | -| `per_page` | number | No | Results per page for files \(max 100, default: 30\) | -| `page` | number | No | Page number for files \(default: 1\) | +| `per_page` | number | No | Commits per page \(max 100\). Setting per_page or page paginates the commit list, and changed files are returned only on page 1. Leave both unset to get up to 250 commits and every changed file in one response. | +| `page` | number | No | Page of the commit list. Changed files are returned only on page 1. Leave unset \(with per_page\) for a single unpaginated comparison. | #### Output diff --git a/apps/docs/content/docs/integrations/gitlab.mdx b/apps/docs/content/docs/integrations/gitlab.mdx index 9256c2ac0e5..ae6c4564f99 100644 --- a/apps/docs/content/docs/integrations/gitlab.mdx +++ b/apps/docs/content/docs/integrations/gitlab.mdx @@ -420,6 +420,7 @@ Merge a merge request in a GitLab project | `squash` | boolean | No | Squash commits before merging | | `shouldRemoveSourceBranch` | boolean | No | Delete source branch after merge | | `mergeWhenPipelineSucceeds` | boolean | No | Merge when pipeline succeeds | +| `sha` | string | No | HEAD SHA of the source branch; the merge fails if it does not match. Required when the group or instance requires a commit SHA on the merge requests API. | #### Output @@ -1024,7 +1025,7 @@ Add an existing GitLab user to a project or group at a given access level | `resourceId` | string | Yes | Project or group ID or path \(e.g. mygroup/myproject\) | | `userId` | number | No | The ID of the user to add. Provide either userId or username. | | `username` | string | No | The username of the user to add. Provide either userId or username. | -| `accessLevel` | number | Yes | Access level: 0 \(No access\), 5 \(Minimal\), 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\) | +| `accessLevel` | number | Yes | Access level: 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\). 5 \(Minimal access\) is also valid for a top-level group on Premium and Ultimate. | | `expiresAt` | string | No | Access expiration date in YYYY-MM-DD format | | `memberRoleId` | number | No | Custom member role ID \(GitLab Ultimate only\) | @@ -1050,7 +1051,7 @@ Update a member's access level in a GitLab project or group | `resourceType` | string | Yes | Whether the resource is a 'project' or a 'group' | | `resourceId` | string | Yes | Project or group ID or path \(e.g. mygroup/myproject\) | | `userId` | number | Yes | The ID of the member to update | -| `accessLevel` | number | Yes | New access level: 0 \(No access\), 5 \(Minimal\), 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\) | +| `accessLevel` | number | Yes | New access level: 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\). 5 \(Minimal access\) is also valid for a top-level group on Premium and Ultimate. | | `expiresAt` | string | No | Access expiration date in YYYY-MM-DD format. Pass an empty string to clear an existing expiration. | | `memberRoleId` | number | No | Custom member role ID \(GitLab Ultimate only\). Warning: when omitted, GitLab removes any custom role the member currently holds. | @@ -1099,7 +1100,7 @@ Invite a person to a GitLab project or group by email address | `resourceType` | string | Yes | Whether the resource is a 'project' or a 'group' | | `resourceId` | string | Yes | Project or group ID or path \(e.g. mygroup/myproject\) | | `email` | string | Yes | Email address to invite \(comma-separated for multiple\) | -| `accessLevel` | number | Yes | Access level: 0 \(No access\), 5 \(Minimal\), 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\) | +| `accessLevel` | number | Yes | Access level: 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\). 5 \(Minimal access\) is also valid for a top-level group on Premium and Ultimate. | | `expiresAt` | string | No | Access expiration date in YYYY-MM-DD format | | `memberRoleId` | number | No | Custom member role ID \(GitLab Ultimate only\) | | `inviteSource` | string | No | Identifier recorded as the source of the invitation \(for attribution\) | @@ -2018,7 +2019,7 @@ Add a SAML group link that maps an identity-provider group to a GitLab group at | --------- | ---- | -------- | ----------- | | `groupId` | string | Yes | Group ID or path \(e.g. my-org/my-group\) | | `samlGroupName` | string | Yes | The name of the SAML group as sent by the identity provider | -| `accessLevel` | number | Yes | Access level granted to members of the SAML group: 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\) | +| `accessLevel` | number | Yes | Access level granted to members of the SAML group: 10 \(Guest\), 15 \(Planner\), 20 \(Reporter\), 25 \(Security Manager\), 30 \(Developer\), 40 \(Maintainer\), 50 \(Owner\). 5 \(Minimal access\) is also valid for a top-level group. | | `memberRoleId` | number | No | Custom member role ID \(GitLab Ultimate only\) | | `provider` | string | No | Unique provider name that must match for this group link to be applied \(GitLab 18.2+\) | diff --git a/apps/docs/content/docs/integrations/incidentio.mdx b/apps/docs/content/docs/integrations/incidentio.mdx index b70b6bd9022..b768a6418cb 100644 --- a/apps/docs/content/docs/integrations/incidentio.mdx +++ b/apps/docs/content/docs/integrations/incidentio.mdx @@ -74,7 +74,7 @@ List incidents from incident.io. Returns a list of incidents with their details ### incident.io Incidents Create -Create a new incident in incident.io. Requires idempotency_key, severity_id, and visibility. Optionally accepts name, summary, type, and status. +Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status. @@ -85,7 +85,7 @@ Create a new incident in incident.io. Requires idempotency_key, severity_id, and | `idempotency_key` | string | Yes | Unique identifier to prevent duplicate incident creation. Use a UUID or unique string. | | `name` | string | No | Name of the incident \(e.g., "Database connection issues"\) | | `summary` | string | No | Brief summary of the incident \(e.g., "Intermittent connection failures to primary database"\) | -| `severity_id` | string | Yes | ID of the severity level \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | +| `severity_id` | string | No | ID of the severity level \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `incident_type_id` | string | No | ID of the incident type | | `incident_status_id` | string | No | ID of the initial incident status | | `visibility` | string | Yes | Visibility of the incident: "public" or "private" \(required\) | @@ -159,14 +159,14 @@ Retrieve detailed information about a specific incident from incident.io by its | ↳ `slack_channel_id` | string | Associated Slack channel ID | | ↳ `slack_channel_name` | string | Associated Slack channel name | | ↳ `visibility` | string | Incident visibility | -| ↳ `custom_field_entries` | array | Custom field values for the incident | +| ↳ `custom_field_entries` | array | Custom field values for the incident. Each value carries one of value_text, value_link, value_numeric, value_option \(\{id, value\}\), or value_catalog_entry \(\{id, name, external_id\}\). | | ↳ `incident_role_assignments` | array | Role assignments for the incident | ### incident.io Incidents Update -Update an existing incident in incident.io. Can update name, summary, severity, status, or type. +Update an existing incident in incident.io. Can update name, summary, severity, or status. @@ -179,7 +179,7 @@ Update an existing incident in incident.io. Can update name, summary, severity, | `summary` | string | No | Updated summary of the incident \(e.g., "Intermittent connection failures to primary database"\) | | `severity_id` | string | No | Updated severity ID for the incident \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `incident_status_id` | string | No | Updated status ID for the incident \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | -| `incident_type_id` | string | No | Updated incident type ID | +| `incident_type_id` | string | No | Not applied: incident.io does not support changing an incident's type after creation, so this value is ignored. | | `notify_incident_channel` | boolean | Yes | Whether to notify the incident channel about this update | #### Output @@ -214,7 +214,7 @@ Update an existing incident in incident.io. Can update name, summary, severity, ### incident.io Actions List -List actions from incident.io. Optionally filter by incident ID. +List actions from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 actions, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page. @@ -223,12 +223,17 @@ List actions from incident.io. Optionally filter by incident ID. | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `incident_id` | string | No | Filter actions by incident ID \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | -| `incident_mode` | string | No | Filter actions by incident mode \(standard, retrospective, test, tutorial, or stream\) | +| `incident_mode` | string | No | Filter actions by incident mode \(standard, retrospective, test, tutorial, or stream\). When omitted, actions from standard and retrospective incidents are returned. | +| `page_size` | number | No | Number of actions per page, 1-250. Setting it fetches a single page instead of following pages automatically | +| `after` | string | No | Pagination cursor from a previous page's pagination_meta.after \(e.g., "01FDAG4SAP5TYPT98WGR2N7W91"\) | #### Output | Parameter | Type | Description | | --------- | ---- | ----------- | +| `pagination_meta` | object | Pagination metadata. Pass `after` back to fetch the next page. | +| ↳ `after` | string | Cursor for the next page | +| ↳ `page_size` | number | Number of results per page | | `actions` | array | List of actions | | ↳ `id` | string | Action ID | | ↳ `description` | string | Action description | @@ -237,19 +242,30 @@ List actions from incident.io. Optionally filter by incident ID. | ↳ `name` | string | User name | | ↳ `email` | string | User email | | ↳ `status` | string | Action status | -| ↳ `due_at` | string | Due date/time | +| ↳ `due_at` | string | Deprecated: incident.io actions have no due date, so this is never set | | ↳ `created_at` | string | Creation timestamp | | ↳ `updated_at` | string | Last update timestamp | | ↳ `incident_id` | string | Associated incident ID | -| ↳ `creator` | object | User who created the action | -| ↳ `id` | string | User ID | -| ↳ `name` | string | User name | -| ↳ `email` | string | User email | +| ↳ `creator` | object | Who created the action | +| ↳ `user` | object | The user who caused this, if a person did | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | +| ↳ `api_key` | object | The API key that caused this, if an integration did | +| ↳ `id` | string | API key ID | +| ↳ `name` | string | API key name | +| ↳ `workflow` | object | The incident.io workflow that caused this, if automation did | +| ↳ `id` | string | Workflow ID | +| ↳ `name` | string | Workflow name | +| ↳ `alert` | object | The alert that caused this, if an alert did | +| ↳ `id` | string | Alert ID | +| ↳ `title` | string | Alert title | +| ↳ `id` | string | ID of the user, API key, workflow, or alert | +| ↳ `name` | string | Name of the user, API key, or workflow \(or the alert title\) | +| ↳ `email` | string | User email, when a user created it | | ↳ `completed_at` | string | Completion timestamp | -| ↳ `external_issue_reference` | object | External issue tracking reference | -| ↳ `provider` | string | Issue tracking provider \(e.g., Jira, Linear\) | -| ↳ `issue_name` | string | Issue identifier | -| ↳ `issue_permalink` | string | URL to the external issue | @@ -277,25 +293,36 @@ Get detailed information about a specific action from incident.io. | ↳ `name` | string | User name | | ↳ `email` | string | User email | | ↳ `status` | string | Action status | -| ↳ `due_at` | string | Due date/time | +| ↳ `due_at` | string | Deprecated: incident.io actions have no due date, so this is never set | | ↳ `created_at` | string | Creation timestamp | | ↳ `updated_at` | string | Last update timestamp | | ↳ `incident_id` | string | Associated incident ID | -| ↳ `creator` | object | User who created the action | -| ↳ `id` | string | User ID | -| ↳ `name` | string | User name | -| ↳ `email` | string | User email | +| ↳ `creator` | object | Who created the action | +| ↳ `user` | object | The user who caused this, if a person did | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | +| ↳ `api_key` | object | The API key that caused this, if an integration did | +| ↳ `id` | string | API key ID | +| ↳ `name` | string | API key name | +| ↳ `workflow` | object | The incident.io workflow that caused this, if automation did | +| ↳ `id` | string | Workflow ID | +| ↳ `name` | string | Workflow name | +| ↳ `alert` | object | The alert that caused this, if an alert did | +| ↳ `id` | string | Alert ID | +| ↳ `title` | string | Alert title | +| ↳ `id` | string | ID of the user, API key, workflow, or alert | +| ↳ `name` | string | Name of the user, API key, or workflow \(or the alert title\) | +| ↳ `email` | string | User email, when a user created it | | ↳ `completed_at` | string | Completion timestamp | -| ↳ `external_issue_reference` | object | External issue tracking reference | -| ↳ `provider` | string | Issue tracking provider \(e.g., Jira, Linear\) | -| ↳ `issue_name` | string | Issue identifier | -| ↳ `issue_permalink` | string | URL to the external issue | ### incident.io Follow-ups List -List follow-ups from incident.io. Optionally filter by incident ID. +List follow-ups from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 follow-ups, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page. @@ -304,12 +331,17 @@ List follow-ups from incident.io. Optionally filter by incident ID. | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `incident_id` | string | No | Filter follow-ups by incident ID \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | -| `incident_mode` | string | No | Filter follow-ups by incident mode \(standard, retrospective, test, tutorial, or stream\) | +| `incident_mode` | string | No | Filter follow-ups by incident mode \(standard, retrospective, test, tutorial, or stream\). When omitted, follow-ups from standard and retrospective incidents are returned. | +| `page_size` | number | No | Number of follow-ups per page, 1-250. Setting it fetches a single page instead of following pages automatically | +| `after` | string | No | Pagination cursor from a previous page's pagination_meta.after \(e.g., "01FDAG4SAP5TYPT98WGR2N7W91"\) | #### Output | Parameter | Type | Description | | --------- | ---- | ----------- | +| `pagination_meta` | object | Pagination metadata. Pass `after` back to fetch the next page. | +| ↳ `after` | string | Cursor for the next page | +| ↳ `page_size` | number | Number of results per page | | `follow_ups` | array | List of follow-ups | | ↳ `id` | string | Follow-up ID | | ↳ `title` | string | Follow-up title | @@ -318,25 +350,48 @@ List follow-ups from incident.io. Optionally filter by incident ID. | ↳ `id` | string | User ID | | ↳ `name` | string | User name | | ↳ `email` | string | User email | +| ↳ `assignee_team` | object | The team the follow-up is assigned to | +| ↳ `id` | string | Team ID | +| ↳ `name` | string | Team name | | ↳ `status` | string | Follow-up status | | ↳ `priority` | object | Follow-up priority | | ↳ `id` | string | Priority ID | | ↳ `name` | string | Priority name | | ↳ `description` | string | Priority description | | ↳ `rank` | number | Priority rank | +| ↳ `category` | object | Follow-up category | +| ↳ `id` | string | Category ID | +| ↳ `name` | string | Category name | +| ↳ `description` | string | Category description | +| ↳ `rank` | number | Category rank | | ↳ `created_at` | string | Creation timestamp | | ↳ `updated_at` | string | Last update timestamp | | ↳ `incident_id` | string | Associated incident ID | -| ↳ `creator` | object | User who created the follow-up | -| ↳ `id` | string | User ID | -| ↳ `name` | string | User name | -| ↳ `email` | string | User email | +| ↳ `creator` | object | Who created the follow-up | +| ↳ `user` | object | The user who caused this, if a person did | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | +| ↳ `api_key` | object | The API key that caused this, if an integration did | +| ↳ `id` | string | API key ID | +| ↳ `name` | string | API key name | +| ↳ `workflow` | object | The incident.io workflow that caused this, if automation did | +| ↳ `id` | string | Workflow ID | +| ↳ `name` | string | Workflow name | +| ↳ `alert` | object | The alert that caused this, if an alert did | +| ↳ `id` | string | Alert ID | +| ↳ `title` | string | Alert title | +| ↳ `id` | string | ID of the user, API key, workflow, or alert | +| ↳ `name` | string | Name of the user, API key, or workflow \(or the alert title\) | +| ↳ `email` | string | User email, when a user created it | | ↳ `completed_at` | string | Completion timestamp | | ↳ `labels` | array | Labels associated with the follow-up | | ↳ `external_issue_reference` | object | External issue tracking reference | -| ↳ `provider` | string | External provider name | -| ↳ `issue_name` | string | External issue name or ID | -| ↳ `issue_permalink` | string | Permalink to external issue | +| ↳ `provider` | string | Issue tracking provider \(e.g., Jira, Linear\) | +| ↳ `issue_name` | string | Issue identifier | +| ↳ `issue_permalink` | string | URL to the external issue | @@ -364,25 +419,48 @@ Get detailed information about a specific follow-up from incident.io. | ↳ `id` | string | User ID | | ↳ `name` | string | User name | | ↳ `email` | string | User email | +| ↳ `assignee_team` | object | The team the follow-up is assigned to | +| ↳ `id` | string | Team ID | +| ↳ `name` | string | Team name | | ↳ `status` | string | Follow-up status | | ↳ `priority` | object | Follow-up priority | | ↳ `id` | string | Priority ID | | ↳ `name` | string | Priority name | | ↳ `description` | string | Priority description | | ↳ `rank` | number | Priority rank | +| ↳ `category` | object | Follow-up category | +| ↳ `id` | string | Category ID | +| ↳ `name` | string | Category name | +| ↳ `description` | string | Category description | +| ↳ `rank` | number | Category rank | | ↳ `created_at` | string | Creation timestamp | | ↳ `updated_at` | string | Last update timestamp | | ↳ `incident_id` | string | Associated incident ID | -| ↳ `creator` | object | User who created the follow-up | -| ↳ `id` | string | User ID | -| ↳ `name` | string | User name | -| ↳ `email` | string | User email | +| ↳ `creator` | object | Who created the follow-up | +| ↳ `user` | object | The user who caused this, if a person did | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | +| ↳ `api_key` | object | The API key that caused this, if an integration did | +| ↳ `id` | string | API key ID | +| ↳ `name` | string | API key name | +| ↳ `workflow` | object | The incident.io workflow that caused this, if automation did | +| ↳ `id` | string | Workflow ID | +| ↳ `name` | string | Workflow name | +| ↳ `alert` | object | The alert that caused this, if an alert did | +| ↳ `id` | string | Alert ID | +| ↳ `title` | string | Alert title | +| ↳ `id` | string | ID of the user, API key, workflow, or alert | +| ↳ `name` | string | Name of the user, API key, or workflow \(or the alert title\) | +| ↳ `email` | string | User email, when a user created it | | ↳ `completed_at` | string | Completion timestamp | | ↳ `labels` | array | Labels associated with the follow-up | | ↳ `external_issue_reference` | object | External issue tracking reference | -| ↳ `provider` | string | External provider name | -| ↳ `issue_name` | string | External issue name or ID | -| ↳ `issue_permalink` | string | Permalink to external issue | +| ↳ `provider` | string | Issue tracking provider \(e.g., Jira, Linear\) | +| ↳ `issue_name` | string | Issue identifier | +| ↳ `issue_permalink` | string | URL to the external issue | @@ -400,6 +478,7 @@ List all users in your Incident.io workspace. Returns user details including id, | `after` | string | No | Pagination cursor to fetch the next page of results | | `email` | string | No | Filter users by email address | | `slack_user_id` | string | No | Filter users by Slack user ID | +| `include_inactive` | boolean | No | Include deactivated or not-yet-active users, for resolving people who have since been offboarded. Default: false | #### Output @@ -410,6 +489,8 @@ List all users in your Incident.io workspace. Returns user details including id, | ↳ `name` | string | Full name of the user | | ↳ `email` | string | Email address of the user | | ↳ `role` | string | Role of the user in the workspace | +| ↳ `slack_user_id` | string | Slack ID of the user | +| ↳ `is_active` | boolean | Whether the user is active \(false once deactivated\) | | `pagination_meta` | object | Pagination metadata | | ↳ `after` | string | Cursor for next page | | ↳ `page_size` | number | Number of items per page | @@ -438,6 +519,8 @@ Get detailed information about a specific user in your Incident.io workspace by | ↳ `name` | string | Full name of the user | | ↳ `email` | string | Email address of the user | | ↳ `role` | string | Role of the user in the workspace | +| ↳ `slack_user_id` | string | Slack ID of the user | +| ↳ `is_active` | boolean | Whether the user is active \(false once deactivated\) | @@ -682,6 +765,7 @@ List all schedules in incident.io | `pagination_meta` | object | Pagination metadata | | ↳ `after` | string | Cursor for next page | | ↳ `page_size` | number | Number of results per page | +| ↳ `total_record_count` | number | Total number of schedules | @@ -766,7 +850,7 @@ Update an existing schedule in incident.io | `id` | string | Yes | The ID of the schedule to update \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `name` | string | No | New name for the schedule \(e.g., "Primary On-Call"\) | | `timezone` | string | No | New timezone for the schedule \(e.g., America/New_York\) | -| `config` | string | No | Schedule configuration as JSON string with rotations. Example: \{"rotations": \[\{"name": "Primary", "users": \[\{"id": "user_id"\}\], "handover_start_at": "2024-01-01T09:00:00Z", "handovers": \[\{"interval": 1, "interval_type": "weekly"\}\]\}\]\} | +| `config` | string | No | Schedule configuration as JSON with rotations. Sending it replaces the entire configuration, including any scheduled future versions of its rotations, so fetch the schedule first and include every version you want to keep. Example: \{"rotations": \[\{"name": "Primary", "users": \[\{"id": "user_id"\}\], "handover_start_at": "2024-01-01T09:00:00Z", "handovers": \[\{"interval": 1, "interval_type": "weekly"\}\]\}\]\} | #### Output @@ -803,7 +887,7 @@ Delete a schedule in incident.io ### List Escalations -List all escalation policies in incident.io +List escalations (pages sent to people) in incident.io. For escalation policies, use List Escalation Paths. @@ -811,7 +895,7 @@ List all escalation policies in incident.io | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `page_size` | number | No | Number of escalations to return per page | +| `page_size` | number | No | Number of escalations to return per page \(max 50\) | | `after` | string | No | Pagination cursor to fetch the next page of results | #### Output @@ -835,7 +919,7 @@ List all escalation policies in incident.io ### Create Escalation -Create a new escalation policy in incident.io +Page users or an escalation path (create an escalation) in incident.io. Provide either escalation_path_id or user_ids, not both. To create a reusable escalation policy, use Create Escalation Path instead. @@ -846,7 +930,9 @@ Create a new escalation policy in incident.io | `idempotency_key` | string | Yes | Unique identifier to prevent duplicate escalation creation. Use a UUID or unique string. | | `title` | string | Yes | Title of the escalation \(e.g., "Database Critical Alert"\) | | `escalation_path_id` | string | No | ID of the escalation path to use \(required if user_ids not provided\) | -| `user_ids` | string | No | Comma-separated list of user IDs to notify \(required if escalation_path_id not provided\) | +| `user_ids` | string | No | Comma-separated list of user IDs to page directly \(required if escalation_path_id not provided\) | +| `incident_id` | string | No | ID of an incident to link this escalation to; it appears in the escalation's related incidents \(e.g., "01H0J1EXE7AXZ2C93K61WBPYEH"\) | +| `description` | string | No | Additional details included with the page \(e.g., "Database CPU above 90%"\) | #### Output @@ -866,7 +952,7 @@ Create a new escalation policy in incident.io ### Show Escalation -Get details of a specific escalation policy in incident.io +Get an escalation (a page sent to people) in incident.io. For an escalation policy, use Show Escalation Path. @@ -874,7 +960,7 @@ Get details of a specific escalation policy in incident.io | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | string | Yes | The ID of the escalation policy \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | +| `id` | string | Yes | The ID of the escalation \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | #### Output @@ -1110,7 +1196,7 @@ List all incident roles in incident.io | ↳ `instructions` | string | Instructions for the role | | ↳ `shortform` | string | Short form abbreviation of the role | | ↳ `role_type` | string | The type of role | -| ↳ `required` | boolean | Whether the role is required | +| ↳ `required` | boolean | Not returned by the incident.io API; always empty | | ↳ `created_at` | string | When the role was created | | ↳ `updated_at` | string | When the role was last updated | @@ -1142,7 +1228,7 @@ Create a new incident role in incident.io | ↳ `instructions` | string | Instructions for the role | | ↳ `shortform` | string | Short form abbreviation of the role | | ↳ `role_type` | string | The type of role | -| ↳ `required` | boolean | Whether the role is required | +| ↳ `required` | boolean | Not returned by the incident.io API; always empty | | ↳ `created_at` | string | When the role was created | | ↳ `updated_at` | string | When the role was last updated | @@ -1171,7 +1257,7 @@ Get details of a specific incident role in incident.io | ↳ `instructions` | string | Instructions for the role | | ↳ `shortform` | string | Short form abbreviation of the role | | ↳ `role_type` | string | The type of role | -| ↳ `required` | boolean | Whether the role is required | +| ↳ `required` | boolean | Not returned by the incident.io API; always empty | | ↳ `created_at` | string | When the role was created | | ↳ `updated_at` | string | When the role was last updated | @@ -1204,7 +1290,7 @@ Update an existing incident role in incident.io | ↳ `instructions` | string | Instructions for the role | | ↳ `shortform` | string | Short form abbreviation of the role | | ↳ `role_type` | string | The type of role | -| ↳ `required` | boolean | Whether the role is required | +| ↳ `required` | boolean | Not returned by the incident.io API; always empty | | ↳ `created_at` | string | When the role was created | | ↳ `updated_at` | string | When the role was last updated | @@ -1249,8 +1335,8 @@ List all incident timestamp definitions in incident.io | ↳ `id` | string | The timestamp ID | | ↳ `name` | string | The timestamp name | | ↳ `rank` | number | The rank/order of the timestamp | -| ↳ `created_at` | string | When the timestamp was created | -| ↳ `updated_at` | string | When the timestamp was last updated | +| ↳ `created_at` | string | Not returned by the incident.io API; always empty | +| ↳ `updated_at` | string | Not returned by the incident.io API; always empty | @@ -1274,8 +1360,8 @@ Get details of a specific incident timestamp definition in incident.io | ↳ `id` | string | The timestamp ID | | ↳ `name` | string | The timestamp name | | ↳ `rank` | number | The rank/order of the timestamp | -| ↳ `created_at` | string | When the timestamp was created | -| ↳ `updated_at` | string | When the timestamp was last updated | +| ↳ `created_at` | string | Not returned by the incident.io API; always empty | +| ↳ `updated_at` | string | Not returned by the incident.io API; always empty | @@ -1408,7 +1494,7 @@ List escalation paths in incident.io | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `page_size` | number | No | Number of escalation paths to return per page | +| `page_size` | number | No | Number of escalation paths to return per page \(max 25\) | | `after` | string | No | Pagination cursor to fetch the next page of results | #### Output @@ -1418,8 +1504,35 @@ List escalation paths in incident.io | `escalation_paths` | array | List of escalation paths | | ↳ `id` | string | The escalation path ID | | ↳ `name` | string | The escalation path name | -| ↳ `path` | array | Array of escalation levels | -| ↳ `working_hours` | array | Working hours configuration | +| ↳ `kind` | string | Path kind \(standalone, templated\) | +| ↳ `team_ids` | array | IDs of the teams that own this escalation path | +| ↳ `path` | array | Nodes that form the levels and branches of the path | +| ↳ `id` | string | Node ID, unique within the path | +| ↳ `type` | string | Node type \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\) | +| ↳ `level` | object | For a level node: who to page and how long to wait for an ack | +| ↳ `targets` | array | Users, schedules, or channels to page | +| ↳ `id` | string | Target ID | +| ↳ `type` | string | Target type \(schedule, user, slack_channel, msteams_channel\) | +| ↳ `urgency` | string | Urgency \(high, low\) | +| ↳ `schedule_mode` | string | For schedule targets, which users to page | +| ↳ `time_to_ack_seconds` | number | Seconds to wait for an ack before moving on | +| ↳ `notify_channel` | json | For a notify_channel node | +| ↳ `delay` | json | For a delay node | +| ↳ `if_else` | json | For an if_else node | +| ↳ `repeat` | json | For a repeat node | +| ↳ `escalation_path` | json | For an escalation_path node | +| ↳ `working_hours` | array | Working-hours windows the path can refer to | +| ↳ `id` | string | Window ID | +| ↳ `name` | string | Window name | +| ↳ `timezone` | string | Timezone the intervals are in | +| ↳ `weekday_intervals` | array | Intervals, each \{weekday, start_time, end_time\} | +| ↳ `repeat_config` | json | How the path repeats | +| ↳ `current_responders` | array | Users currently on call for this path | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | | `pagination_meta` | object | Pagination metadata | | ↳ `after` | string | Cursor for next page | | ↳ `page_size` | number | Number of results per page | @@ -1437,8 +1550,8 @@ Create a new escalation path in incident.io | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `name` | string | Yes | Name of the escalation path \(e.g., "Critical Incident Path"\) | -| `path` | json | Yes | Array of escalation levels with targets and time to acknowledge in seconds. Each level should have: targets \(array of \{id, type, schedule_id?, user_id?, urgency\}\) and time_to_ack_seconds \(number\) | -| `working_hours` | json | No | Optional working hours configuration. Array of \{weekday, start_time, end_time\} | +| `path` | json | Yes | Array of escalation path nodes. Each node needs a unique "id" and a "type" \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\); a level node nests its targets under "level", e.g. \[\{"id":"lvl1","type":"level","level":\{"targets":\[\{"id":"<schedule id>","type":"schedule","schedule_mode":"currently_on_call","urgency":"high"\}\],"time_to_ack_seconds":300\}\}\]. Target type is schedule, user, slack_channel, or msteams_channel; urgency is high or low. | +| `working_hours` | json | No | Optional. Array of working-hours windows, each \{id, name, timezone, weekday_intervals: \[\{weekday, start_time, end_time\}\]\}, e.g. \[\{"id":"wh","name":"Business hours","timezone":"Europe/London","weekday_intervals":\[\{"weekday":"monday","start_time":"09:00","end_time":"17:00"\}\]\}\] | #### Output @@ -1447,18 +1560,35 @@ Create a new escalation path in incident.io | `escalation_path` | object | The created escalation path | | ↳ `id` | string | The escalation path ID | | ↳ `name` | string | The escalation path name | -| ↳ `path` | array | Array of escalation levels | -| ↳ `targets` | array | Targets for this level | -| ↳ `id` | string | Target ID | -| ↳ `type` | string | Target type | -| ↳ `schedule_id` | string | Schedule ID if type is schedule | -| ↳ `user_id` | string | User ID if type is user | -| ↳ `urgency` | string | Urgency level | -| ↳ `time_to_ack_seconds` | number | Time to acknowledge in seconds | -| ↳ `working_hours` | array | Working hours configuration | -| ↳ `weekday` | string | Day of week | -| ↳ `start_time` | string | Start time | -| ↳ `end_time` | string | End time | +| ↳ `kind` | string | Path kind \(standalone, templated\) | +| ↳ `team_ids` | array | IDs of the teams that own this escalation path | +| ↳ `path` | array | Nodes that form the levels and branches of the path | +| ↳ `id` | string | Node ID, unique within the path | +| ↳ `type` | string | Node type \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\) | +| ↳ `level` | object | For a level node: who to page and how long to wait for an ack | +| ↳ `targets` | array | Users, schedules, or channels to page | +| ↳ `id` | string | Target ID | +| ↳ `type` | string | Target type \(schedule, user, slack_channel, msteams_channel\) | +| ↳ `urgency` | string | Urgency \(high, low\) | +| ↳ `schedule_mode` | string | For schedule targets, which users to page | +| ↳ `time_to_ack_seconds` | number | Seconds to wait for an ack before moving on | +| ↳ `notify_channel` | json | For a notify_channel node | +| ↳ `delay` | json | For a delay node | +| ↳ `if_else` | json | For an if_else node | +| ↳ `repeat` | json | For a repeat node | +| ↳ `escalation_path` | json | For an escalation_path node | +| ↳ `working_hours` | array | Working-hours windows the path can refer to | +| ↳ `id` | string | Window ID | +| ↳ `name` | string | Window name | +| ↳ `timezone` | string | Timezone the intervals are in | +| ↳ `weekday_intervals` | array | Intervals, each \{weekday, start_time, end_time\} | +| ↳ `repeat_config` | json | How the path repeats | +| ↳ `current_responders` | array | Users currently on call for this path | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | @@ -1481,18 +1611,35 @@ Get details of a specific escalation path in incident.io | `escalation_path` | object | The escalation path details | | ↳ `id` | string | The escalation path ID | | ↳ `name` | string | The escalation path name | -| ↳ `path` | array | Array of escalation levels | -| ↳ `targets` | array | Targets for this level | -| ↳ `id` | string | Target ID | -| ↳ `type` | string | Target type | -| ↳ `schedule_id` | string | Schedule ID if type is schedule | -| ↳ `user_id` | string | User ID if type is user | -| ↳ `urgency` | string | Urgency level | -| ↳ `time_to_ack_seconds` | number | Time to acknowledge in seconds | -| ↳ `working_hours` | array | Working hours configuration | -| ↳ `weekday` | string | Day of week | -| ↳ `start_time` | string | Start time | -| ↳ `end_time` | string | End time | +| ↳ `kind` | string | Path kind \(standalone, templated\) | +| ↳ `team_ids` | array | IDs of the teams that own this escalation path | +| ↳ `path` | array | Nodes that form the levels and branches of the path | +| ↳ `id` | string | Node ID, unique within the path | +| ↳ `type` | string | Node type \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\) | +| ↳ `level` | object | For a level node: who to page and how long to wait for an ack | +| ↳ `targets` | array | Users, schedules, or channels to page | +| ↳ `id` | string | Target ID | +| ↳ `type` | string | Target type \(schedule, user, slack_channel, msteams_channel\) | +| ↳ `urgency` | string | Urgency \(high, low\) | +| ↳ `schedule_mode` | string | For schedule targets, which users to page | +| ↳ `time_to_ack_seconds` | number | Seconds to wait for an ack before moving on | +| ↳ `notify_channel` | json | For a notify_channel node | +| ↳ `delay` | json | For a delay node | +| ↳ `if_else` | json | For an if_else node | +| ↳ `repeat` | json | For a repeat node | +| ↳ `escalation_path` | json | For an escalation_path node | +| ↳ `working_hours` | array | Working-hours windows the path can refer to | +| ↳ `id` | string | Window ID | +| ↳ `name` | string | Window name | +| ↳ `timezone` | string | Timezone the intervals are in | +| ↳ `weekday_intervals` | array | Intervals, each \{weekday, start_time, end_time\} | +| ↳ `repeat_config` | json | How the path repeats | +| ↳ `current_responders` | array | Users currently on call for this path | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | @@ -1508,8 +1655,8 @@ Update an existing escalation path in incident.io | --------- | ---- | -------- | ----------- | | `id` | string | Yes | The ID of the escalation path to update \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `name` | string | Yes | New name for the escalation path \(e.g., "Critical Incident Path"\) | -| `path` | json | Yes | New escalation path configuration. Array of escalation levels with targets and time_to_ack_seconds | -| `working_hours` | json | No | New working hours configuration. Array of \{weekday, start_time, end_time\} | +| `path` | json | Yes | New escalation path configuration. Array of escalation path nodes. Each node needs a unique "id" and a "type" \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\); a level node nests its targets under "level", e.g. \[\{"id":"lvl1","type":"level","level":\{"targets":\[\{"id":"<schedule id>","type":"schedule","schedule_mode":"currently_on_call","urgency":"high"\}\],"time_to_ack_seconds":300\}\}\]. Target type is schedule, user, slack_channel, or msteams_channel; urgency is high or low. | +| `working_hours` | json | No | New working hours configuration. Array of working-hours windows, each \{id, name, timezone, weekday_intervals: \[\{weekday, start_time, end_time\}\]\}, e.g. \[\{"id":"wh","name":"Business hours","timezone":"Europe/London","weekday_intervals":\[\{"weekday":"monday","start_time":"09:00","end_time":"17:00"\}\]\}\] | #### Output @@ -1518,18 +1665,35 @@ Update an existing escalation path in incident.io | `escalation_path` | object | The updated escalation path | | ↳ `id` | string | The escalation path ID | | ↳ `name` | string | The escalation path name | -| ↳ `path` | array | Array of escalation levels | -| ↳ `targets` | array | Targets for this level | -| ↳ `id` | string | Target ID | -| ↳ `type` | string | Target type | -| ↳ `schedule_id` | string | Schedule ID if type is schedule | -| ↳ `user_id` | string | User ID if type is user | -| ↳ `urgency` | string | Urgency level | -| ↳ `time_to_ack_seconds` | number | Time to acknowledge in seconds | -| ↳ `working_hours` | array | Working hours configuration | -| ↳ `weekday` | string | Day of week | -| ↳ `start_time` | string | Start time | -| ↳ `end_time` | string | End time | +| ↳ `kind` | string | Path kind \(standalone, templated\) | +| ↳ `team_ids` | array | IDs of the teams that own this escalation path | +| ↳ `path` | array | Nodes that form the levels and branches of the path | +| ↳ `id` | string | Node ID, unique within the path | +| ↳ `type` | string | Node type \(level, notify_channel, delay, if_else, repeat, voicemail, escalation_path\) | +| ↳ `level` | object | For a level node: who to page and how long to wait for an ack | +| ↳ `targets` | array | Users, schedules, or channels to page | +| ↳ `id` | string | Target ID | +| ↳ `type` | string | Target type \(schedule, user, slack_channel, msteams_channel\) | +| ↳ `urgency` | string | Urgency \(high, low\) | +| ↳ `schedule_mode` | string | For schedule targets, which users to page | +| ↳ `time_to_ack_seconds` | number | Seconds to wait for an ack before moving on | +| ↳ `notify_channel` | json | For a notify_channel node | +| ↳ `delay` | json | For a delay node | +| ↳ `if_else` | json | For an if_else node | +| ↳ `repeat` | json | For a repeat node | +| ↳ `escalation_path` | json | For an escalation_path node | +| ↳ `working_hours` | array | Working-hours windows the path can refer to | +| ↳ `id` | string | Window ID | +| ↳ `name` | string | Window name | +| ↳ `timezone` | string | Timezone the intervals are in | +| ↳ `weekday_intervals` | array | Intervals, each \{weekday, start_time, end_time\} | +| ↳ `repeat_config` | json | How the path repeats | +| ↳ `current_responders` | array | Users currently on call for this path | +| ↳ `id` | string | User ID | +| ↳ `name` | string | User display name | +| ↳ `email` | string | User email address | +| ↳ `role` | string | User role | +| ↳ `slack_user_id` | string | Slack user ID | @@ -1631,7 +1795,7 @@ List alerts in incident.io, optionally filtered by status, source, or created da | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50\). Default: 25 | +| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50; max 50\). Default: 25 | | `after` | string | No | Pagination cursor to fetch the next page of results \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `status` | string | No | Filter by alert status: "firing" or "resolved" | | `status_operator` | string | No | How to apply the status filter: "one_of" to match it, "not_in" to exclude it. Default: one_of | @@ -1660,6 +1824,9 @@ List alerts in incident.io, optionally filtered by status, source, or created da | ↳ `updated_at` | string | When this alert was last updated | | ↳ `alert_group_ids` | array | IDs of every alert group this alert belongs to | | ↳ `attributes` | array | Attribute values parsed from the alert payload | +| ↳ `tags` | array | Tags someone has applied to this alert | +| ↳ `id` | string | Tag ID | +| ↳ `name` | string | Tag name | | `pagination_meta` | object | Pagination metadata | | ↳ `after` | string | Cursor for next page | | ↳ `page_size` | number | Number of results per page | @@ -1695,6 +1862,9 @@ Get a single alert by ID from incident.io | ↳ `updated_at` | string | When this alert was last updated | | ↳ `alert_group_ids` | array | IDs of every alert group this alert belongs to | | ↳ `attributes` | array | Attribute values parsed from the alert payload | +| ↳ `tags` | array | Tags someone has applied to this alert | +| ↳ `id` | string | Tag ID | +| ↳ `name` | string | Tag name | @@ -1727,6 +1897,9 @@ Resolve a currently firing alert in incident.io. Resolving an already-resolved a | ↳ `updated_at` | string | When this alert was last updated | | ↳ `alert_group_ids` | array | IDs of every alert group this alert belongs to | | ↳ `attributes` | array | Attribute values parsed from the alert payload | +| ↳ `tags` | array | Tags someone has applied to this alert | +| ↳ `id` | string | Tag ID | +| ↳ `name` | string | Tag name | @@ -1769,7 +1942,7 @@ List the connections between incidents and alerts in incident.io — which alert | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50\). Default: 25 | +| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50; max 50\). Default: 25 | | `after` | string | No | Pagination cursor to fetch the next page of results \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `incident_id` | string | No | Only return alerts attached to this incident \(e.g., "01FDAG4SAP5TYPT98WGR2N7W91"\) | | `alert_id` | string | No | Only return connections for this alert \(e.g., "01GW2G3V0S59R238FAHPDS1R66"\) | @@ -1878,7 +2051,7 @@ List the entries of a catalog type in incident.io — for example every service, | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `catalog_type_id` | string | Yes | The ID of the catalog type to list entries for \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | -| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50\). Default: 25 | +| `page_size` | number | No | Number of results per page \(e.g., 10, 25, 50; max 250\). Default: 25 | | `after` | string | No | Pagination cursor to fetch the next page of results \(e.g., "01FCNDV6P870EA6S7TK1DSYDG0"\) | | `identifier` | string | No | Only return entries matching this identifier. Searches by ID, external ID, and alias. | diff --git a/apps/docs/content/docs/integrations/linear.mdx b/apps/docs/content/docs/integrations/linear.mdx index 53b4a019aae..739914cb558 100644 --- a/apps/docs/content/docs/integrations/linear.mdx +++ b/apps/docs/content/docs/integrations/linear.mdx @@ -582,7 +582,11 @@ List projects in Linear with optional filtering | ↳ `id` | string | Project ID | | ↳ `name` | string | Project name | | ↳ `description` | string | Project description | -| ↳ `state` | string | Project state \(planned, started, paused, completed, canceled\) | +| ↳ `state` | string | Deprecated project state \(planned, started, paused, completed, canceled\); prefer status | +| ↳ `status` | object | Current project status | +| ↳ `id` | string | Project status ID | +| ↳ `name` | string | Project status name | +| ↳ `type` | string | Status type \(backlog, planned, started, paused, completed, canceled\) | | ↳ `priority` | number | Project priority \(0-4\) | | ↳ `startDate` | string | Start date \(YYYY-MM-DD\) | | ↳ `targetDate` | string | Target date \(YYYY-MM-DD\) | @@ -594,6 +598,9 @@ List projects in Linear with optional filtering | ↳ `teams` | array | Associated teams | | ↳ `id` | string | Team ID | | ↳ `name` | string | Team name | +| ↳ `completedAt` | string | Completion timestamp \(ISO 8601\) | +| ↳ `canceledAt` | string | Cancellation timestamp \(ISO 8601\) | +| ↳ `archivedAt` | string | Archive timestamp \(ISO 8601\) | @@ -617,7 +624,11 @@ Get a single project by ID from Linear | ↳ `id` | string | Project ID | | ↳ `name` | string | Project name | | ↳ `description` | string | Project description | -| ↳ `state` | string | Project state \(planned, started, paused, completed, canceled\) | +| ↳ `state` | string | Deprecated project state \(planned, started, paused, completed, canceled\); prefer status | +| ↳ `status` | object | Current project status | +| ↳ `id` | string | Project status ID | +| ↳ `name` | string | Project status name | +| ↳ `type` | string | Status type \(backlog, planned, started, paused, completed, canceled\) | | ↳ `priority` | number | Project priority \(0-4\) | | ↳ `startDate` | string | Start date \(YYYY-MM-DD\) | | ↳ `targetDate` | string | Target date \(YYYY-MM-DD\) | @@ -629,6 +640,9 @@ Get a single project by ID from Linear | ↳ `teams` | array | Associated teams | | ↳ `id` | string | Team ID | | ↳ `name` | string | Team name | +| ↳ `completedAt` | string | Completion timestamp \(ISO 8601\) | +| ↳ `canceledAt` | string | Cancellation timestamp \(ISO 8601\) | +| ↳ `archivedAt` | string | Archive timestamp \(ISO 8601\) | @@ -658,7 +672,11 @@ Create a new project in Linear | ↳ `id` | string | Project ID | | ↳ `name` | string | Project name | | ↳ `description` | string | Project description | -| ↳ `state` | string | Project state \(planned, started, paused, completed, canceled\) | +| ↳ `state` | string | Deprecated project state \(planned, started, paused, completed, canceled\); prefer status | +| ↳ `status` | object | Current project status | +| ↳ `id` | string | Project status ID | +| ↳ `name` | string | Project status name | +| ↳ `type` | string | Status type \(backlog, planned, started, paused, completed, canceled\) | | ↳ `priority` | number | Project priority \(0-4\) | | ↳ `startDate` | string | Start date \(YYYY-MM-DD\) | | ↳ `targetDate` | string | Target date \(YYYY-MM-DD\) | @@ -686,7 +704,8 @@ Update an existing project in Linear | `projectId` | string | Yes | Project ID to update | | `name` | string | No | New project name | | `description` | string | No | New project description | -| `state` | string | No | Project state \(planned, started, completed, canceled\) | +| `state` | string | No | Deprecated: Linear no longer accepts a project state on update. Use statusId instead; a state given without statusId fails with an error. | +| `statusId` | string | No | Project status ID to move the project to \(see List Project Statuses\). Omit to keep the current status. | | `leadId` | string | No | User ID of the project lead | | `startDate` | string | No | Project start date \(ISO format: YYYY-MM-DD\) | | `targetDate` | string | No | Project target date \(ISO format: YYYY-MM-DD\) | @@ -700,7 +719,11 @@ Update an existing project in Linear | ↳ `id` | string | Project ID | | ↳ `name` | string | Project name | | ↳ `description` | string | Project description | -| ↳ `state` | string | Project state \(planned, started, paused, completed, canceled\) | +| ↳ `state` | string | Deprecated project state \(planned, started, paused, completed, canceled\); prefer status | +| ↳ `status` | object | Current project status | +| ↳ `id` | string | Project status ID | +| ↳ `name` | string | Project status name | +| ↳ `type` | string | Status type \(backlog, planned, started, paused, completed, canceled\) | | ↳ `priority` | number | Project priority \(0-4\) | | ↳ `startDate` | string | Start date \(YYYY-MM-DD\) | | ↳ `targetDate` | string | Target date \(YYYY-MM-DD\) | @@ -928,7 +951,7 @@ Update an existing label in Linear ### Linear Archive Label -Archive a label in Linear +Archive (retire) a label in Linear. A retired label can no longer be newly assigned but stays on issues that already use it. @@ -996,7 +1019,7 @@ Create a new workflow state (status) in Linear | --------- | ---- | -------- | ----------- | | `teamId` | string | Yes | Team ID to create the state in | | `name` | string | Yes | State name \(e.g., "In Review"\) | -| `color` | string | No | State color \(hex format\) | +| `color` | string | Yes | State color \(hex format, e.g. #5E6AD2\) | | `type` | string | Yes | State type: "backlog", "unstarted", "started", "completed", or "canceled" | | `description` | string | No | State description | | `position` | number | No | Position in the workflow | @@ -1126,7 +1149,7 @@ Get a single cycle by ID from Linear ### Linear Create Cycle -Create a new cycle (sprint/iteration) in Linear +Deprecated: Linear no longer supports creating cycles through its API (they are generated from the team cycle settings), so this always returns an error from Linear. @@ -1519,7 +1542,7 @@ Mark a notification as read or unread in Linear | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `notificationId` | string | Yes | Notification ID to update | -| `readAt` | string | No | Timestamp to mark as read \(ISO format\). Pass null or omit to mark as unread | +| `readAt` | string | No | ISO timestamp to mark the notification read at. Omit it to mark it read now; pass null to mark it unread. | #### Output @@ -1530,7 +1553,7 @@ Mark a notification as read or unread in Linear | ↳ `type` | string | Notification type | | ↳ `createdAt` | string | Creation timestamp | | ↳ `readAt` | string | Read timestamp | -| ↳ `issue` | object | Related issue | +| ↳ `issue` | object | Related issue \(only for issue notifications\) | @@ -1624,8 +1647,8 @@ Create a customer request (need) in Linear. Assign to customer, set urgency (pri | `customerId` | string | Yes | Customer ID to assign this request to | | `body` | string | No | Description of the customer request | | `priority` | number | No | Urgency level: 0 = Not important, 1 = Important \(default: 0\) | -| `issueId` | string | No | Issue ID to link this request to | -| `projectId` | string | No | Project ID to link this request to | +| `issueId` | string | Yes | Issue to link this request to \(UUID or identifier such as ENG-123\). Linear requires it for API calls. | +| `projectId` | string | No | Deprecated and ignored: Linear no longer accepts a project on customer requests. | #### Output @@ -1661,7 +1684,7 @@ Update a customer request (need) in Linear. Can change urgency, description, cus | `priority` | number | No | Updated urgency level: 0 = Not important, 1 = Important | | `customerId` | string | No | New customer ID to assign this request to | | `issueId` | string | No | New issue ID to link this request to | -| `projectId` | string | No | New project ID to link this request to | +| `projectId` | string | No | Deprecated and ignored: Linear no longer accepts a project on customer requests. | #### Output @@ -2371,7 +2394,7 @@ Create a new project status in Linear | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `name` | string | Yes | Project status name | -| `type` | string | Yes | Status type: "backlog", "planned", "started", "paused", "completed", or "canceled" | +| `type` | string | Yes | Status type: "backlog", "planned", "started", "completed", or "canceled" | | `color` | string | Yes | Status color \(hex code\) | | `position` | number | Yes | Position in status list \(e.g. 0, 1, 2...\) | | `description` | string | No | Status description | @@ -2430,9 +2453,9 @@ Update a project status in Linear -### Linear Delete Project Status +### Linear Archive Project Status -Delete a project status in Linear +Archive a project status in Linear (Linear does not support deleting one). The status must have no active projects and must not be the last status of its type. @@ -2440,13 +2463,13 @@ Delete a project status in Linear | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `statusId` | string | Yes | Project status ID to delete | +| `statusId` | string | Yes | Project status ID to archive | #### Output | Parameter | Type | Description | | --------- | ---- | ----------- | -| `success` | boolean | Whether the deletion was successful | +| `success` | boolean | Whether the archive was successful | diff --git a/apps/docs/content/docs/integrations/pagerduty.mdx b/apps/docs/content/docs/integrations/pagerduty.mdx index a2182e65860..ed808cb41e5 100644 --- a/apps/docs/content/docs/integrations/pagerduty.mdx +++ b/apps/docs/content/docs/integrations/pagerduty.mdx @@ -37,6 +37,7 @@ List incidents from PagerDuty with optional filters. | `sortBy` | string | No | Sort field \(e.g., created_at:desc\) | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -254,6 +255,7 @@ List the individual alerts attached to a PagerDuty incident. | `statuses` | string | No | Comma-separated statuses to filter \(triggered, resolved\) | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -288,6 +290,7 @@ List services from PagerDuty with optional name filter. | `query` | string | No | Filter services by name | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -354,6 +357,7 @@ List current on-call entries from PagerDuty. | `until` | string | No | End time filter \(ISO 8601 format\) | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -388,6 +392,7 @@ List escalation policies from PagerDuty with an optional name filter. | `query` | string | No | Filter escalation policies by name | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -419,6 +424,7 @@ List on-call schedules from PagerDuty with an optional name filter. | `query` | string | No | Filter schedules by name | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -449,6 +455,7 @@ List users from PagerDuty with an optional name/email filter. | `query` | string | No | Filter users by name or email | | `limit` | string | No | Maximum number of results \(max 100\) | | `offset` | string | No | Offset to start pagination search results | +| `includeTotal` | boolean | No | Populate the total result count in the response \(PagerDuty returns null for total unless requested; slower\) | #### Output @@ -487,6 +494,8 @@ Send a trigger, acknowledge, or resolve event to PagerDuty Events API v2 using a | `component` | string | No | Component of the source machine responsible for the event | | `group` | string | No | Logical grouping of components of a service | | `class` | string | No | The class/type of the event | +| `timestamp` | string | No | ISO 8601 time at which the monitoring tool detected or generated the event \(trigger only\) | +| `customDetails` | json | No | JSON object of additional details about the event and affected system \(trigger only\) | #### Output diff --git a/apps/docs/content/docs/integrations/sentry.mdx b/apps/docs/content/docs/integrations/sentry.mdx index eb30a0e5a9a..c0c70bdeac2 100644 --- a/apps/docs/content/docs/integrations/sentry.mdx +++ b/apps/docs/content/docs/integrations/sentry.mdx @@ -30,9 +30,9 @@ List issues from Sentry for a specific organization and optionally a specific pr | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `organizationSlug` | string | Yes | The slug of the organization \(e.g., "my-org"\) | -| `projectSlug` | string | No | Filter issues by numeric project ID \(e.g., "4501234"\). This organization-scoped endpoint requires the numeric project ID, not the project slug. | +| `projectSlug` | string | No | Filter issues by project ID or slug \(e.g., "4501234" or "my-project"\) | | `query` | string | No | Search query to filter issues. Supports Sentry search syntax \(e.g., "is:unresolved", "level:error"\) | -| `statsPeriod` | string | No | Time window for the per-issue stats series \(e.g., "24h", "14d"\). Note: this controls the stats returned with each issue, not which issues are returned — use the query \(e.g., "age:-7d", "lastSeen:-24h"\) to filter results. | +| `statsPeriod` | string | No | Time window to search \(e.g., "24h", "14d"\); only issues with events in this window are returned. | | `cursor` | string | No | Pagination cursor for retrieving next page of results | | `limit` | number | No | Number of issues to return per page \(max: 100\) | | `status` | string | No | Filter by issue status: unresolved, resolved, or ignored. The legacy "ignored"/"muted" values map to Sentry's current "archived" search token. | @@ -84,6 +84,8 @@ List issues from Sentry for a specific organization and optionally a specific pr | `metadata` | object | Pagination metadata | | ↳ `nextCursor` | string | Cursor for the next page of results \(if available\) | | ↳ `hasMore` | boolean | Whether there are more results available | +| `nextCursor` | string | Cursor for the next page of results; pass it as the Pagination Cursor to fetch that page | +| `hasMore` | boolean | Whether there are more results available | @@ -159,6 +161,7 @@ Update a Sentry issue by changing its status, assignment, bookmark state, or oth | `organizationSlug` | string | Yes | The slug of the organization \(e.g., "my-org"\) | | `issueId` | string | Yes | The unique ID of the issue to update \(e.g., "12345"\) | | `status` | string | No | New status for the issue: resolved, unresolved, ignored, or resolvedInNextRelease | +| `priority` | string | No | New priority for the issue: low, medium, or high | | `assignedTo` | string | No | Actor to assign the issue to, in the form "user:<id>" or "team:<id>" \(a bare username or email is also accepted\). Use an empty string to unassign. | | `isBookmarked` | boolean | No | Whether to bookmark the issue | | `isSubscribed` | boolean | No | Whether to subscribe to issue updates | @@ -213,7 +216,7 @@ List all projects in a Sentry organization. Returns project details including na | ↳ `isBookmarked` | boolean | Whether the project is bookmarked | | ↳ `isMember` | boolean | Whether the user is a member of the project | | ↳ `features` | array | Enabled features for the project | -| ↳ `organization` | object | Organization information | +| ↳ `organization` | object | Organization information \(not returned by this endpoint; use Get Project\) | | ↳ `id` | string | Organization ID | | ↳ `slug` | string | Organization slug | | ↳ `name` | string | Organization name | @@ -221,11 +224,13 @@ List all projects in a Sentry organization. Returns project details including na | ↳ `id` | string | Team ID | | ↳ `name` | string | Team name | | ↳ `slug` | string | Team slug | -| ↳ `status` | string | Project status | -| ↳ `isPublic` | boolean | Whether the project is publicly visible | +| ↳ `status` | string | Project status \(not returned by this endpoint; use Get Project\) | +| ↳ `isPublic` | boolean | Whether the project is publicly visible \(not returned by this endpoint; use Get Project\) | | `metadata` | object | Pagination metadata | | ↳ `nextCursor` | string | Cursor for the next page of results \(if available\) | | ↳ `hasMore` | boolean | Whether there are more results available | +| `nextCursor` | string | Cursor for the next page of results; pass it as the Pagination Cursor to fetch that page | +| `hasMore` | boolean | Whether there are more results available | @@ -315,7 +320,7 @@ Create a new Sentry project in an organization. Requires a team to associate the | ↳ `hasAccess` | boolean | Whether the user has access | | ↳ `features` | array | Enabled features | | ↳ `firstEvent` | string | First event timestamp | -| ↳ `organization` | object | Organization information | +| ↳ `organization` | object | Organization information \(not returned by this endpoint; use Get Project\) | | ↳ `id` | string | Organization ID | | ↳ `slug` | string | Organization slug | | ↳ `name` | string | Organization name | @@ -327,9 +332,9 @@ Create a new Sentry project in an organization. Requires a team to associate the | ↳ `id` | string | Team ID | | ↳ `name` | string | Team name | | ↳ `slug` | string | Team slug | -| ↳ `status` | string | Project status | -| ↳ `color` | string | Project color code | -| ↳ `isPublic` | boolean | Whether the project is public | +| ↳ `status` | string | Project status \(not returned by this endpoint; use Get Project\) | +| ↳ `color` | string | Project color code \(not returned by this endpoint; use Get Project\) | +| ↳ `isPublic` | boolean | Whether the project is public \(not returned by this endpoint; use Get Project\) | @@ -388,7 +393,7 @@ List events from a Sentry project. Can be filtered by issue ID, query, or time p | `issueId` | string | No | Filter events by a specific issue ID \(e.g., "12345"\) | | `query` | string | No | Search query to filter events. Only applied when an Issue ID is provided \(the issue events endpoint\); the project events endpoint ignores it. Supports Sentry search syntax \(e.g., "user.email:*@example.com"\) | | `cursor` | string | No | Pagination cursor for retrieving next page of results | -| `limit` | number | No | Number of events to return per page \(max: 100\) | +| `limit` | number | No | Number of events to return per page \(max: 10, because full event bodies are requested\) | | `statsPeriod` | string | No | Time period to query \(e.g., "24h", "7d", "14d"\). Cannot be combined with absolute start/end. | #### Output @@ -434,6 +439,8 @@ List events from a Sentry project. Can be filtered by issue ID, query, or time p | `metadata` | object | Pagination metadata | | ↳ `nextCursor` | string | Cursor for the next page of results \(if available\) | | ↳ `hasMore` | boolean | Whether there are more results available | +| `nextCursor` | string | Cursor for the next page of results; pass it as the Pagination Cursor to fetch that page | +| `hasMore` | boolean | Whether there are more results available | @@ -505,7 +512,7 @@ List releases for a Sentry organization or project. Returns release details incl | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `organizationSlug` | string | Yes | The slug of the organization \(e.g., "my-org"\) | -| `projectSlug` | string | No | Filter releases by numeric project ID \(e.g., "4501234"\). This organization-scoped endpoint requires the numeric project ID, not the project slug. | +| `projectSlug` | string | No | Filter releases by project ID or slug \(e.g., "4501234" or "my-project"\) | | `query` | string | No | Search query to filter releases \(e.g., "1.0" to match version patterns\) | | `cursor` | string | No | Pagination cursor for retrieving next page of results | | `limit` | number | No | Number of releases to return per page \(default: 25, max: 100\) | @@ -558,6 +565,8 @@ List releases for a Sentry organization or project. Returns release details incl | `metadata` | object | Pagination metadata | | ↳ `nextCursor` | string | Cursor for the next page of results \(if available\) | | ↳ `hasMore` | boolean | Whether there are more results available | +| `nextCursor` | string | Cursor for the next page of results; pass it as the Pagination Cursor to fetch that page | +| `hasMore` | boolean | Whether there are more results available | @@ -696,6 +705,8 @@ List all teams in a Sentry organization. Useful for discovering the team slug re | `metadata` | object | Pagination metadata | | ↳ `nextCursor` | string | Cursor for the next page of results \(if available\) | | ↳ `hasMore` | boolean | Whether there are more results available | +| `nextCursor` | string | Cursor for the next page of results; pass it as the Pagination Cursor to fetch that page | +| `hasMore` | boolean | Whether there are more results available | diff --git a/apps/docs/content/docs/integrations/slack.mdx b/apps/docs/content/docs/integrations/slack.mdx index ee31effedea..d1dc16f95c5 100644 --- a/apps/docs/content/docs/integrations/slack.mdx +++ b/apps/docs/content/docs/integrations/slack.mdx @@ -616,7 +616,7 @@ Fetch every message in a Slack thread, automatically following pagination across | `inclusive` | boolean | No | Include messages with timestamps matching oldest or latest \(default: false\) | | `limit` | number | No | Messages to request per page \(default: 200, max: 999\) | | `cursor` | string | No | Pagination cursor from a previous response.nextCursor to resume from | -| `maxPages` | number | No | Maximum number of pages to fetch before stopping \(default: 10\) | +| `maxPages` | number | No | Maximum number of pages to fetch before stopping \(default: 10, max: 50\) | #### Output @@ -812,7 +812,7 @@ Fetch message history from a Slack channel, automatically following pagination. | `inclusive` | boolean | No | Include messages with timestamps matching oldest or latest \(default: false\) | | `limit` | number | No | Messages to request per page \(default: 200, max: 999\) | | `cursor` | string | No | Pagination cursor from a previous response.nextCursor to resume from | -| `maxPages` | number | No | Maximum number of pages to fetch before stopping \(default: 10\) | +| `maxPages` | number | No | Maximum number of pages to fetch before stopping \(default: 10, max: 50\) | #### Output @@ -960,7 +960,7 @@ Set the title of a Slack assistant thread (shown in the AI app thread header). ### Slack Set Suggested Prompts -Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app). +Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app). For apps on the legacy assistant experience (assistant_view) only. Slack silently fails this call for agent apps (agent_view); use Set Agent Suggested Prompts instead. @@ -1023,7 +1023,7 @@ Create or update the state of a Slack agent session associated with a thread. | `authMethod` | string | No | Slack authentication method | | `botToken` | string | No | Custom Slack bot token | | `channel` | string | Yes | Channel ID containing the agent session thread | -| `threadTs` | string | Yes | Timestamp of the thread associated with the agent session | +| `threadTs` | string | No | Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in regular channels and DMs; omit for session channels. | | `status` | string | Yes | Agent session state: active, processing, suspended, or closed | | `title` | string | No | Title used when creating the agent session, up to 200 characters | | `initiatorUserId` | string | No | Slack user ID that initiated the session | @@ -1055,7 +1055,7 @@ Rename the Slack agent session associated with a thread. | `authMethod` | string | No | Slack authentication method | | `botToken` | string | No | Custom Slack bot token | | `channel` | string | Yes | Channel ID containing the agent session thread | -| `threadTs` | string | Yes | Timestamp of the thread associated with the agent session | +| `threadTs` | string | No | Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in regular channels and DMs; omit for session channels. | | `title` | string | Yes | New agent session title, from 1 to 200 characters | #### Output @@ -2081,7 +2081,7 @@ Open a modal view in Slack using a trigger_id from an interaction payload. Used | --------- | ---- | -------- | ----------- | | `authMethod` | string | No | Authentication method: oauth or bot_token | | `botToken` | string | No | Bot token for Custom Bot | -| `triggerId` | string | Yes | Exchange a trigger to post to the user. Obtained from an interaction payload \(e.g., slash command, button click\) | +| `triggerId` | string | No | Exchange a trigger to post to the user. Obtained from an interaction payload \(e.g., slash command, button click\). Provide this or interactivityPointer. | | `interactivityPointer` | string | No | Alternative to trigger_id for posting to user | | `view` | json | Yes | A view payload object defining the modal. Must include type \("modal"\), title, and blocks array | @@ -2182,7 +2182,7 @@ Push a new view onto an existing modal stack in Slack. Limited to 2 additional v | --------- | ---- | -------- | ----------- | | `authMethod` | string | No | Authentication method: oauth or bot_token | | `botToken` | string | No | Bot token for Custom Bot | -| `triggerId` | string | Yes | Exchange a trigger to post to the user. Obtained from an interaction payload \(e.g., button click within an existing modal\) | +| `triggerId` | string | No | Exchange a trigger to post to the user. Obtained from an interaction payload \(e.g., button click within an existing modal\). Provide this or interactivityPointer. | | `interactivityPointer` | string | No | Alternative to trigger_id for posting to user | | `view` | json | Yes | A view payload object defining the modal to push. Must include type \("modal"\), title, and blocks array | @@ -2584,8 +2584,8 @@ Change access for users or regular channels on a standalone canvas. For sharing, | --------- | ---- | -------- | ----------- | | `canvas_id` | string | Yes | Canvas ID | | `access_level` | string | Yes | Access Level Options: read, write, owner. | -| `user_ids` | json | No | User IDs | -| `channel_ids` | json | No | Channel IDs | +| `user_ids` | json | No | Up to 20 Slack user IDs, as a JSON array or a comma-separated string. Omit channel_ids. | +| `channel_ids` | json | No | Up to 20 Slack channel IDs, as a JSON array or a comma-separated string. Omit user_ids. | #### Output @@ -2606,8 +2606,8 @@ Remove user or regular-channel access to a standalone canvas. Channel-granted ac | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `canvas_id` | string | Yes | Canvas ID | -| `user_ids` | json | No | User IDs | -| `channel_ids` | json | No | Channel IDs | +| `user_ids` | json | No | One Slack user ID to remove, as \["U123"\] or U123. Omit channel_ids. | +| `channel_ids` | json | No | One Slack channel ID to remove, as \["C123"\] or C123. Omit user_ids. | #### Output @@ -2701,7 +2701,7 @@ Remove a user from a Slack conversation, subject to workspace permissions. ### Slack Unarchive Conversation -Restore an archived Slack channel. +Restore an archived Slack channel. Slack does not currently let bot tokens unarchive conversations, so this fails with the Sim app or a custom bot until Slack lifts that limit. @@ -2721,7 +2721,7 @@ Restore an archived Slack channel. ### Slack Close Conversation -Close a direct message or group direct message for the authenticated identity. +Close a direct message or group direct message for the authenticated identity. The Sim app can close 1:1 direct messages only; closing a group direct message needs a custom bot with the mpim:write scope. @@ -2770,7 +2770,7 @@ Open a DM or group DM with 1–8 user IDs, or resume a conversation by ID. Suppl | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `users` | json | No | User IDs | +| `users` | json | No | 1 to 8 Slack user IDs, as a JSON array or a comma-separated string. Omit channel. | | `channel` | string | No | Conversation ID | | `prevent_creation` | boolean | No | Only Resume Existing Conversation | | `return_im` | boolean | No | Include Conversation Details | @@ -3443,8 +3443,8 @@ Create a Slack user group with a mention handle and default channels. Requires a | `name` | string | Yes | Name | | `handle` | string | No | Mention Handle | | `description` | string | No | Description | -| `channels` | json | No | Default Channel IDs | -| `additional_channels` | json | No | Additional Channel IDs | +| `channels` | json | No | Default channel IDs for the group, as a JSON array \(\["C123"\]\) or a comma-separated string \(C123,C456\) | +| `additional_channels` | json | No | Channel IDs where members can add group members, as a JSON array or a comma-separated string | | `enable_section` | boolean | No | Show as Sidebar Section | | `include_count` | boolean | No | Include Member Count | | `team_id` | string | No | Workspace ID | @@ -3485,8 +3485,8 @@ Change a Slack user group’s name, handle, description, or default channels. Re | `name` | string | No | Name | | `handle` | string | No | Mention Handle | | `description` | string | No | Description | -| `channels` | json | No | Default Channel IDs | -| `additional_channels` | json | No | Additional Channel IDs | +| `channels` | json | No | Default channel IDs for the group, as a JSON array \(\["C123"\]\) or a comma-separated string \(C123,C456\) | +| `additional_channels` | json | No | Channel IDs where members can add group members, as a JSON array or a comma-separated string | | `enable_section` | boolean | No | Show as Sidebar Section | | `include_count` | boolean | No | Include Member Count | | `team_id` | string | No | Workspace ID | @@ -3656,7 +3656,7 @@ Replace all members of a Slack user group with the supplied user IDs. An empty l | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `usergroup` | string | Yes | User Group ID | -| `users` | json | Yes | User IDs | +| `users` | json | Yes | The complete member list as Slack user IDs, in a JSON array or a comma-separated string | | `additional_channels` | json | No | Additional Channel IDs | | `is_shared` | boolean | No | Shared Section | | `include_count` | boolean | No | Include Member Count | @@ -3722,7 +3722,7 @@ Read Do Not Disturb settings for the supplied user IDs. | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `users` | json | Yes | User IDs | +| `users` | json | Yes | Slack user IDs to read, up to 50, as a JSON array \(\["U123","W456"\]\) or a comma-separated string \(U123,W456\) | | `team_id` | string | No | Workspace ID | #### Output diff --git a/packages/deployment-config/src/integrations.json b/packages/deployment-config/src/integrations.json index 0a1367be88e..06cfa657443 100644 --- a/packages/deployment-config/src/integrations.json +++ b/packages/deployment-config/src/integrations.json @@ -7644,7 +7644,7 @@ }, { "name": "Create Event", - "description": "Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences." + "description": "Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences. Uses the v1 events endpoint, which Datadog has deprecated and serves only to organizations that have used it before." }, { "name": "Create Monitor", @@ -7807,7 +7807,7 @@ "category": "tools", "integrationType": "observability", "tags": ["monitoring", "incident-management", "error-tracking"], - "updatedAt": "2026-11-11" + "updatedAt": "2026-11-16" }, { "type": "datagma", @@ -10397,7 +10397,7 @@ }, { "name": "Get commit", - "description": "Get detailed information about a specific commit including files changed and stats" + "description": "Get detailed information about a specific commit including files changed and stats. GitHub returns at most the first 300 changed files of a larger commit." }, { "name": "Compare commits", @@ -10560,7 +10560,7 @@ "category": "tools", "integrationType": "devops", "tags": ["version-control", "ci-cd"], - "updatedAt": "2026-11-10" + "updatedAt": "2026-11-16" }, { "type": "gitlab_v2", @@ -13880,7 +13880,7 @@ }, { "name": "Create Incident", - "description": "Create a new incident in incident.io. Requires idempotency_key, severity_id, and visibility. Optionally accepts name, summary, type, and status." + "description": "Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status." }, { "name": "Show Incident", @@ -13888,11 +13888,11 @@ }, { "name": "Update Incident", - "description": "Update an existing incident in incident.io. Can update name, summary, severity, status, or type." + "description": "Update an existing incident in incident.io. Can update name, summary, severity, or status." }, { "name": "List Actions", - "description": "List actions from incident.io. Optionally filter by incident ID." + "description": "List actions from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 actions, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page." }, { "name": "Show Action", @@ -13900,7 +13900,7 @@ }, { "name": "List Follow-ups", - "description": "List follow-ups from incident.io. Optionally filter by incident ID." + "description": "List follow-ups from incident.io, optionally filtered by incident ID. Without page_size or after, follows pages automatically and returns up to 2,500 follow-ups, oldest first; if more remain, pagination_meta.after is set. Pass page_size or after to fetch a single page." }, { "name": "Show Follow-up", @@ -13956,15 +13956,15 @@ }, { "name": "List Escalations", - "description": "List all escalation policies in incident.io" + "description": "List escalations (pages sent to people) in incident.io. For escalation policies, use List Escalation Paths." }, { "name": "Create Escalation", - "description": "Create a new escalation policy in incident.io" + "description": "Page users or an escalation path (create an escalation) in incident.io. Provide either escalation_path_id or user_ids, not both. To create a reusable escalation policy, use Create Escalation Path instead." }, { "name": "Show Escalation", - "description": "Get details of a specific escalation policy in incident.io" + "description": "Get an escalation (a page sent to people) in incident.io. For an escalation policy, use Show Escalation Path." }, { "name": "List Custom Fields", @@ -14164,7 +14164,7 @@ "category": "tools", "integrationType": "observability", "tags": ["incident-management", "monitoring"], - "updatedAt": "2026-11-10" + "updatedAt": "2026-11-16" }, { "type": "infisical_v2", @@ -16265,7 +16265,7 @@ }, { "name": "Archive Label", - "description": "Archive a label in Linear" + "description": "Archive (retire) a label in Linear. A retired label can no longer be newly assigned but stays on issues that already use it." }, { "name": "List Workflow States", @@ -16289,7 +16289,7 @@ }, { "name": "Create Cycle", - "description": "Create a new cycle (sprint/iteration) in Linear" + "description": "Deprecated: Linear no longer supports creating cycles through its API (they are generated from the team cycle settings), so this always returns an error from Linear." }, { "name": "Get Active Cycle", @@ -16468,8 +16468,8 @@ "description": "Update a project status in Linear" }, { - "name": "Delete Project Status", - "description": "Delete a project status in Linear" + "name": "Archive Project Status", + "description": "Archive a project status in Linear (Linear does not support deleting one). The status must have no active projects and must not be the last status of its type." }, { "name": "List Project Statuses", @@ -16560,7 +16560,7 @@ "category": "tools", "integrationType": "productivity", "tags": ["project-management", "ticketing"], - "updatedAt": "2026-10-14" + "updatedAt": "2026-11-16" }, { "type": "linkedin", @@ -26334,7 +26334,7 @@ }, { "name": "Set Assistant Suggested Prompts", - "description": "Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app)." + "description": "Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app). For apps on the legacy assistant experience (assistant_view) only. Slack silently fails this call for agent apps (agent_view); use Set Agent Suggested Prompts instead." }, { "name": "Set Agent Suggested Prompts", @@ -26538,11 +26538,11 @@ }, { "name": "Unarchive Conversation", - "description": "Restore an archived Slack channel." + "description": "Restore an archived Slack channel. Slack does not currently let bot tokens unarchive conversations, so this fails with the Sim app or a custom bot until Slack lifts that limit." }, { "name": "Close Conversation", - "description": "Close a direct message or group direct message for the authenticated identity." + "description": "Close a direct message or group direct message for the authenticated identity. The Sim app can close 1:1 direct messages only; closing a group direct message needs a custom bot with the mpim:write scope." }, { "name": "Mark Conversation Read", @@ -26712,7 +26712,7 @@ }, "aiDisclaimer": "A paid Slack plan is required to use Sim's AI agent in Slack's app container. Other Sim features continue to work on free Slack plans. Sim agents use AI models to generate messages and responses sent to Slack. AI-generated content can be inaccurate or incomplete, so review automated outputs before relying on them, especially for important communications." }, - "updatedAt": "2026-09-24" + "updatedAt": "2026-11-16" }, { "type": "smartlead_v2", diff --git a/scripts/check-explicit-any.baseline.json b/scripts/check-explicit-any.baseline.json index 02ee28b9eea..156de5cc4b5 100644 --- a/scripts/check-explicit-any.baseline.json +++ b/scripts/check-explicit-any.baseline.json @@ -84,7 +84,6 @@ "apps/sim/blocks/blocks/evaluator.ts": 4, "apps/sim/blocks/blocks/firecrawl.ts": 1, "apps/sim/blocks/blocks/github.ts": 2, - "apps/sim/blocks/blocks/gitlab.ts": 2, "apps/sim/blocks/blocks/gmail.ts": 1, "apps/sim/blocks/blocks/google_appsheet.ts": 1, "apps/sim/blocks/blocks/google_calendar.ts": 1, @@ -511,12 +510,6 @@ "apps/sim/tools/github/update_pr.ts": 1, "apps/sim/tools/github/update_project.ts": 1, "apps/sim/tools/github/update_release.ts": 1, - "apps/sim/tools/gitlab/create_issue.ts": 1, - "apps/sim/tools/gitlab/create_merge_request.ts": 1, - "apps/sim/tools/gitlab/create_pipeline.ts": 1, - "apps/sim/tools/gitlab/merge_merge_request.ts": 1, - "apps/sim/tools/gitlab/update_issue.ts": 1, - "apps/sim/tools/gitlab/update_merge_request.ts": 1, "apps/sim/tools/gmail/add_label.ts": 1, "apps/sim/tools/gmail/archive.ts": 1, "apps/sim/tools/gmail/delete.ts": 1, @@ -569,17 +562,12 @@ "apps/sim/tools/hubspot/search_notes.ts": 1, "apps/sim/tools/hubspot/types.ts": 4, "apps/sim/tools/icypeas-hosting.test.ts": 15, - "apps/sim/tools/incidentio/actions_list.ts": 1, "apps/sim/tools/incidentio/custom_fields_list.ts": 1, "apps/sim/tools/incidentio/custom_fields_update.ts": 1, - "apps/sim/tools/incidentio/escalations_create.ts": 1, - "apps/sim/tools/incidentio/follow_ups_list.ts": 1, "apps/sim/tools/incidentio/incident_statuses_list.ts": 1, "apps/sim/tools/incidentio/incident_types_list.ts": 1, - "apps/sim/tools/incidentio/incidents_create.ts": 1, "apps/sim/tools/incidentio/incidents_list.ts": 1, "apps/sim/tools/incidentio/incidents_show.ts": 3, - "apps/sim/tools/incidentio/incidents_update.ts": 1, "apps/sim/tools/incidentio/schedules_update.ts": 1, "apps/sim/tools/incidentio/severities_list.ts": 1, "apps/sim/tools/incidentio/users_list.ts": 1, @@ -676,7 +664,7 @@ "apps/sim/tools/linear/create_workflow_state.ts": 1, "apps/sim/tools/linear/list_cycles.ts": 1, "apps/sim/tools/linear/list_labels.ts": 1, - "apps/sim/tools/linear/list_projects.ts": 3, + "apps/sim/tools/linear/list_projects.ts": 1, "apps/sim/tools/linear/list_workflow_states.ts": 1, "apps/sim/tools/linear/read_issues.ts": 3, "apps/sim/tools/linear/search_issues.ts": 2, From cea73ee5ca58ac4148124e6b049fdda4dc5f156d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 16:53:51 -0800 Subject: [PATCH 3/7] fix(incidentio): keep the creator mapper module-private --- apps/sim/tools/incidentio/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sim/tools/incidentio/utils.ts b/apps/sim/tools/incidentio/utils.ts index 1b32bf3c5c1..4701ea16828 100644 --- a/apps/sim/tools/incidentio/utils.ts +++ b/apps/sim/tools/incidentio/utils.ts @@ -71,7 +71,7 @@ export function parseRequiredIncidentioJsonParam(value: unknown, paramName: stri * list/show tools have always declared: `id`/`name`/`email` come from whichever actor is set, and * the raw actor keys are passed through alongside them. */ -export function mapIncidentioCreator(value: unknown): IncidentioLegacyCreator | undefined { +function mapIncidentioCreator(value: unknown): IncidentioLegacyCreator | undefined { const creator = asRecord(value) if (!creator) return undefined const user = asRecord(creator.user) From aaa53960a191a493ea0094d6c2420162b54f6fd9 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 17:00:49 -0800 Subject: [PATCH 4/7] refactor: simplify and clean up the sweep changes --- apps/sim/blocks/blocks/datadog.ts | 26 ++++--------- apps/sim/blocks/blocks/gitlab.ts | 60 ++++++++++-------------------- apps/sim/blocks/blocks/linear.ts | 5 +-- apps/sim/tools/incidentio/utils.ts | 36 ++++++++---------- 4 files changed, 44 insertions(+), 83 deletions(-) diff --git a/apps/sim/blocks/blocks/datadog.ts b/apps/sim/blocks/blocks/datadog.ts index ed9de2ae8ef..29b78e12fa6 100644 --- a/apps/sim/blocks/blocks/datadog.ts +++ b/apps/sim/blocks/blocks/datadog.ts @@ -1,5 +1,5 @@ import { DatadogIcon } from '@/components/icons' -import type { BlockConfig, BlockMeta, BlockToolParamsContext } from '@/blocks/types' +import type { BlockConfig, BlockMeta } from '@/blocks/types' import { AuthMode, IntegrationType } from '@/blocks/types' import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils' import { DATADOG_SITE_LABELS, DATADOG_SITES } from '@/tools/datadog/types' @@ -33,21 +33,6 @@ function datadogNumber(value: unknown): number | undefined { return Number.isFinite(parsed) ? parsed : undefined } -/** - * A block field stored under its own id, or, on a tool call where that field is blank, the - * model's argument under the tool's param name. Model args are keyed by the tool's params, so - * a block field renamed onto one would otherwise overwrite the model's value. On the canvas - * (no context) the field is returned unchanged, so a saved workflow's request is the same. - */ -function fieldOrToolArg( - context: BlockToolParamsContext | undefined, - blockValue: unknown, - toolArg: unknown -): unknown { - if (blockValue != null && blockValue !== '') return blockValue - return toolCallArg(context, toolArg) ?? blockValue -} - export const DatadogBlock: BlockConfig = { type: 'datadog', hideFromToolbar: true, @@ -1982,9 +1967,14 @@ Return ONLY the search query string - no explanations.`, applicationKey: params.applicationKey, site: params.site, } - /** The block field, or on a tool call the model's arg under the tool's param name. */ + /** + * A block field, or on a tool call where it is blank, the model's arg under the tool's + * param name. On the canvas the field is returned unchanged. + */ const field = (blockValue: unknown, toolParam: string) => - fieldOrToolArg(context, blockValue, params[toolParam]) + blockValue != null && blockValue !== '' + ? blockValue + : (toolCallArg(context, params[toolParam]) ?? blockValue) /** Like {@link field} for numeric fields, coercing both values. */ const numberField = (blockValue: unknown, toolParam: string) => datadogNumber(blockValue) ?? toolCallArg(context, datadogNumber(params[toolParam])) diff --git a/apps/sim/blocks/blocks/gitlab.ts b/apps/sim/blocks/blocks/gitlab.ts index 4cf652e5093..2e87ff0b8d7 100644 --- a/apps/sim/blocks/blocks/gitlab.ts +++ b/apps/sim/blocks/blocks/gitlab.ts @@ -2336,6 +2336,9 @@ Return ONLY the JSON array - no explanations, no extra text.`, page: params.page ? Number(params.page) : undefined, } const sort = params.sortOrder || toolCallArg(context, params.sort) || undefined + /** A block text field, or on a tool call the model's arg under the tool's param name. */ + const textOrToolArg = (blockValue: unknown, toolValue: unknown) => + inputText(blockValue) || inputText(toolCallArg(context, toolValue)) switch (operation) { case 'gitlab_list_projects': @@ -2508,11 +2511,9 @@ Return ONLY the JSON array - no explanations, no extra text.`, toolCallArg(context, params.state), labels: optionalText(params.labels), sourceBranch: - optionalText(params.sourceBranchFilter) || - optionalText(toolCallArg(context, params.sourceBranch)), + textOrToolArg(params.sourceBranchFilter, params.sourceBranch) || undefined, targetBranch: - optionalText(params.targetBranchFilter) || - optionalText(toolCallArg(context, params.targetBranch)), + textOrToolArg(params.targetBranchFilter, params.targetBranch) || undefined, orderBy: params.mrOrderBy || toolCallArg(context, params.orderBy) || undefined, sort, ...pagination, @@ -2592,7 +2593,7 @@ Return ONLY the JSON array - no explanations, no extra text.`, shouldRemoveSourceBranch: params.removeSourceBranch || toolCallArg(context, params.shouldRemoveSourceBranch), mergeWhenPipelineSucceeds: switchInput(params.mergeWhenPipelineSucceeds, context), - sha: optionalText(params.mergeSha) || optionalText(toolCallArg(context, params.sha)), + sha: textOrToolArg(params.mergeSha, params.sha) || undefined, } case 'gitlab_create_merge_request_note': { @@ -2754,9 +2755,8 @@ Return ONLY the JSON array - no explanations, no extra text.`, } case 'gitlab_compare_branches': { - const from = - inputText(params.compareFrom) || inputText(toolCallArg(context, params.from)) - const to = inputText(params.compareTo) || inputText(toolCallArg(context, params.to)) + const from = textOrToolArg(params.compareFrom, params.from) + const to = textOrToolArg(params.compareTo, params.to) if (!projectId || !from || !to) { throw new Error('Project ID, from ref, and to ref are required.') } @@ -2862,8 +2862,7 @@ Return ONLY the JSON array - no explanations, no extra text.`, ...baseParams, projectId, tagName, - name: - optionalText(params.releaseName) || optionalText(toolCallArg(context, params.name)), + name: textOrToolArg(params.releaseName, params.name) || undefined, description: optionalText(params.description), ref: optionalText(params.ref), releasedAt: optionalText(params.releasedAt), @@ -2886,9 +2885,7 @@ Return ONLY the JSON array - no explanations, no extra text.`, directOnly: params.directMembersOnly || toolCallArg(context, params.directOnly) || undefined, query: optionalText(params.query), - userIds: - optionalText(params.memberUserIds) || - optionalText(toolCallArg(context, params.userIds)), + userIds: textOrToolArg(params.memberUserIds, params.userIds) || undefined, state: params.memberState || toolCallArg(context, params.state) || undefined, showSeatInfo: params.showSeatInfo || undefined, ...pagination, @@ -3081,9 +3078,7 @@ Return ONLY the JSON array - no explanations, no extra text.`, samlGroupName, accessLevel: coerceGitLabAccessLevel(params.accessLevel), memberRoleId: params.memberRoleId ? Number(params.memberRoleId) : undefined, - provider: - optionalText(params.samlProvider) || - optionalText(toolCallArg(context, params.provider)), + provider: textOrToolArg(params.samlProvider, params.provider) || undefined, } } @@ -3096,15 +3091,12 @@ Return ONLY the JSON array - no explanations, no extra text.`, ...baseParams, groupId, samlGroupName, - provider: - optionalText(params.samlProvider) || - optionalText(toolCallArg(context, params.provider)), + provider: textOrToolArg(params.samlProvider, params.provider) || undefined, } } case 'gitlab_search_users': { - const search = - inputText(params.userSearch) || inputText(toolCallArg(context, params.search)) + const search = textOrToolArg(params.userSearch, params.search) if (!search) { throw new Error('Search query is required.') } @@ -3116,16 +3108,10 @@ Return ONLY the JSON array - no explanations, no extra text.`, } case 'gitlab_create_user': { - const email = - inputText(params.userAdminEmail) || inputText(toolCallArg(context, params.email)) - const username = - inputText(params.userAdminUsername) || - inputText(toolCallArg(context, params.username)) - const name = - inputText(params.userAdminName) || inputText(toolCallArg(context, params.name)) - const password = - inputText(params.userAdminPassword) || - inputText(toolCallArg(context, params.password)) + const email = textOrToolArg(params.userAdminEmail, params.email) + const username = textOrToolArg(params.userAdminUsername, params.username) + const name = textOrToolArg(params.userAdminName, params.name) + const password = textOrToolArg(params.userAdminPassword, params.password) if (!email || !username || !name) { throw new Error('Email, Username, and Full Name are required.') } @@ -3154,15 +3140,9 @@ Return ONLY the JSON array - no explanations, no extra text.`, return { ...baseParams, userId: Number(params.userId), - email: - optionalText(params.userAdminEmail) || - optionalText(toolCallArg(context, params.email)), - username: - optionalText(params.userAdminUsername) || - optionalText(toolCallArg(context, params.username)), - name: - optionalText(params.userAdminName) || - optionalText(toolCallArg(context, params.name)), + email: textOrToolArg(params.userAdminEmail, params.email) || undefined, + username: textOrToolArg(params.userAdminUsername, params.username) || undefined, + name: textOrToolArg(params.userAdminName, params.name) || undefined, // Only pass a real boolean: an explicit `false` demotes the user, // while an untouched switch serializes as `null` and must be // dropped so an unrelated update never touches the admin flag. diff --git a/apps/sim/blocks/blocks/linear.ts b/apps/sim/blocks/blocks/linear.ts index 13bbc3cfa0f..731b5380c2a 100644 --- a/apps/sim/blocks/blocks/linear.ts +++ b/apps/sim/blocks/blocks/linear.ts @@ -2321,10 +2321,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n } // On a tool call with no Mark as Read setting, the model's readAt decides. if (isToolCall(context) && isBlank(params.markAsRead)) { - return { - ...baseParams, - notificationId: params.notificationId.trim(), - } + return { ...baseParams, notificationId: params.notificationId.trim() } } return { ...baseParams, diff --git a/apps/sim/tools/incidentio/utils.ts b/apps/sim/tools/incidentio/utils.ts index 4701ea16828..8553fc7158e 100644 --- a/apps/sim/tools/incidentio/utils.ts +++ b/apps/sim/tools/incidentio/utils.ts @@ -1,5 +1,5 @@ import { getErrorMessage } from '@sim/utils/errors' -import { toArray } from '@sim/utils/object' +import { toArray, toRecord, toRecordOrNull } from '@sim/utils/object' import type { IncidentioActionSummary, IncidentioFollowUpSummary, @@ -8,12 +8,6 @@ import type { } from '@/tools/incidentio/types' import type { ToolResponse } from '@/tools/types' -function asRecord(value: unknown): Record | undefined { - return value && typeof value === 'object' && !Array.isArray(value) - ? (value as Record) - : undefined -} - function toStringValue(value: unknown): string { return typeof value === 'string' ? value : String(value ?? '') } @@ -72,12 +66,12 @@ export function parseRequiredIncidentioJsonParam(value: unknown, paramName: stri * the raw actor keys are passed through alongside them. */ function mapIncidentioCreator(value: unknown): IncidentioLegacyCreator | undefined { - const creator = asRecord(value) + const creator = toRecordOrNull(value) if (!creator) return undefined - const user = asRecord(creator.user) - const apiKey = asRecord(creator.api_key) - const workflow = asRecord(creator.workflow) - const alert = asRecord(creator.alert) + const user = toRecordOrNull(creator.user) + const apiKey = toRecordOrNull(creator.api_key) + const workflow = toRecordOrNull(creator.workflow) + const alert = toRecordOrNull(creator.alert) const source = user ?? apiKey ?? workflow ?? alert return { id: toOptionalStringValue(source?.id), @@ -91,7 +85,7 @@ function mapIncidentioCreator(value: unknown): IncidentioLegacyCreator | undefin } function mapAssignee(value: unknown): IncidentioActionSummary['assignee'] { - const assignee = asRecord(value) + const assignee = toRecordOrNull(value) if (!assignee) return undefined return { id: toStringValue(assignee.id), @@ -103,7 +97,7 @@ function mapAssignee(value: unknown): IncidentioActionSummary['assignee'] { function mapExternalIssueReference( value: unknown ): IncidentioFollowUpSummary['external_issue_reference'] { - const reference = asRecord(value) + const reference = toRecordOrNull(value) if (!reference) return undefined return { provider: toStringValue(reference.provider), @@ -114,7 +108,7 @@ function mapExternalIssueReference( /** Maps an action as returned by `GET /v3/actions[/{id}]` onto the list/show output shape. */ export function mapIncidentioActionSummary(value: unknown): IncidentioActionSummary { - const action = asRecord(value) ?? {} + const action = toRecord(value) return { id: toStringValue(action.id), description: toOptionalStringValue(action.description) ?? '', @@ -130,10 +124,10 @@ export function mapIncidentioActionSummary(value: unknown): IncidentioActionSumm /** Maps a follow-up as returned by `GET /v3/follow_ups[/{id}]` onto the list/show output shape. */ export function mapIncidentioFollowUpSummary(value: unknown): IncidentioFollowUpSummary { - const followUp = asRecord(value) ?? {} - const priority = asRecord(followUp.priority) - const assigneeTeam = asRecord(followUp.assignee_team) - const category = asRecord(followUp.category) + const followUp = toRecord(value) + const priority = toRecordOrNull(followUp.priority) + const assigneeTeam = toRecordOrNull(followUp.assignee_team) + const category = toRecordOrNull(followUp.category) return { id: toStringValue(followUp.id), title: toOptionalStringValue(followUp.title) ?? '', @@ -171,7 +165,7 @@ export function mapIncidentioFollowUpSummary(value: unknown): IncidentioFollowUp /** The API returns the trigger as `{ name, label }`; the output keeps the name string. */ function mapWorkflowTrigger(value: unknown): string { - const trigger = asRecord(value) + const trigger = toRecordOrNull(value) return trigger ? toStringValue(trigger.name) : toStringValue(value) } @@ -221,7 +215,7 @@ export async function collectIncidentioPages( const page = await fetchPage(after) if (!page.success) return { error: page.error || 'Failed to fetch the next page' } items.push(...toArray(page.output[itemsKey])) - after = toOptionalStringValue(asRecord(page.output.pagination_meta)?.after) + after = toOptionalStringValue(toRecord(page.output.pagination_meta).after) } return { items, after } } From 8daaa7187f06814b8c039a69b276084085c42dcf Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 17:17:54 -0800 Subject: [PATCH 5/7] fix(integrations): address v1 review findings and CI failures - keep the Linear project-status tool's display name so its docs anchor survives - pass Slack's comma-separated ID lists through the workflow-block mapper - reject '..' segments in GitHub content paths; only exact dot-segment GitLab ids - reject non-array commits in Sentry release create - mark nullable outputs (Linear dueDate/status, GitHub latest commit v2) - align descriptions with the vendor contracts (incident.io, Slack, GitHub, Linear) - drop a dead credential fallback the canonical-param check flags; fix test types --- .../docs/content/docs/integrations/github.mdx | 26 +++---------------- .../content/docs/integrations/incidentio.mdx | 2 +- .../docs/content/docs/integrations/linear.mdx | 4 +-- apps/docs/content/docs/integrations/slack.mdx | 4 +-- apps/sim/blocks/blocks/gitlab.test.ts | 12 ++++++--- .../blocks/slack-workflow-operations.test.ts | 15 ++++++++++- .../blocks/slack-workflow-operations.ts | 25 ++++++++++++++++-- apps/sim/blocks/blocks/slack.ts | 2 +- .../sim/lib/internal/slack/operations.test.ts | 9 ++++++- apps/sim/tools/github/compare_commits.ts | 2 +- apps/sim/tools/github/content-path.ts | 15 +++++++++-- apps/sim/tools/github/latest_commit.ts | 23 +++++++++++++--- .../tools/github/request-coercions.test.ts | 6 +++++ apps/sim/tools/github/types.ts | 2 +- apps/sim/tools/gitlab/utils.ts | 4 +-- .../tools/incidentio/escalations_create.ts | 3 ++- apps/sim/tools/incidentio/incidents_create.ts | 2 +- .../tools/linear/create_customer_request.ts | 2 +- .../sim/tools/linear/delete_project_status.ts | 2 +- apps/sim/tools/linear/types.ts | 3 ++- apps/sim/tools/sentry/releases_create.ts | 4 ++- apps/sim/tools/sentry/requests.test.ts | 4 +++ apps/sim/tools/slack/revoke_canvas_access.ts | 4 +-- .../tools/slack/workflow-operations.test.ts | 11 +++++--- .../deployment-config/src/integrations.json | 4 +-- 25 files changed, 130 insertions(+), 60 deletions(-) diff --git a/apps/docs/content/docs/integrations/github.mdx b/apps/docs/content/docs/integrations/github.mdx index 003ceded586..d2d321a2df2 100644 --- a/apps/docs/content/docs/integrations/github.mdx +++ b/apps/docs/content/docs/integrations/github.mdx @@ -210,26 +210,8 @@ Retrieve the latest commit from a GitHub repository | Parameter | Type | Description | | --------- | ---- | ----------- | -| `commit` | object | Core commit data | -| ↳ `url` | string | Commit API URL | -| ↳ `message` | string | Commit message | -| ↳ `comment_count` | number | Number of comments | -| ↳ `author` | object | Git actor \(author/committer\) | -| ↳ `name` | string | Name | -| ↳ `email` | string | Email address | -| ↳ `date` | string | Timestamp \(ISO 8601\) | -| ↳ `committer` | object | Git actor \(author/committer\) | -| ↳ `name` | string | Name | -| ↳ `email` | string | Email address | -| ↳ `date` | string | Timestamp \(ISO 8601\) | -| ↳ `tree` | object | Tree object | -| ↳ `sha` | string | Tree SHA | -| ↳ `url` | string | Tree API URL | -| ↳ `verification` | object | Signature verification | -| ↳ `verified` | boolean | Whether signature is verified | -| ↳ `reason` | string | Verification reason | -| ↳ `signature` | string | GPG signature | -| ↳ `payload` | string | Signed payload | +| `sha` | string | Commit SHA | +| `html_url` | string | GitHub web URL | | `author` | object | GitHub user object | | ↳ `login` | string | GitHub username | | ↳ `id` | number | User ID | @@ -248,8 +230,6 @@ Retrieve the latest commit from a GitHub repository | ↳ `html_url` | string | Profile page URL | | ↳ `type` | string | User or Organization | | ↳ `site_admin` | boolean | GitHub staff indicator | -| `sha` | string | Commit SHA | -| `html_url` | string | GitHub web URL | @@ -2726,7 +2706,7 @@ Compare two commits or branches to see the diff, commits between them, and chang | `base` | string | Yes | Base branch/tag/SHA for comparison | | `head` | string | Yes | Head branch/tag/SHA for comparison | | `per_page` | number | No | Commits per page \(max 100\). Setting per_page or page paginates the commit list, and changed files are returned only on page 1. Leave both unset to get up to 250 commits and every changed file in one response. | -| `page` | number | No | Page of the commit list. Changed files are returned only on page 1. Leave unset \(with per_page\) for a single unpaginated comparison. | +| `page` | number | No | Page of the commit list. Changed files are returned only on page 1. Omit both page and per_page to get up to 250 commits in one response. | #### Output diff --git a/apps/docs/content/docs/integrations/incidentio.mdx b/apps/docs/content/docs/integrations/incidentio.mdx index b768a6418cb..c106412033d 100644 --- a/apps/docs/content/docs/integrations/incidentio.mdx +++ b/apps/docs/content/docs/integrations/incidentio.mdx @@ -74,7 +74,7 @@ List incidents from incident.io. Returns a list of incidents with their details ### incident.io Incidents Create -Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status. +Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts name, summary, severity_id, incident_type_id, and incident_status_id. diff --git a/apps/docs/content/docs/integrations/linear.mdx b/apps/docs/content/docs/integrations/linear.mdx index 739914cb558..6a538b56b57 100644 --- a/apps/docs/content/docs/integrations/linear.mdx +++ b/apps/docs/content/docs/integrations/linear.mdx @@ -1636,7 +1636,7 @@ List all customers in Linear ### Linear Create Customer Request -Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and optionally link to an issue. +Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and link it to an issue (required for API calls). @@ -2453,7 +2453,7 @@ Update a project status in Linear -### Linear Archive Project Status +### Linear Delete Project Status Archive a project status in Linear (Linear does not support deleting one). The status must have no active projects and must not be the last status of its type. diff --git a/apps/docs/content/docs/integrations/slack.mdx b/apps/docs/content/docs/integrations/slack.mdx index d1dc16f95c5..a7260e75879 100644 --- a/apps/docs/content/docs/integrations/slack.mdx +++ b/apps/docs/content/docs/integrations/slack.mdx @@ -2606,8 +2606,8 @@ Remove user or regular-channel access to a standalone canvas. Channel-granted ac | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `canvas_id` | string | Yes | Canvas ID | -| `user_ids` | json | No | One Slack user ID to remove, as \["U123"\] or U123. Omit channel_ids. | -| `channel_ids` | json | No | One Slack channel ID to remove, as \["C123"\] or C123. Omit user_ids. | +| `user_ids` | json | No | One Slack user ID to remove, as \["U123"\] or U123. | +| `channel_ids` | json | No | One Slack channel ID to remove, as \["C123"\] or C123. | #### Output diff --git a/apps/sim/blocks/blocks/gitlab.test.ts b/apps/sim/blocks/blocks/gitlab.test.ts index fdd3abafd8a..ec08815ce2a 100644 --- a/apps/sim/blocks/blocks/gitlab.test.ts +++ b/apps/sim/blocks/blocks/gitlab.test.ts @@ -95,9 +95,13 @@ describe('GitLabBlock access operations', () => { }) }) +const blockParams = block.tools.config?.params +if (!blockParams) throw new Error('GitLab block has no params mapper') +const mapParams = blockParams + /** Runs the mapper the way a tool call does: model/stored args with no operation, which arrives in context. */ function mapToolCall(operation: string, args: Record) { - return block.tools.config.params?.({ accessToken: 'pat', ...args }, { operation }) + return mapParams({ accessToken: 'pat', ...args }, { operation }) } describe('GitLabBlock mapper on tool calls', () => { @@ -171,7 +175,7 @@ describe('GitLabBlock mapper on tool calls', () => { }) it('does not apply tool-named fallbacks on the canvas', () => { - const canvas = block.tools.config.params?.({ + const canvas = mapParams({ accessToken: 'pat', operation: 'gitlab_list_merge_requests', projectId: '1', @@ -182,7 +186,7 @@ describe('GitLabBlock mapper on tool calls', () => { it('keeps create-only advanced values saved under another operation off update and merge requests', () => { const canvas = (operation: string, extra: Record) => - block.tools.config.params?.({ + mapParams({ accessToken: 'pat', operation, projectId: '1', @@ -294,7 +298,7 @@ describe('GitLabBlock mapper on tool calls', () => { }) it('leaves a blank canvas field unsent on update operations', () => { - const result = block.tools.config.params?.({ + const result = mapParams({ accessToken: 'pat', operation: 'gitlab_update_issue', projectId: '1', diff --git a/apps/sim/blocks/blocks/slack-workflow-operations.test.ts b/apps/sim/blocks/blocks/slack-workflow-operations.test.ts index 3597b4d26db..6f655f9b313 100644 --- a/apps/sim/blocks/blocks/slack-workflow-operations.test.ts +++ b/apps/sim/blocks/blocks/slack-workflow-operations.test.ts @@ -58,9 +58,22 @@ describe('Slack workflow operations in the existing block', () => { ).toEqual({ credential: 'bot', channel_id: 'C1', bookmark_id: 'Bk1', emoji: '' }) expect(() => mapParams({ operation: 'list_files', slack_list_files_count: 'many' })).toThrow() expect(() => - mapParams({ operation: 'share_canvas', slack_share_canvas_user_ids: 'invalid JSON' }) + mapParams({ + operation: 'revoke_list_access', + slack_revoke_list_access_user_ids: 'invalid JSON', + }) ).toThrow() }) + + it("passes a Slack ID list's comma-separated form through for the tool to parse", () => { + expect( + mapParams({ + operation: 'get_team_dnd_info', + apiBotCredentialId: 'bot', + slack_get_team_dnd_info_users: 'U1,U2', + }) + ).toEqual({ credential: 'bot', users: 'U1,U2' }) + }) }) describe('Slack custom-app permissions', () => { diff --git a/apps/sim/blocks/blocks/slack-workflow-operations.ts b/apps/sim/blocks/blocks/slack-workflow-operations.ts index 0589d397ae7..7fe319b01db 100644 --- a/apps/sim/blocks/blocks/slack-workflow-operations.ts +++ b/apps/sim/blocks/blocks/slack-workflow-operations.ts @@ -18,6 +18,8 @@ interface SlackWorkflowField { dependsOn?: string[] default?: string allowEmpty?: boolean + /** A Slack ID list: Slack's comma-separated form (`U1,U2`) is passed through for the tool to parse. */ + idList?: boolean basic?: boolean min?: number max?: number @@ -215,6 +217,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'user_ids', title: 'User IDs', type: 'json', + idList: true, required: false, }, { @@ -223,6 +226,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'channel_ids', title: 'Channel IDs', type: 'json', + idList: true, required: false, }, ], @@ -246,6 +250,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'user_ids', title: 'User IDs', type: 'json', + idList: true, required: false, }, { @@ -254,6 +259,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'channel_ids', title: 'Channel IDs', type: 'json', + idList: true, required: false, }, ], @@ -374,6 +380,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'users', title: 'User IDs', type: 'json', + idList: true, required: false, }, { @@ -946,6 +953,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'channels', title: 'Default Channel IDs', type: 'json', + idList: true, required: false, }, { @@ -953,6 +961,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'additional_channels', title: 'Additional Channel IDs', type: 'json', + idList: true, required: false, }, { @@ -1022,6 +1031,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'channels', title: 'Default Channel IDs', type: 'json', + idList: true, required: false, }, { @@ -1029,6 +1039,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'additional_channels', title: 'Additional Channel IDs', type: 'json', + idList: true, required: false, }, { @@ -1195,6 +1206,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'users', title: 'User IDs', type: 'json', + idList: true, required: true, }, { @@ -1202,6 +1214,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'additional_channels', title: 'Additional Channel IDs', type: 'json', + idList: true, required: false, }, { @@ -1260,6 +1273,7 @@ export const SLACK_WORKFLOW_OPERATIONS: readonly SlackWorkflowOperation[] = [ param: 'users', title: 'User IDs', type: 'json', + idList: true, required: true, }, { @@ -1442,8 +1456,15 @@ export function mapSlackWorkflowParams( if (isEmpty && toolCallArg(context, params[field.param]) !== undefined) continue const value = isEmpty ? field.default : raw if (value === undefined) continue - if (field.type === 'json') result[field.param] = parseOptionalJsonInput(value, field.title) - else if (field.type === 'number') + if (field.type === 'json') { + const csvIdList = + field.idList === true && + typeof value === 'string' && + value.trim() !== '' && + !/^\s*[[{"]/.test(value) + if (csvIdList) result[field.param] = value + else result[field.param] = parseOptionalJsonInput(value, field.title) + } else if (field.type === 'number') result[field.param] = parseOptionalNumberInput(value, field.title, { integer: true, min: field.min, diff --git a/apps/sim/blocks/blocks/slack.ts b/apps/sim/blocks/blocks/slack.ts index 47b9c743928..5ff889943bf 100644 --- a/apps/sim/blocks/blocks/slack.ts +++ b/apps/sim/blocks/blocks/slack.ts @@ -1993,7 +1993,7 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te baseParams.accessToken = botToken } } else { - baseParams.credential = oauthCredential ?? toolCallArg(context, params.credential) + baseParams.credential = oauthCredential } switch (operation) { diff --git a/apps/sim/lib/internal/slack/operations.test.ts b/apps/sim/lib/internal/slack/operations.test.ts index cf92cc9f035..fcb64190b3c 100644 --- a/apps/sim/lib/internal/slack/operations.test.ts +++ b/apps/sim/lib/internal/slack/operations.test.ts @@ -102,7 +102,14 @@ describe('Slack operations', () => { ) const result = await executeSlackGetChannelHistoryOperation( - { accessToken: 'token', channel: 'C1', limit: 999, maxPages: 10000 }, + { + authMethod: 'oauth', + accessToken: 'token', + botToken: '', + channel: 'C1', + limit: 999, + maxPages: 10000, + }, new AbortController().signal ) diff --git a/apps/sim/tools/github/compare_commits.ts b/apps/sim/tools/github/compare_commits.ts index 82644e508fc..3dc47e425ee 100644 --- a/apps/sim/tools/github/compare_commits.ts +++ b/apps/sim/tools/github/compare_commits.ts @@ -92,7 +92,7 @@ export const compareCommitsTool: ToolConfig segment !== '.') + .map(encodeURIComponent) + .join('/') } diff --git a/apps/sim/tools/github/latest_commit.ts b/apps/sim/tools/github/latest_commit.ts index 3fac0c6c192..e4d251d66a3 100644 --- a/apps/sim/tools/github/latest_commit.ts +++ b/apps/sim/tools/github/latest_commit.ts @@ -1,11 +1,26 @@ import { COMMIT_DATA_OUTPUT, + COMMIT_DATA_OUTPUT_PROPERTIES, type LatestCommitParams, type LatestCommitResponse, USER_FULL_OUTPUT, } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' -import type { InternalToolConfig } from '@/tools/types' +import type { InternalToolConfig, OutputProperty } from '@/tools/types' + +/** The V2 commit object, whose fields are `null` when the latest-commit lookup did not return them. */ +const LATEST_COMMIT_V2_COMMIT_OUTPUT = { + ...COMMIT_DATA_OUTPUT, + properties: { + ...COMMIT_DATA_OUTPUT_PROPERTIES, + url: { ...COMMIT_DATA_OUTPUT_PROPERTIES.url, nullable: true }, + comment_count: { ...COMMIT_DATA_OUTPUT_PROPERTIES.comment_count, nullable: true }, + author: { ...COMMIT_DATA_OUTPUT_PROPERTIES.author, nullable: true }, + committer: { ...COMMIT_DATA_OUTPUT_PROPERTIES.committer, nullable: true }, + tree: { ...COMMIT_DATA_OUTPUT_PROPERTIES.tree, nullable: true }, + verification: { ...COMMIT_DATA_OUTPUT_PROPERTIES.verification, nullable: true }, + }, +} satisfies OutputProperty export const latestCommitTool: InternalToolConfig = { id: 'github_latest_commit', @@ -95,8 +110,8 @@ export const latestCommitV2Tool: InternalToolConfig = { outputs: { sha: { type: 'string', description: 'Commit SHA' }, html_url: { type: 'string', description: 'GitHub web URL' }, - commit: COMMIT_DATA_OUTPUT, - author: USER_FULL_OUTPUT, - committer: USER_FULL_OUTPUT, + commit: LATEST_COMMIT_V2_COMMIT_OUTPUT, + author: { ...USER_FULL_OUTPUT, nullable: true }, + committer: { ...USER_FULL_OUTPUT, nullable: true }, }, } diff --git a/apps/sim/tools/github/request-coercions.test.ts b/apps/sim/tools/github/request-coercions.test.ts index 59621b209c2..dd2c0398ace 100644 --- a/apps/sim/tools/github/request-coercions.test.ts +++ b/apps/sim/tools/github/request-coercions.test.ts @@ -109,6 +109,12 @@ describe('github_get_file_content URL', () => { expect(built.pathname).toBe('/repos/o/r/contents/docs/a%23b.md') expect(built.searchParams.get('ref')).toBe('feat+x') }) + + it('rejects a path that would climb out of the contents endpoint', () => { + expect(() => + url(getFileContentTool, { owner: 'o', repo: 'r', path: 'docs/../../pulls' }) + ).toThrow('..') + }) }) describe('github_list_issue_comments', () => { diff --git a/apps/sim/tools/github/types.ts b/apps/sim/tools/github/types.ts index 007697d7ce2..de7b6e614ba 100644 --- a/apps/sim/tools/github/types.ts +++ b/apps/sim/tools/github/types.ts @@ -1798,7 +1798,7 @@ export interface GetIssueParams extends BaseGitHubParams { export interface CloseIssueParams extends BaseGitHubParams { issue_number: number - state_reason?: 'completed' | 'not_planned' + state_reason?: 'completed' | 'not_planned' | 'duplicate' } export interface AddLabelsParams extends BaseGitHubParams { diff --git a/apps/sim/tools/gitlab/utils.ts b/apps/sim/tools/gitlab/utils.ts index e72dfaf42c7..1d8b19d5a25 100644 --- a/apps/sim/tools/gitlab/utils.ts +++ b/apps/sim/tools/gitlab/utils.ts @@ -195,8 +195,8 @@ export function encodeGitLabResourceId(resourceId: string | number): string { } catch { // Not a valid percent-encoding (e.g. a bare `%`) - treat as already raw. } - if (decoded.trim() === '.' || decoded.trim() === '..') { - throw new Error(`GitLab project or group ID cannot be "${decoded.trim()}"`) + if (decoded === '.' || decoded === '..') { + throw new Error(`GitLab project or group ID cannot be "${decoded}"`) } return encodeURIComponent(decoded) } diff --git a/apps/sim/tools/incidentio/escalations_create.ts b/apps/sim/tools/incidentio/escalations_create.ts index 894466d7150..d70aa5557a9 100644 --- a/apps/sim/tools/incidentio/escalations_create.ts +++ b/apps/sim/tools/incidentio/escalations_create.ts @@ -86,7 +86,8 @@ export const escalationsCreateTool: ToolConfig< body.user_ids = parseIncidentioList(params.user_ids) } - if (params.incident_id) body.incident_id = params.incident_id.trim() + const incidentId = params.incident_id?.trim() + if (incidentId) body.incident_id = incidentId if (params.description) body.description = params.description return body diff --git a/apps/sim/tools/incidentio/incidents_create.ts b/apps/sim/tools/incidentio/incidents_create.ts index 0d41bebc26e..d9232c8a244 100644 --- a/apps/sim/tools/incidentio/incidents_create.ts +++ b/apps/sim/tools/incidentio/incidents_create.ts @@ -12,7 +12,7 @@ export const incidentsCreateTool: ToolConfig< id: 'incidentio_incidents_create', name: 'incident.io Incidents Create', description: - 'Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status.', + 'Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts name, summary, severity_id, incident_type_id, and incident_status_id.', version: '1.0.0', oauth: INCIDENTIO_CREDENTIAL_OAUTH, diff --git a/apps/sim/tools/linear/create_customer_request.ts b/apps/sim/tools/linear/create_customer_request.ts index fd4c7a8f924..28027a36aca 100644 --- a/apps/sim/tools/linear/create_customer_request.ts +++ b/apps/sim/tools/linear/create_customer_request.ts @@ -12,7 +12,7 @@ export const linearCreateCustomerRequestTool: ToolConfig< id: 'linear_create_customer_request', name: 'Linear Create Customer Request', description: - 'Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and optionally link to an issue.', + 'Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and link it to an issue (required for API calls).', version: '1.0.0', oauth: { diff --git a/apps/sim/tools/linear/delete_project_status.ts b/apps/sim/tools/linear/delete_project_status.ts index 6e6c29ec3e4..34a60b3c955 100644 --- a/apps/sim/tools/linear/delete_project_status.ts +++ b/apps/sim/tools/linear/delete_project_status.ts @@ -10,7 +10,7 @@ export const linearDeleteProjectStatusTool: ToolConfig< LinearDeleteProjectStatusResponse > = { id: 'linear_delete_project_status', - name: 'Linear Archive Project Status', + name: 'Linear Delete Project Status', description: 'Archive a project status in Linear (Linear does not support deleting one). The status must have no active projects and must not be the last status of its type.', version: '1.0.0', diff --git a/apps/sim/tools/linear/types.ts b/apps/sim/tools/linear/types.ts index 952fa60032d..c2bf3fc8d8c 100644 --- a/apps/sim/tools/linear/types.ts +++ b/apps/sim/tools/linear/types.ts @@ -185,6 +185,7 @@ export const PROJECT_FULL_OUTPUT_PROPERTIES = { type: 'object', description: 'Current project status', optional: true, + nullable: true, properties: { id: { type: 'string', description: 'Project status ID' }, name: { type: 'string', description: 'Project status name' }, @@ -249,7 +250,7 @@ export const ISSUE_OUTPUT_PROPERTIES = { }, estimate: { type: 'number', description: 'Estimate in points' }, url: { type: 'string', description: 'Issue URL' }, - dueDate: { type: 'string', description: 'Due date (YYYY-MM-DD)' }, + dueDate: { type: 'string', description: 'Due date (YYYY-MM-DD)', nullable: true }, createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' }, updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' }, completedAt: { type: 'string', description: 'Completion timestamp (ISO 8601)' }, diff --git a/apps/sim/tools/sentry/releases_create.ts b/apps/sim/tools/sentry/releases_create.ts index 0dd4d46be8a..905621bd6e8 100644 --- a/apps/sim/tools/sentry/releases_create.ts +++ b/apps/sim/tools/sentry/releases_create.ts @@ -13,7 +13,9 @@ const COMMITS_FORMAT_ERROR = */ function parseCommits(value: SentryCreateReleaseParams['commits']): unknown[] | undefined { if (Array.isArray(value)) return value - if (typeof value !== 'string' || value.trim() === '') return undefined + if (value === undefined || value === null) return undefined + if (typeof value !== 'string') throw new Error(COMMITS_FORMAT_ERROR) + if (value.trim() === '') return undefined let parsed: unknown try { parsed = JSON.parse(value) diff --git a/apps/sim/tools/sentry/requests.test.ts b/apps/sim/tools/sentry/requests.test.ts index 45826456a7b..7e8486f4ea0 100644 --- a/apps/sim/tools/sentry/requests.test.ts +++ b/apps/sim/tools/sentry/requests.test.ts @@ -30,6 +30,10 @@ describe('sentry_releases_create body', () => { expect(() => releaseBody({ commits: '[{"id":"abc123"},]' })).toThrow(/JSON array/) }) + it('rejects a commits value that is neither an array nor JSON text', () => { + expect(() => releaseBody({ commits: JSON.parse('{"id":"abc123"}') })).toThrow(/JSON array/) + }) + it('accepts projects that arrive as an array', () => { expect(releaseBody({ projects: ['web', ' api ', ''] })).toMatchObject({ projects: ['web', 'api'], diff --git a/apps/sim/tools/slack/revoke_canvas_access.ts b/apps/sim/tools/slack/revoke_canvas_access.ts index d3b3f2642fa..a4098218e35 100644 --- a/apps/sim/tools/slack/revoke_canvas_access.ts +++ b/apps/sim/tools/slack/revoke_canvas_access.ts @@ -21,13 +21,13 @@ export const slackRevokeCanvasAccessTool = createSlackWebApiTool({ type: 'json', required: false, visibility: 'user-or-llm', - description: 'One Slack user ID to remove, as ["U123"] or U123. Omit channel_ids.', + description: 'One Slack user ID to remove, as ["U123"] or U123.', }, channel_ids: { type: 'json', required: false, visibility: 'user-or-llm', - description: 'One Slack channel ID to remove, as ["C123"] or C123. Omit user_ids.', + description: 'One Slack channel ID to remove, as ["C123"] or C123.', }, }, input: z diff --git a/apps/sim/tools/slack/workflow-operations.test.ts b/apps/sim/tools/slack/workflow-operations.test.ts index a6dd28b2c35..99de9049727 100644 --- a/apps/sim/tools/slack/workflow-operations.test.ts +++ b/apps/sim/tools/slack/workflow-operations.test.ts @@ -35,6 +35,7 @@ import { slackRemoveBookmarkTool } from '@/tools/slack/remove_bookmark' import { slackRevokeCanvasAccessTool } from '@/tools/slack/revoke_canvas_access' import { slackSetUserPresenceTool } from '@/tools/slack/set_user_presence' import { slackShareCanvasTool } from '@/tools/slack/share_canvas' +import type { SlackOpenViewParams } from '@/tools/slack/types' import { slackUnarchiveConversationTool } from '@/tools/slack/unarchive_conversation' import { slackUnfurlLinksTool } from '@/tools/slack/unfurl_links' import { slackUnpinMessageTool } from '@/tools/slack/unpin_message' @@ -385,9 +386,13 @@ describe('Slack ID list inputs', () => { describe('Slack views.open targeting', () => { it('accepts an interactivity pointer alone and rejects a call with neither target', () => { - const body = (params: Record) => - (slackOpenViewTool.request.body as (p: Record) => unknown)({ - ...auth, + const buildBody = slackOpenViewTool.request.body + if (typeof buildBody !== 'function') throw new Error('views.open has no request body builder') + const body = (params: Partial) => + buildBody({ + authMethod: 'oauth', + accessToken: 'test-token', + botToken: '', view: { type: 'modal' }, ...params, }) diff --git a/packages/deployment-config/src/integrations.json b/packages/deployment-config/src/integrations.json index 06cfa657443..e7cc2ae2c6a 100644 --- a/packages/deployment-config/src/integrations.json +++ b/packages/deployment-config/src/integrations.json @@ -13880,7 +13880,7 @@ }, { "name": "Create Incident", - "description": "Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts severity, name, summary, type, and status." + "description": "Create a new incident in incident.io. Requires idempotency_key and visibility. Optionally accepts name, summary, severity_id, incident_type_id, and incident_status_id." }, { "name": "Show Incident", @@ -16357,7 +16357,7 @@ }, { "name": "Create Customer Request", - "description": "Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and optionally link to an issue." + "description": "Create a customer request (need) in Linear. Assign to customer, set urgency (priority: 0 = Not important, 1 = Important), and link it to an issue (required for API calls)." }, { "name": "Update Customer Request", From 2f699561bebe3009c30d7edb0207eff4198754d8 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 17:29:32 -0800 Subject: [PATCH 6/7] fix(integrations): keep latest-commit v2 docs, mark Linear project lifecycle timestamps nullable Inline the v2 commit output so the docs generator still documents it, and shrink the unused-exports baseline now that COMMIT_DATA_OUTPUT_PROPERTIES is imported. --- .../docs/content/docs/integrations/github.mdx | 20 +++++++++++++ apps/sim/tools/github/latest_commit.ts | 29 +++++++++---------- apps/sim/tools/linear/types.ts | 6 ++-- scripts/check-unused-exports.baseline.json | 1 - 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/apps/docs/content/docs/integrations/github.mdx b/apps/docs/content/docs/integrations/github.mdx index d2d321a2df2..9be5babec1a 100644 --- a/apps/docs/content/docs/integrations/github.mdx +++ b/apps/docs/content/docs/integrations/github.mdx @@ -212,6 +212,26 @@ Retrieve the latest commit from a GitHub repository | --------- | ---- | ----------- | | `sha` | string | Commit SHA | | `html_url` | string | GitHub web URL | +| `commit` | object | Core commit data | +| ↳ `url` | string | Commit API URL | +| ↳ `message` | string | Commit message | +| ↳ `comment_count` | number | Number of comments | +| ↳ `author` | object | Git actor \(author/committer\) | +| ↳ `name` | string | Name | +| ↳ `email` | string | Email address | +| ↳ `date` | string | Timestamp \(ISO 8601\) | +| ↳ `committer` | object | Git actor \(author/committer\) | +| ↳ `name` | string | Name | +| ↳ `email` | string | Email address | +| ↳ `date` | string | Timestamp \(ISO 8601\) | +| ↳ `tree` | object | Tree object | +| ↳ `sha` | string | Tree SHA | +| ↳ `url` | string | Tree API URL | +| ↳ `verification` | object | Signature verification | +| ↳ `verified` | boolean | Whether signature is verified | +| ↳ `reason` | string | Verification reason | +| ↳ `signature` | string | GPG signature | +| ↳ `payload` | string | Signed payload | | `author` | object | GitHub user object | | ↳ `login` | string | GitHub username | | ↳ `id` | number | User ID | diff --git a/apps/sim/tools/github/latest_commit.ts b/apps/sim/tools/github/latest_commit.ts index e4d251d66a3..30d482a317e 100644 --- a/apps/sim/tools/github/latest_commit.ts +++ b/apps/sim/tools/github/latest_commit.ts @@ -6,21 +6,7 @@ import { USER_FULL_OUTPUT, } from '@/tools/github/types' import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials' -import type { InternalToolConfig, OutputProperty } from '@/tools/types' - -/** The V2 commit object, whose fields are `null` when the latest-commit lookup did not return them. */ -const LATEST_COMMIT_V2_COMMIT_OUTPUT = { - ...COMMIT_DATA_OUTPUT, - properties: { - ...COMMIT_DATA_OUTPUT_PROPERTIES, - url: { ...COMMIT_DATA_OUTPUT_PROPERTIES.url, nullable: true }, - comment_count: { ...COMMIT_DATA_OUTPUT_PROPERTIES.comment_count, nullable: true }, - author: { ...COMMIT_DATA_OUTPUT_PROPERTIES.author, nullable: true }, - committer: { ...COMMIT_DATA_OUTPUT_PROPERTIES.committer, nullable: true }, - tree: { ...COMMIT_DATA_OUTPUT_PROPERTIES.tree, nullable: true }, - verification: { ...COMMIT_DATA_OUTPUT_PROPERTIES.verification, nullable: true }, - }, -} satisfies OutputProperty +import type { InternalToolConfig } from '@/tools/types' export const latestCommitTool: InternalToolConfig = { id: 'github_latest_commit', @@ -110,7 +96,18 @@ export const latestCommitV2Tool: InternalToolConfig = { outputs: { sha: { type: 'string', description: 'Commit SHA' }, html_url: { type: 'string', description: 'GitHub web URL' }, - commit: LATEST_COMMIT_V2_COMMIT_OUTPUT, + commit: { + ...COMMIT_DATA_OUTPUT, + properties: { + ...COMMIT_DATA_OUTPUT_PROPERTIES, + url: { ...COMMIT_DATA_OUTPUT_PROPERTIES.url, nullable: true }, + comment_count: { ...COMMIT_DATA_OUTPUT_PROPERTIES.comment_count, nullable: true }, + author: { ...COMMIT_DATA_OUTPUT_PROPERTIES.author, nullable: true }, + committer: { ...COMMIT_DATA_OUTPUT_PROPERTIES.committer, nullable: true }, + tree: { ...COMMIT_DATA_OUTPUT_PROPERTIES.tree, nullable: true }, + verification: { ...COMMIT_DATA_OUTPUT_PROPERTIES.verification, nullable: true }, + }, + }, author: { ...USER_FULL_OUTPUT, nullable: true }, committer: { ...USER_FULL_OUTPUT, nullable: true }, }, diff --git a/apps/sim/tools/linear/types.ts b/apps/sim/tools/linear/types.ts index c2bf3fc8d8c..05702062455 100644 --- a/apps/sim/tools/linear/types.ts +++ b/apps/sim/tools/linear/types.ts @@ -215,9 +215,9 @@ export const PROJECT_FULL_OUTPUT_PROPERTIES = { */ export const PROJECT_DETAIL_OUTPUT_PROPERTIES = { ...PROJECT_FULL_OUTPUT_PROPERTIES, - completedAt: { type: 'string', description: 'Completion timestamp (ISO 8601)' }, - canceledAt: { type: 'string', description: 'Cancellation timestamp (ISO 8601)' }, - archivedAt: { type: 'string', description: 'Archive timestamp (ISO 8601)' }, + completedAt: { type: 'string', description: 'Completion timestamp (ISO 8601)', nullable: true }, + canceledAt: { type: 'string', description: 'Cancellation timestamp (ISO 8601)', nullable: true }, + archivedAt: { type: 'string', description: 'Archive timestamp (ISO 8601)', nullable: true }, } as const satisfies Record /** diff --git a/scripts/check-unused-exports.baseline.json b/scripts/check-unused-exports.baseline.json index 1d35047b0bf..7981a84fd47 100644 --- a/scripts/check-unused-exports.baseline.json +++ b/scripts/check-unused-exports.baseline.json @@ -5368,7 +5368,6 @@ "apps/sim/tools/firecrawl/types.ts#SEARCH_METADATA_OUTPUT_PROPERTIES", "apps/sim/tools/firecrawl/types.ts#SEARCH_RESULT_OUTPUT", "apps/sim/tools/github/types.ts#BRANCH_REF_OUTPUT_PROPERTIES", - "apps/sim/tools/github/types.ts#COMMIT_DATA_OUTPUT_PROPERTIES", "apps/sim/tools/github/types.ts#COMMIT_REF_OUTPUT", "apps/sim/tools/github/types.ts#COMMIT_REF_OUTPUT_PROPERTIES", "apps/sim/tools/github/types.ts#COMMIT_STATS_OUTPUT_PROPERTIES", From 1b22de1a34e5a1df833789e4991da0a283e642d7 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sun, 15 Nov 2026 17:37:29 -0800 Subject: [PATCH 7/7] chore: regenerate tool metadata and mapper baseline after rebase onto staging --- apps/sim/tools/generated/tool-metadata.ts | 2 +- apps/sim/tools/generated/tool-outputs.ts | 2 +- scripts/check-mapper-operation.baseline.json | 7 ------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/sim/tools/generated/tool-metadata.ts b/apps/sim/tools/generated/tool-metadata.ts index 2851027d951..19dd4bd0df0 100644 --- a/apps/sim/tools/generated/tool-metadata.ts +++ b/apps/sim/tools/generated/tool-metadata.ts @@ -3,7 +3,7 @@ /** Serializable metadata for every built-in tool, keyed by tool id. */ const toolMetadata: Record = JSON.parse( - '{"a2a_cancel_task":{"id":"a2a_cancel_task","name":"A2A Cancel Task","description":"Request cancellation of an in-progress A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to cancel"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_agent_card":{"id":"a2a_get_agent_card","name":"A2A Get Agent Card","description":"Fetch the Agent Card (discovery document) for an external A2A agent.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_task":{"id":"a2a_get_task","name":"A2A Get Task","description":"Retrieve the current state and result of an A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to retrieve"},"historyLength":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of history messages to include"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_send_message":{"id":"a2a_send_message","name":"A2A Send Message","description":"Send a message to an external A2A agent and return its response.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"message":{"type":"string","required":true,"visibility":"user-or-llm","description":"The message text to send"},"data":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional structured JSON data to attach"},"files":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional files to attach"},"taskId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Existing task ID to continue"},"contextId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversation context ID to continue"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"affinity_batch_update_entity_fields":{"id":"affinity_batch_update_entity_fields","name":"Affinity Batch Update Entity Fields","description":"Write up to 100 non-list field values on one company or person in a single request.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the fields on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_batch_update_list_entry_fields":{"id":"affinity_batch_update_list_entry_fields","name":"Affinity Batch Update List Entry Fields","description":"Write up to 100 field values on one list row in a single request. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_create_list":{"id":"affinity_create_list","name":"Affinity Create List","description":"Create a list. Its type fixes which entities it can hold, and the API key holder becomes its creator and owner.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the new list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Entity kind the list holds: company, opportunity, or person"},"isPublic":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether everyone in the organization can see the list"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_create_list_field_dropdown_option":{"id":"affinity_create_list_field_dropdown_option","name":"Affinity Create List Field Dropdown Option","description":"Add a selectable option to a dropdown field on a list. A ranked or status option also needs a rank and a color.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Kind of option to create, matching the field. dropdown takes only a label; ranked-dropdown also requires rank and color; status-dropdown additionally requires a status category. Sending a field the kind does not accept is rejected"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The option label"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_create_merge":{"id":"affinity_create_merge","name":"Affinity Create Merge","description":"Fold a duplicate company or person into the record you are keeping. The merge runs asynchronously — poll the returned task to see it finish. Requires the \\"Manage duplicates\\" permission and an admin role.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to merge: companies or persons"},"primaryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to keep"},"duplicateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the duplicate record to fold in"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_create_note":{"id":"affinity_create_note","name":"Affinity Create Note","description":"Write a note — attached to companies, persons, and opportunities, anchored to a meeting, call, or chat message, or posted as a reply to an existing note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Note shape: entities to attach it to records, interaction to anchor it to a meeting, call, or chat message, or user-reply to reply to a note"},"html":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Companies to attach the note to, e.g. [1, 2]. Not used on a reply"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Persons to attach the note to, e.g. [1, 2]. Not used on a reply"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Opportunities to attach the note to, e.g. [1, 2]. Not used on a reply"},"interactionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The interaction to anchor the note to. Required for an interaction note"},"interactionType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Kind of the anchoring interaction: meeting, call, or chat-message. Required for an interaction note"},"parentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The note being replied to. Required for a user-reply note"},"creatorId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Attribute the note to another internal person. Defaults to the API key holder"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdate the note to this ISO 8601 timestamp"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_create_reminder":{"id":"affinity_create_reminder","name":"Affinity Create Reminder","description":"Create a reminder on one company, person, or opportunity. A recurring reminder resets whenever the chosen signal happens instead of firing once.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"one-time to fire once, or recurring to reset on a signal"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What the reminder is about: company, person, or opportunity"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"dueDate":{"type":"string","required":false,"visibility":"user-or-llm","description":"When the reminder is due, as an ISO 8601 timestamp. Required for a one-time reminder; on a recurring one Affinity computes it from the period when omitted"},"content":{"type":"string","required":false,"visibility":"user-or-llm","description":"What the reminder says"},"ownerId":{"type":"string","required":true,"visibility":"user-or-llm","description":"User the reminder is assigned to. Must be an internal user. The API key holder is recorded as the creator, which is a separate field"},"resetTrigger":{"type":"string","required":false,"visibility":"user-or-llm","description":"What restarts a recurring reminder: interaction, email, or event. Required when the type is recurring"},"periodDays":{"type":"number","required":false,"visibility":"user-or-llm","description":"Days between firings of a recurring reminder. Required when the type is recurring"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_delete_list_field_dropdown_option":{"id":"affinity_delete_list_field_dropdown_option","name":"Affinity Delete List Field Dropdown Option","description":"Permanently delete a dropdown option on a list field. Every list entry currently set to it is cleared, and those values cannot be recovered.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to delete"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_delete_note":{"id":"affinity_delete_note","name":"Affinity Delete Note","description":"Delete a note you created. Deleting a root note also deletes its replies; deleting a reply removes only that reply.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to delete"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_company":{"id":"affinity_get_company","name":"Affinity Get Company","description":"Look up one company by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"companyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The company ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_current_user":{"id":"affinity_get_current_user","name":"Affinity Get Current User","description":"Verify an Affinity API key and return the tenant, the user behind the key, and the scopes the grant carries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_entity_field_value":{"id":"affinity_get_entity_field_value","name":"Affinity Get Entity Field Value","description":"Read one non-list field value from a company or person.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read the field from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_list":{"id":"affinity_get_list","name":"Affinity Get List","description":"Read one list — its name, type, owner, and privacy setting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_list_entry":{"id":"affinity_get_list_entry","name":"Affinity Get List Entry","description":"Read one row of a list with its entity. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_list_entry_field":{"id":"affinity_get_list_entry_field","name":"Affinity Get List Entry Field","description":"Read one field value on a list row.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_list_field_dropdown_option":{"id":"affinity_get_list_field_dropdown_option","name":"Affinity Get List Field Dropdown Option","description":"Read one dropdown option on a list field.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_merge":{"id":"affinity_get_merge","name":"Affinity Get Merge","description":"Read the status of one company or person merge, including why it failed if it did.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge to read: companies or persons"},"mergeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_merge_task":{"id":"affinity_get_merge_task","name":"Affinity Get Merge Task","description":"Read one merge task and how its merges are progressing. Poll this after starting a merge.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge task to read: companies or persons"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge task ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_note":{"id":"affinity_get_note","name":"Affinity Get Note","description":"Read one note with its body, author, mentions, and attached records.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_opportunity":{"id":"affinity_get_opportunity","name":"Affinity Get Opportunity","description":"Read one opportunity and the list it belongs to. Its field data lives on the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"opportunityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The opportunity ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_person":{"id":"affinity_get_person","name":"Affinity Get Person","description":"Look up one person by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"personId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The person ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_saved_view":{"id":"affinity_get_saved_view","name":"Affinity Get Saved View","description":"Read one saved view — its name, kind, and creation date.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_transcript":{"id":"affinity_get_transcript","name":"Affinity Get Transcript","description":"Read one transcript with its first 100 fragments. Page the fragments endpoint for a longer meeting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_get_user":{"id":"affinity_get_user","name":"Affinity Get User","description":"Read one internal user. A user and their person record share the same numeric ID, so a person ID works here.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"userId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The user ID, which is also their person ID"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_calls":{"id":"affinity_list_calls","name":"Affinity List Calls","description":"Page through logged calls and their participants. Only calls the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_chat_messages":{"id":"affinity_list_chat_messages","name":"Affinity List Chat Messages","description":"Page through logged chat messages and their participants. Only messages the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_companies":{"id":"affinity_list_companies","name":"Affinity List Companies","description":"Page through companies. Companies come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these company IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_coworker_connections":{"id":"affinity_list_coworker_connections","name":"Affinity List Coworker Connections","description":"Find warm paths into a company through shared work history: who in your Affinity data once worked alongside the people you want to reach. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_emails":{"id":"affinity_list_emails","name":"Affinity List Emails","description":"Page through email metadata — subject, participants, and timestamps. Affinity never exposes email bodies through the API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_entity_field_values":{"id":"affinity_list_entity_field_values","name":"Affinity List Entity Field Values","description":"Page through a company\'s or person\'s non-list field values. List fields are not returned here — read those through the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read field values from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_entity_list_entries":{"id":"affinity_list_entity_list_entries","name":"Affinity List Entity List Entries","description":"Page through a company\'s or person\'s rows across every list, each carrying that list\'s field values and when the entity was added.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the rows of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_entity_lists":{"id":"affinity_list_entity_lists","name":"Affinity List Entity Lists","description":"List every list a company or person appears on that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the lists of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_entity_notes":{"id":"affinity_list_entity_notes","name":"Affinity List Entity Notes","description":"List the notes relevant to one company, person, or opportunity — directly attached notes plus notes reaching it through its people and meetings.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity the notes hang off: companies, persons, or opportunities"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_entity_relationships":{"id":"affinity_list_entity_relationships","name":"Affinity List Entity Relationships","description":"List who knows a company or person, scored 0.0 to 1.0 by how much the two actually interact. Strongest first by default.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up relationships for: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on interactionScore only, e.g. \\"interactionScore>=0.5\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"interactionScore\\"] for weakest first, [\\"-interactionScore\\"] for strongest first (the default)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_field_dropdown_options":{"id":"affinity_list_field_dropdown_options","name":"Affinity List Field Dropdown Options","description":"List the selectable options on a dropdown or ranked-dropdown company or person field. Writing such a field needs the option ID, not its text.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which field family the field belongs to: companies or persons"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown or ranked-dropdown field ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_field_metadata":{"id":"affinity_list_field_metadata","name":"Affinity List Field Metadata","description":"List the non-list company or person fields, with the value type, filter operators, and sort support of each. Start here to find the Field IDs the read and write tools take.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which fields to describe: companies or persons"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Status\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_field_value_changes":{"id":"affinity_list_field_value_changes","name":"Affinity List Field Value Changes","description":"Page through field value changes across the whole workspace. Built for delta sync: follow nextCursor to the end of a run, then resume from the last cursor next time.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, listEntry.id, changer.id, changedAt, or actionType. Resume a sync with e.g. \\"changedAt>2026-06-01T12:00:00Z\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"changedAt\\"] for oldest first (the default), [\\"-changedAt\\"] for newest first"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_investor_executive_connections":{"id":"affinity_list_investor_executive_connections","name":"Affinity List Investor Executive Connections","description":"Find warm paths into a company through investment history: which investors in your Affinity data backed a company the people you want to reach once led. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_list_entries":{"id":"affinity_list_list_entries","name":"Affinity List List Entries","description":"Page through the rows of a list. Rows come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_list_entry_field_value_changes":{"id":"affinity_list_list_entry_field_value_changes","name":"Affinity List List Entry Field Value Changes","description":"Page through the history of one list row — who changed which field, when, and to what.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, changer.id, changedAt, or actionType, e.g. \\"field.id=field-1234\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_list_entry_fields":{"id":"affinity_list_list_entry_fields","name":"Affinity List List Entry Fields","description":"Page through every field value on one list row, including the list-specific columns. All fields are returned unless narrowed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, list, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_list_field_dropdown_options":{"id":"affinity_list_list_field_dropdown_options","name":"Affinity List List Field Dropdown Options","description":"List the selectable options on a dropdown, ranked-dropdown, or status-dropdown field of a list.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_list_fields":{"id":"affinity_list_list_fields","name":"Affinity List List Fields","description":"List the fields available on one list, including its list-specific columns. Use these Field IDs when reading or writing list entries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Stage\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_lists":{"id":"affinity_list_lists","name":"Affinity List Lists","description":"Page through the lists in the organization that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive substring match on the list name"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_meetings":{"id":"affinity_list_meetings","name":"Affinity List Meetings","description":"Page through past and upcoming meetings with their organizer and attendees.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_merge_tasks":{"id":"affinity_list_merge_tasks","name":"Affinity List Merge Tasks","description":"Page through merge tasks, each summarizing how many of its merges are in progress, succeeded, or failed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge tasks to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on status only, e.g. \\"status=in-progress\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_merges":{"id":"affinity_list_merges","name":"Affinity List Merges","description":"Page through the company or person merges the organization has run, with the status and the records involved in each.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merges to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over status or taskId, e.g. \\"status=failed\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_note_attached_companies":{"id":"affinity_list_note_attached_companies","name":"Affinity List Note Attached Companies","description":"List the companies directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_note_attached_opportunities":{"id":"affinity_list_note_attached_opportunities","name":"Affinity List Note Attached Opportunities","description":"List the opportunities directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_note_attached_persons":{"id":"affinity_list_note_attached_persons","name":"Affinity List Note Attached Persons","description":"List the persons directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_note_replies":{"id":"affinity_list_note_replies","name":"Affinity List Note Replies","description":"Page through the replies on one note, including AI Notetaker replies.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID whose replies to read"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_notes":{"id":"affinity_list_notes","name":"Affinity List Notes","description":"Page through every note the caller can see. Replies are excluded.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_opportunities":{"id":"affinity_list_opportunities","name":"Affinity List Opportunities","description":"Page through opportunities. Field data lives on the list entry, not here — read it through the list or saved view the opportunity belongs to.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these opportunity IDs, e.g. [1, 2, 3]"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_persons":{"id":"affinity_list_persons","name":"Affinity List Persons","description":"Page through persons. Persons come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these person IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_reminders":{"id":"affinity_list_reminders","name":"Affinity List Reminders","description":"Page through the reminders the caller can see. Filter by status to surface what is overdue.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_saved_view_entries":{"id":"affinity_list_saved_view_entries","name":"Affinity List Saved View Entries","description":"Page through the rows of a saved view. The view\'s own filters and columns decide which rows and which field data come back.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_saved_views":{"id":"affinity_list_saved_views","name":"Affinity List Saved Views","description":"List the saved views on a list that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_transcript_fragments":{"id":"affinity_list_transcript_fragments","name":"Affinity List Transcript Fragments","description":"Page through everything said in a meeting, segment by segment with the speaker.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_transcripts":{"id":"affinity_list_transcripts","name":"Affinity List Transcripts","description":"Page through meeting transcript metadata. Read one transcript to get what was actually said.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_list_users":{"id":"affinity_list_users","name":"Affinity List Users","description":"Page through the internal users in the organization. Email addresses and roles are returned only to callers with the \\"Manage Users\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive match across first name, last name, and primary email"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over id or status, e.g. \\"status=active\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_search_companies":{"id":"affinity_search_companies","name":"Affinity Search Companies","description":"Search companies by filters, sorts, and a free-text term. Requires the \\"Export All Organizations directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_search_files":{"id":"affinity_search_files","name":"Affinity Search Files","description":"Search files by keyword, ordered by relevance. Narrow to specific files or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these file IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s files. Cannot be combined with file IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of files to return, 1-100. Defaults to 20"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_search_list_entries":{"id":"affinity_search_list_entries","name":"Affinity Search List Entries","description":"Search the rows of one list by filters, sorts, and a free-text term. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID to search"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_search_notes":{"id":"affinity_search_notes","name":"Affinity Search Notes","description":"Search notes by keyword, ordered by relevance. Narrow to specific notes or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these note IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s notes. Cannot be combined with note IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of notes to return, 1-100. Defaults to 20"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_search_persons":{"id":"affinity_search_persons","name":"Affinity Search Persons","description":"Search persons by filters, sorts, and a free-text term. Requires the \\"Export All People directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_semantic_search":{"id":"affinity_semantic_search","name":"Affinity Semantic Search","description":"Find companies from a description in plain language — industry, technology, stage, or business model. Currently searches companies only.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to look for, in plain language, e.g. \\"climate tech companies in our pipeline\\". Up to 500 characters"},"listIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to companies on these lists, e.g. [1, 2]"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of companies to return, 1-100. Defaults to 100"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_update_entity_field_value":{"id":"affinity_update_entity_field_value","name":"Affinity Update Entity Field Value","description":"Write one non-list field value on a company or person. The value type must match how the field is defined.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the field on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_update_list_entry_field":{"id":"affinity_update_list_entry_field","name":"Affinity Update List Entry Field","description":"Write one field value on a list row. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_update_list_field_dropdown_option":{"id":"affinity_update_list_field_dropdown_option","name":"Affinity Update List Field Dropdown Option","description":"Change a dropdown option on a list field. Every field is optional — supply only what should change, and only fields the option\'s kind actually has.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to update"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement option label. Supply at least one field to change"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"affinity_update_note":{"id":"affinity_update_note","name":"Affinity Update Note","description":"Rewrite a note\'s body or replace which records it is attached to. Each list of IDs replaces that association wholesale, an empty list clears it, and omitting one leaves it untouched. A note\'s type cannot be changed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to update"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached companies, e.g. [1, 2]. Send [] to detach every company; omit to leave them unchanged"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached persons, e.g. [1, 2]. Send [] to detach every person; omit to leave them unchanged"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached opportunities, e.g. [1, 2]. Send [] to detach every opportunity; omit to leave them unchanged"}},"oauth":{"required":false,"provider":"affinity","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_create_draft":{"id":"agentmail_create_draft","name":"Create Draft","description":"Create a new email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to create the draft in"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"inReplyTo":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of message being replied to"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_create_inbox":{"id":"agentmail_create_inbox","name":"Create Inbox","description":"Create a new email inbox with AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"username":{"type":"string","required":false,"visibility":"user-or-llm","description":"Username for the inbox email address"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Domain for the inbox email address"},"displayName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Display name for the inbox"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_delete_draft":{"id":"agentmail_delete_draft","name":"Delete Draft","description":"Delete an email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to delete"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_delete_inbox":{"id":"agentmail_delete_inbox","name":"Delete Inbox","description":"Delete an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to delete"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_delete_thread":{"id":"agentmail_delete_thread","name":"Delete Thread","description":"Delete an email thread in AgentMail (moves to trash, or permanently deletes if already in trash)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to delete"},"permanent":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Force permanent deletion instead of moving to trash"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_forward_message":{"id":"agentmail_forward_message","name":"Forward Message","description":"Forward an email message to new recipients in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to forward"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional plain text to prepend"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional HTML to prepend"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_get_draft":{"id":"agentmail_get_draft","name":"Get Draft","description":"Get details of a specific email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox the draft belongs to"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to retrieve"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_get_inbox":{"id":"agentmail_get_inbox","name":"Get Inbox","description":"Get details of a specific email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to retrieve"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_get_message":{"id":"agentmail_get_message","name":"Get Message","description":"Get details of a specific email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to retrieve"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_get_thread":{"id":"agentmail_get_thread","name":"Get Thread","description":"Get details of a specific email thread including messages in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to retrieve"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_list_drafts":{"id":"agentmail_list_drafts","name":"List Drafts","description":"List email drafts in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list drafts from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of drafts to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_list_inboxes":{"id":"agentmail_list_inboxes","name":"List Inboxes","description":"List all email inboxes in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of inboxes to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_list_messages":{"id":"agentmail_list_messages","name":"List Messages","description":"List messages in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list messages from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of messages to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_list_threads":{"id":"agentmail_list_threads","name":"List Threads","description":"List email threads in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list threads from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of threads to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"},"labels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to filter threads by"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads after this ISO 8601 timestamp"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_reply_message":{"id":"agentmail_reply_message","name":"Reply to Message","description":"Reply to an existing email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to reply from"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to reply to"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text reply body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML reply body"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override recipient email addresses (comma-separated)"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC email addresses (comma-separated)"},"replyAll":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Reply to all recipients of the original message"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_send_draft":{"id":"agentmail_send_draft","name":"Send Draft","description":"Send an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to send"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_send_message":{"id":"agentmail_send_message","name":"Send Message","description":"Send an email message from an AgentMail inbox","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to send from"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email address (comma-separated for multiple)"},"subject":{"type":"string","required":true,"visibility":"user-or-llm","description":"Email subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text email body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML email body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_update_draft":{"id":"agentmail_update_draft","name":"Update Draft","description":"Update an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to update"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_update_inbox":{"id":"agentmail_update_inbox","name":"Update Inbox","description":"Update the display name of an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to update"},"displayName":{"type":"string","required":true,"visibility":"user-or-llm","description":"New display name for the inbox"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_update_message":{"id":"agentmail_update_message","name":"Update Message","description":"Add or remove labels on an email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the message"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the message"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentmail_update_thread":{"id":"agentmail_update_thread","name":"Update Thread Labels","description":"Add or remove labels on an email thread in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the thread"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the thread"}},"oauth":{"required":false,"provider":"agentmail","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_create_call":{"id":"agentphone_create_call","name":"Create Outbound Call","description":"Initiate an outbound voice call from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent that will handle the call"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number to call in E.164 format (e.g. +14155551234)"},"fromNumberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to use as caller ID. Must belong to the agent. If omitted, the agent\'s first assigned number is used."},"initialGreeting":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional greeting spoken when the recipient answers"},"voice":{"type":"string","required":false,"visibility":"user-or-llm","description":"Voice ID override for this call (defaults to the agent\'s configured voice)"},"systemPrompt":{"type":"string","required":false,"visibility":"user-or-llm","description":"When provided, uses a built-in LLM for the conversation instead of forwarding to your webhook"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_create_contact":{"id":"agentphone_create_contact","name":"Create Contact","description":"Create a new contact in AgentPhone","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"phoneNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number in E.164 format (e.g. +14155551234)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact\'s full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Contact\'s email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Freeform notes stored on the contact"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_create_number":{"id":"agentphone_create_number","name":"Create Phone Number","description":"Provision a new SMS- and voice-enabled phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code (e.g. US, CA). Defaults to US."},"areaCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Preferred area code (US/CA only, e.g. \\"415\\"). Best-effort — may be ignored if unavailable."},"agentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optionally attach the number to an agent immediately"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_delete_contact":{"id":"agentphone_delete_contact","name":"Delete Contact","description":"Delete a contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_call":{"id":"agentphone_get_call","name":"Get Call","description":"Fetch a call and its full transcript","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_call_transcript":{"id":"agentphone_get_call_transcript","name":"Get Call Transcript","description":"Get the full ordered transcript for a call","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve the transcript for"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_contact":{"id":"agentphone_get_contact","name":"Get Contact","description":"Fetch a single contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_conversation":{"id":"agentphone_get_conversation","name":"Get Conversation","description":"Get a conversation along with its recent messages","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"messageLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of recent messages to include (default 50, max 100)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_conversation_messages":{"id":"agentphone_get_conversation_messages","name":"Get Conversation Messages","description":"Get paginated messages for a conversation","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_number_messages":{"id":"agentphone_get_number_messages","name":"Get Phone Number Messages","description":"Fetch messages received on a specific phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_usage":{"id":"agentphone_get_usage","name":"Get Usage","description":"Retrieve current usage statistics for the AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_usage_daily":{"id":"agentphone_get_usage_daily","name":"Get Daily Usage","description":"Get a daily breakdown of usage (messages, calls, webhooks) for the last N days","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"days":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of days to return (1-365, default 30)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_get_usage_monthly":{"id":"agentphone_get_usage_monthly","name":"Get Monthly Usage","description":"Get monthly usage aggregation (messages, calls, webhooks) for the last N months","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"months":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of months to return (1-24, default 6)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_list_calls":{"id":"agentphone_list_calls","name":"List Calls","description":"List voice calls for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"},"status":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by status (completed, in-progress, failed)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by direction (inbound, outbound)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by call type (pstn, web)"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search by phone number (matches fromNumber or toNumber)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_list_contacts":{"id":"agentphone_list_contacts","name":"List Contacts","description":"List contacts for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by name or phone number (case-insensitive contains)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 50, max 200)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_list_conversations":{"id":"agentphone_list_conversations","name":"List Conversations","description":"List conversations (message threads) for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_list_numbers":{"id":"agentphone_list_numbers","name":"List Phone Numbers","description":"List all phone numbers provisioned for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_react_to_message":{"id":"agentphone_react_to_message","name":"React to Message","description":"Send an iMessage tapback reaction to a message (iMessage only)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to react to"},"reaction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Reaction type: love, like, dislike, laugh, emphasize, or question"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_release_number":{"id":"agentphone_release_number","name":"Release Phone Number","description":"Release (delete) a phone number. This action is irreversible.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number to release"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_send_message":{"id":"agentphone_send_message","name":"Send Message","description":"Send an outbound SMS or iMessage from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent sending the message"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient phone number in E.164 format (e.g. +14155551234)"},"body":{"type":"string","required":true,"visibility":"user-or-llm","description":"Message text to send"},"mediaUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional URL of an image, video, or file to attach"},"numberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to send from. If omitted, the agent\'s first assigned number is used."}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_update_contact":{"id":"agentphone_update_contact","name":"Update Contact","description":"Update a contact\'s fields","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"New phone number in E.164 format"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New contact name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"New email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"New freeform notes"}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agentphone_update_conversation":{"id":"agentphone_update_conversation","name":"Update Conversation","description":"Update conversation metadata (stored state). Pass null to clear existing metadata.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"metadata":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom key-value metadata to store on the conversation. Pass null to clear existing metadata."}},"oauth":{"required":false,"provider":"agentphone","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"agiloft_async_status":{"id":"agiloft_async_status","name":"Agiloft Async Status","description":"Check whether an asynchronous Agiloft call, such as a run action button, has completed.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table the asynchronous call was made against"},"callbackId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Callback ID returned by the asynchronous call, e.g. from Run Action Button"}},"hostedApiKey":"none"},"agiloft_attach_file":{"id":"agiloft_attach_file","name":"Agiloft Attach File","description":"Attach a file to a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to attach the file to"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"file":{"type":"file","required":true,"visibility":"user-or-llm","description":"File to attach"},"fileName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name to assign to the file (defaults to original file name)"},"overwrite":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Replace the contents of the field instead of adding another file to it"}},"hostedApiKey":"none"},"agiloft_attachment_info":{"id":"agiloft_attachment_info","name":"Agiloft Attachment Info","description":"Get information about file attachments on a record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to check attachments on"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field to inspect"}},"hostedApiKey":"none"},"agiloft_create_record":{"id":"agiloft_create_record","name":"Agiloft Create Record","description":"Create a new record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record field values as a JSON object (e.g., {\\"first_name\\": \\"John\\", \\"status\\": \\"Active\\"})"}},"hostedApiKey":"none"},"agiloft_delete_record":{"id":"agiloft_delete_record","name":"Agiloft Delete Record","description":"Delete a record from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to delete"},"substituteIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated IDs of records that adopt the dependants of the deleted record. Read only when the delete rule is REPLACE_WITH_ANOTHER."},"deleteRule":{"type":"string","required":false,"visibility":"user-or-llm","description":"How to treat records that depend on this one: ERROR_IF_DEPENDANTS (default — fails rather than cascading), APPLY_DELETE_WHERE_POSSIBLE, DELETE_WHERE_POSSIBLE_OTHERWISE_UNLINK, APPLY_UNLINK, UNLINK_WHERE_POSSIBLE_OTHERWISE_DELETE, or REPLACE_WITH_ANOTHER"}},"hostedApiKey":"none"},"agiloft_get_choice_line_id":{"id":"agiloft_get_choice_line_id","name":"Agiloft Get Choice Line ID","description":"Resolve the internal numeric ID of a choice-list value, for use in EWSelect WHERE clauses against choice fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"case\\", \\"contracts\\")"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice field name (e.g., \\"priority\\", \\"status\\")"},"value":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice display value to resolve (e.g., \\"High\\", \\"Active\\")"}},"hostedApiKey":"none"},"agiloft_list_tables":{"id":"agiloft_list_tables","name":"Agiloft List Tables","description":"List the tables and fields in an Agiloft knowledge base, to discover the logical names other operations need.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":false,"visibility":"user-or-llm","description":"Logical name of a single table to describe (e.g., \\"contacts\\"). Leave empty to list every table in the knowledge base."},"includeLinkedInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the source table and column behind each linked field"},"skipColumnsInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Return table names only, omitting field details, for a much smaller response"}},"hostedApiKey":"none"},"agiloft_lock_record":{"id":"agiloft_lock_record","name":"Agiloft Lock Record","description":"Lock, unlock, or check the lock status of an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to lock, unlock, or check"},"lockAction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Action to perform: \\"lock\\", \\"unlock\\", or \\"check\\""},"force":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Unlock only: release a lock held by another user."}},"hostedApiKey":"none"},"agiloft_nlp_search":{"id":"agiloft_nlp_search","name":"Agiloft Natural Language Search","description":"Search Agiloft records by describing what you want in plain language, such as \\"active NDAs submitted last month\\".","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"nlpQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The request in plain language, e.g. \\"Show me open, high-priority contracts\\". Structured field filters are not accepted — use Search Records for those."},"fields":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated field names to return, e.g. \\"id, contract_title1, company_name\\""},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number, starting from 0"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Records per page"}},"hostedApiKey":"none"},"agiloft_read_record":{"id":"agiloft_read_record","name":"Agiloft Read Record","description":"Read a record by ID from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to read"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the response"}},"hostedApiKey":"none"},"agiloft_remove_attachment":{"id":"agiloft_remove_attachment","name":"Agiloft Remove Attachment","description":"Remove an attached file from a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file to remove (starting from 0)"}},"hostedApiKey":"none"},"agiloft_retrieve_attachment":{"id":"agiloft_retrieve_attachment","name":"Agiloft Retrieve Attachment","description":"Download an attached file from an Agiloft record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file in the field (starting from 0)"}},"hostedApiKey":"none"},"agiloft_run_action_button":{"id":"agiloft_run_action_button","name":"Agiloft Run Action Button","description":"Run an action button on an Agiloft record, such as an approval or send-for-signature step.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"case\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to run the action button on"},"actionButtonField":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical name of the field holding the action button (e.g., \\"ab_field\\")"}},"hostedApiKey":"none"},"agiloft_saved_search":{"id":"agiloft_saved_search","name":"Agiloft Saved Search","description":"List the saved searches defined for an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical table name to list saved searches for (e.g., \\"contract\\")"}},"hostedApiKey":"none"},"agiloft_search_records":{"id":"agiloft_search_records","name":"Agiloft Search Records","description":"Search for records in an Agiloft table using a query.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name to search in (e.g., \\"contracts\\", \\"contacts.employees\\")"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Ad hoc EWSearch query. Combine conditions with && (and) or || (or) and quote every value — e.g. \\"summary~=\'test\'&&priority=\'High\'\\". Required unless a saved search is given."},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Label of a saved search defined on the table (e.g., \\"C: Status is Closed\\"). Can be combined with a query to narrow it further."},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the results"},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number for paginated results (starting from 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of records to return per page. Agiloft treats 0 as \\"all records\\", so leave it unset or use a positive value to keep result sizes bounded."}},"hostedApiKey":"none"},"agiloft_select_records":{"id":"agiloft_select_records","name":"Agiloft Select Records","description":"Select record IDs matching a SQL WHERE clause from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"where":{"type":"string","required":true,"visibility":"user-or-llm","description":"SQL WHERE clause using database column names (e.g., \\"summary like \'%new%\'\\" or \\"assigned_person=\'John Doe\'\\"). EWSelect has no page size and returns every matching ID, so append a database limit such as \\"limit 0,200\\" to bound the result."}},"hostedApiKey":"none"},"agiloft_update_record":{"id":"agiloft_update_record","name":"Agiloft Update Record","description":"Update an existing record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to update"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Updated field values as a JSON object (e.g., {\\"status\\": \\"Active\\", \\"priority\\": \\"High\\"})"}},"hostedApiKey":"none"},"agiloft_upsert_record":{"id":"agiloft_upsert_record","name":"Agiloft Upsert Record","description":"Create an Agiloft record, or update it when a record already matches the given fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"match":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field used to find an existing record (e.g., \\"ext_id\\"). Pick something that identifies a record uniquely — if more than one record matches, Agiloft writes nothing and returns a conflict."},"async":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Queue the write instead of waiting for it. Returns a callback ID instead of a record ID; pass that to Async Status to poll the result."},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field values as a JSON object. On create these populate the new record; on update only the supplied fields change."}},"hostedApiKey":"none"},"ahrefs_anchors":{"id":"ahrefs_anchors","name":"Ahrefs Anchors","description":"Get the anchor text distribution for a target domain or URL\'s backlinks, showing how many links and referring domains use each anchor text.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_backlinks":{"id":"ahrefs_backlinks","name":"Ahrefs Backlinks","description":"Get a list of backlinks pointing to a target domain or URL. Returns details about each backlink including source URL, anchor text, and domain rating.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live backlinks), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_backlinks_stats":{"id":"ahrefs_backlinks_stats","name":"Ahrefs Backlinks Stats","description":"Get backlink and referring domain totals for a target domain or URL, both currently live and across all time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_batch_analysis":{"id":"ahrefs_batch_analysis","name":"Ahrefs Batch Analysis","description":"Get bulk SEO metrics (Domain Rating, backlinks, referring domains, organic traffic, and more) for multiple domains or URLs in a single request. Useful for comparing many competitors at once.","version":"1.0.0","params":{"targets":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated list of domains or URLs to analyze. Example: \\"example.com,competitor.com\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode applied to every target: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"protocol":{"type":"string","required":false,"visibility":"user-or-llm","description":"Protocol applied to every target: \\"both\\" (default), \\"http\\", or \\"https\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_broken_backlinks":{"id":"ahrefs_broken_backlinks","name":"Ahrefs Broken Backlinks","description":"Get a list of broken backlinks pointing to a target domain or URL. Useful for identifying link reclamation opportunities.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_domain_rating":{"id":"ahrefs_domain_rating","name":"Ahrefs Domain Rating","description":"Get the Domain Rating (DR) and Ahrefs Rank for a target domain. Domain Rating shows the strength of a website\'s backlink profile on a scale from 0 to 100.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze (e.g., example.com)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date for historical data in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_domain_rating_history":{"id":"ahrefs_domain_rating_history","name":"Ahrefs Domain Rating History","description":"Get the historical Domain Rating (DR) trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_keyword_overview":{"id":"ahrefs_keyword_overview","name":"Ahrefs Keyword Overview","description":"Get detailed metrics for a keyword including search volume, keyword difficulty, CPC, clicks, and traffic potential.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The keyword to analyze"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_keywords_history":{"id":"ahrefs_keywords_history","name":"Ahrefs Keywords History","description":"Get the historical organic keyword ranking distribution for a target domain or URL over a date range: how many keywords rank in each position bucket at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_metrics":{"id":"ahrefs_metrics","name":"Ahrefs Metrics","description":"Get a one-call organic and paid search overview for a target domain or URL: organic traffic, organic keywords, paid traffic, paid keywords, and estimated traffic cost.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_metrics_history":{"id":"ahrefs_metrics_history","name":"Ahrefs Metrics History","description":"Get the historical organic and paid traffic trend for a target domain or URL over a date range: organic traffic/cost and paid traffic/cost at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_organic_competitors":{"id":"ahrefs_organic_competitors","name":"Ahrefs Organic Competitors","description":"Get domains that compete with a target domain or URL for the same organic keywords, ranked by keyword overlap.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_organic_keywords":{"id":"ahrefs_organic_keywords","name":"Ahrefs Organic Keywords","description":"Get organic keywords that a target domain or URL ranks for in Google search results. Returns keyword details including search volume, ranking position, and estimated traffic.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_paid_pages":{"id":"ahrefs_paid_pages","name":"Ahrefs Paid Pages","description":"Get a target domain\'s pages that receive paid search traffic, sorted by estimated paid traffic. Returns page URLs with their paid traffic, keyword counts, and estimated spend.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_overview":{"id":"ahrefs_rank_tracker_competitors_overview","name":"Ahrefs Rank Tracker Competitors Overview","description":"Get competitor rankings for the keywords tracked in an Ahrefs Rank Tracker project: each tracked keyword\'s volume and difficulty alongside every competitor\'s position, traffic, and traffic value. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_stats":{"id":"ahrefs_rank_tracker_competitors_stats","name":"Ahrefs Rank Tracker Competitors Stats","description":"Get aggregate competitor stats for an Ahrefs Rank Tracker project: each competitor\'s traffic, traffic value, average position, and share of voice across all tracked keywords. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report metrics for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_rank_tracker_overview":{"id":"ahrefs_rank_tracker_overview","name":"Ahrefs Rank Tracker Overview","description":"Get ranking overview metrics for the keywords tracked in an Ahrefs Rank Tracker project: position, search volume, keyword difficulty, and estimated traffic. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_rank_tracker_serp_overview":{"id":"ahrefs_rank_tracker_serp_overview","name":"Ahrefs Rank Tracker SERP Overview","description":"Get the full SERP (search engine results page) for a keyword tracked in an Ahrefs Rank Tracker project, including every ranking URL with its position, title, and authority metrics. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The tracked keyword to retrieve SERP data for"},"country":{"type":"string","required":true,"visibility":"user-or-llm","description":"Country code for the tracked keyword. Example: \\"us\\", \\"gb\\", \\"de\\""},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"topPositions":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of top organic positions to return (defaults to all available)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Timestamp to return the last available SERP Overview at, in YYYY-MM-DDThh:mm:ss format"},"locationId":{"type":"number","required":false,"visibility":"user-or-llm","description":"Location ID of the tracked keyword, if tracked at a specific location"},"languageCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code of the tracked keyword"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_refdomains_history":{"id":"ahrefs_refdomains_history","name":"Ahrefs Referring Domains History","description":"Get the historical referring domains trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_referring_domains":{"id":"ahrefs_referring_domains","name":"Ahrefs Referring Domains","description":"Get a list of domains that link to a target domain or URL. Returns unique referring domains with their domain rating, backlink counts, and discovery dates.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost domains), or \\"since:YYYY-MM-DD\\" (domains found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_related_terms":{"id":"ahrefs_related_terms","name":"Ahrefs Related Terms","description":"Get keyword ideas related to a seed keyword: terms the same top-ranking pages also rank for (\\"also rank for\\") or also discuss (\\"also talk about\\"), with volume, difficulty, and CPC.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The seed keyword to find related terms for"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"terms":{"type":"string","required":false,"visibility":"user-or-llm","description":"Type of related keywords to return: \\"also_rank_for\\", \\"also_talk_about\\", or \\"all\\" (default: \\"all\\")"},"viewFor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Whether to derive related terms from the top 10 or top 100 ranking pages (default: \\"top_10\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_site_audit_page_explorer":{"id":"ahrefs_site_audit_page_explorer","name":"Ahrefs Site Audit Page Explorer","description":"Get crawled pages from an Ahrefs Site Audit project with health and SEO metrics: HTTP status, title, link counts, backlinks, indexability, and traffic. Optionally filter to pages affected by a specific issue.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Site Audit project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Crawl date in YYYY-MM-DDThh:mm:ss format (defaults to the most recent crawl)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip, for pagination"},"issueId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Only return pages affected by this issue ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ahrefs_top_pages":{"id":"ahrefs_top_pages","name":"Ahrefs Top Pages","description":"Get the top pages of a target domain sorted by organic traffic. Returns page URLs with their traffic, keyword counts, and estimated traffic value.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"oauth":{"required":false,"provider":"ahrefs","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"airtable_create_records":{"id":"airtable_create_records","name":"Airtable Create Records","description":"Write new records to an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to create, each with a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_delete_records":{"id":"airtable_delete_records","name":"Airtable Delete Records","description":"Delete one or more records from an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordIds":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of record IDs to delete (each starts with \\"rec\\", e.g., [\\"recXXXXXXXXXXXXXX\\"]). Pass a single-element array to delete one record."}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_base_schema":{"id":"airtable_get_base_schema","name":"Airtable Get Base Schema","description":"Get the schema of all tables, fields, and views in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_record":{"id":"airtable_get_record","name":"Airtable Get Record","description":"Retrieve a single record from an Airtable table by its ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to retrieve (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_bases":{"id":"airtable_list_bases","name":"Airtable List Bases","description":"List all bases the authenticated user has access to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination offset for retrieving additional bases"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_records":{"id":"airtable_list_records","name":"Airtable List Records","description":"Read records from an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"maxRecords":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum total number of records to return. Each request returns at most one page (pageSize, up to 100); use offset to fetch the next page"},"filterFormula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Formula to filter records (e.g., \\"({Field Name} = \'Value\')\\")"},"pageSize":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of records per page (max 100, default 100)"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination offset from a previous response, to fetch the next page of records"},"view":{"type":"string","required":false,"visibility":"user-or-llm","description":"View name or ID. Only records in the view are returned, sorted in the view order"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_tables":{"id":"airtable_list_tables","name":"Airtable List Tables","description":"List all tables and their schema in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_multiple_records":{"id":"airtable_update_multiple_records","name":"Airtable Update Multiple Records","description":"Update multiple existing records in an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to update, each with an `id` and a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_record":{"id":"airtable_update_record","name":"Airtable Update Record","description":"Update an existing record in an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to update (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"},"fields":{"type":"json","required":true,"visibility":"user-or-llm","description":"An object containing the field names and their new values"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_upsert_records":{"id":"airtable_upsert_records","name":"Airtable Upsert Records","description":"Update existing records or create new ones in an Airtable table, matching on the specified merge fields","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to upsert, each with a `fields` object"},"fieldsToMergeOn":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of field names used to match existing records (max 3). A record is updated when all merge fields match, otherwise it is created. Example: [\\"Name\\"]"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"algolia_add_record":{"id":"algolia_add_record","name":"Algolia Add Record","description":"Add or replace a record in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":false,"visibility":"user-or-llm","description":"Object ID for the record (auto-generated if not provided)"},"record":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object representing the record to add"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_batch_operations":{"id":"algolia_batch_operations","name":"Algolia Batch Operations","description":"Perform batch add, update, partial update, or delete operations on records in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of batch operations. Each item has \\"action\\" (addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, delete, clear) and \\"body\\" (the record data; must include objectID for update/delete; use an empty object {} for the index-level delete/clear actions)"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_browse_records":{"id":"algolia_browse_records","name":"Algolia Browse Records","description":"Browse and iterate over all records in an Algolia index using cursor pagination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key (must have browse ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to browse"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search query to filter browsed records"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string to narrow down results"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 1000, max: 1000)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous browse response for pagination"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_clear_records":{"id":"algolia_clear_records","name":"Algolia Clear Records","description":"Clear all records from an Algolia index while keeping settings, synonyms, and rules","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to clear"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_copy_move_index":{"id":"algolia_copy_move_index","name":"Algolia Copy/Move Index","description":"Copy or move an Algolia index to a new destination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the source index"},"operation":{"type":"string","required":true,"visibility":"user-or-llm","description":"Operation to perform: \\"copy\\" or \\"move\\""},"destination":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the destination index"},"scope":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of scopes to copy (only for \\"copy\\" operation): [\\"settings\\", \\"synonyms\\", \\"rules\\"]. Omit to copy everything including records."}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_delete_by_filter":{"id":"algolia_delete_by_filter","name":"Algolia Delete By Filter","description":"Delete all records matching a filter from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter expression to match records for deletion (e.g., \\"category:outdated\\")"},"facetFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of facet filters (e.g., [\\"brand:Acme\\"])"},"numericFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of numeric filters (e.g., [\\"price > 100\\"])"},"tagFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of tag filters using the _tags attribute (e.g., [\\"published\\"])"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search filter (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search filter"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search filter"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_delete_index":{"id":"algolia_delete_index","name":"Algolia Delete Index","description":"Delete an entire Algolia index and all its records","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to delete"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_delete_record":{"id":"algolia_delete_record","name":"Algolia Delete Record","description":"Delete a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to delete"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_get_record":{"id":"algolia_get_record","name":"Algolia Get Record","description":"Get a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to retrieve"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_get_records":{"id":"algolia_get_records","name":"Algolia Get Records","description":"Retrieve multiple records by objectID from one or more Algolia indices","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Default index name for all requests"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of objects specifying records to retrieve. Each must have \\"objectID\\" and optionally \\"indexName\\" and \\"attributesToRetrieve\\"."}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_get_settings":{"id":"algolia_get_settings","name":"Algolia Get Settings","description":"Retrieve the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_get_task_status":{"id":"algolia_get_task_status","name":"Algolia Get Task Status","description":"Check whether an Algolia indexing task has finished publishing","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index the task ran against"},"taskID":{"type":"number","required":true,"visibility":"user-or-llm","description":"The taskID returned by a previous write operation"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_list_indices":{"id":"algolia_list_indices","name":"Algolia List Indices","description":"List all indices in an Algolia application","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for paginating indices (default: not paginated)"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of indices per page (default: 100)"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_partial_update_record":{"id":"algolia_partial_update_record","name":"Algolia Partial Update Record","description":"Partially update a record in an Algolia index without replacing it entirely","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to update"},"attributes":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with attributes to update. Supports built-in operations like {\\"stock\\": {\\"_operation\\": \\"Decrement\\", \\"value\\": 1}}"},"createIfNotExists":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to create the record if it does not exist (default: true)"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_search":{"id":"algolia_search","name":"Algolia Search","description":"Search an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to search"},"query":{"type":"string","required":true,"visibility":"user-or-llm","description":"Search query text"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 20)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number to retrieve (default: 0)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string (e.g., \\"category:electronics AND price < 100\\")"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"facets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of facet attribute names to retrieve counts for (use \\"*\\" for all)"},"getRankingInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to include detailed ranking information in each hit"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"algolia_update_settings":{"id":"algolia_update_settings","name":"Algolia Update Settings","description":"Update the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have editSettings ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"settings":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with settings to update (e.g., {\\"searchableAttributes\\": [\\"name\\", \\"description\\"], \\"customRanking\\": [\\"desc(popularity)\\"]})"},"forwardToReplicas":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to apply changes to replica indices (default: false)"}},"oauth":{"required":false,"provider":"algolia","credentialKind":"service-account","credentialParams":{"applicationId":"providerWorkspaceId","apiKey":"accessToken"},"credentialSuppliedParams":["applicationId","apiKey"]},"hostedApiKey":"none"},"amplitude_event_segmentation":{"id":"amplitude_event_segmentation","name":"Amplitude Event Segmentation","description":"Query event analytics data with segmentation. Get event counts, uniques, averages, and more.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Event type name to analyze"},"secondEventType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Second event type to query alongside the first (event B in a formula such as \\"UNIQUES(A)/UNIQUES(B)\\")"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: uniques, totals, pct_dau, average, histogram, sums, value_avg, or formula (default: uniques)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: -300000 (real-time), -3600000 (hourly), 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (prefix custom user properties with \\"gp:\\")"},"groupBy2":{"type":"string","required":false,"visibility":"user-or-llm","description":"Second property name to group by (prefix custom user properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (default 1000, max 20000)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON array of filter objects applied to the event, e.g. [{\\"subprop_type\\":\\"event\\",\\"subprop_key\\":\\"city\\",\\"subprop_op\\":\\"is\\",\\"subprop_value\\":[\\"San Francisco\\"]}]"},"formula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when metric is \\"formula\\", e.g. \\"UNIQUES(A)/UNIQUES(B)\\""},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_funnels":{"id":"amplitude_funnels","name":"Amplitude Funnels","description":"Analyze conversion rates and drop-off between a sequence of events.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"events":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON array of event objects, one per funnel step in order, e.g. [{\\"event_type\\":\\"signup\\"},{\\"event_type\\":\\"purchase\\"}]"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Funnel ordering: \\"ordered\\", \\"unordered\\", or \\"sequential\\" (default: ordered)"},"userType":{"type":"string","required":false,"visibility":"user-or-llm","description":"User type: \\"new\\" or \\"active\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: -300000 (real-time), -3600000 (hourly), 1 (daily), 7 (weekly), or 30 (monthly)"},"conversionWindowSeconds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversion window in seconds (default: 2592000, i.e. 30 days)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (default and max: 1000)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_get_active_users":{"id":"amplitude_get_active_users","name":"Amplitude Get Active Users","description":"Get active or new user counts over a date range from the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: \\"active\\" or \\"new\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_get_revenue":{"id":"amplitude_get_revenue","name":"Amplitude Get Revenue","description":"Get revenue LTV data including ARPU, ARPPU, total revenue, and paying user counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric: 0 (ARPU), 1 (ARPPU), 2 (Total Revenue), 3 (Paying Users)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (limit: one)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_group_identify":{"id":"amplitude_group_identify","name":"Amplitude Group Identify","description":"Set group-level properties in Amplitude. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"groupType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Group classification (e.g., \\"company\\", \\"org_id\\")"},"groupValue":{"type":"string","required":true,"visibility":"user-or-llm","description":"Specific group identifier (e.g., \\"Acme Corp\\")"},"groupProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of group properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_identify_user":{"id":"amplitude_identify_user","name":"Amplitude Identify User","description":"Set user properties in Amplitude using the Identify API. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"userProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of user properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_list_events":{"id":"amplitude_list_events","name":"Amplitude List Events","description":"List all event types in the Amplitude project with their weekly totals and unique counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_realtime_active_users":{"id":"amplitude_realtime_active_users","name":"Amplitude Real-time Active Users","description":"Get real-time active user counts at 5-minute granularity for the last 2 days.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_retention":{"id":"amplitude_retention","name":"Amplitude Retention","description":"Measure how many users return to perform an action after a starting action.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"startEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON starting event object, e.g. {\\"event_type\\":\\"_new\\"} or {\\"event_type\\":\\"_active\\"}"},"returnEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON returning event object, e.g. {\\"event_type\\":\\"_all\\"} or {\\"event_type\\":\\"_active\\"}"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"retentionMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Retention type: \\"n-day\\" (sent as nday), \\"rolling\\", \\"bracket\\", or \\"nday_or_before\\" (default: n-day)"},"retentionBrackets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when Retention Mode is \\"bracket\\". Day ranges with an exclusive end day, e.g. [[0,5]] for Day 0 to Day 4"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_send_event":{"id":"amplitude_send_event","name":"Amplitude Send Event","description":"Track an event in Amplitude using the HTTP V2 API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the event (e.g., \\"page_view\\", \\"purchase\\")"},"eventProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of custom event properties"},"userProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of user properties to set (supports $set, $setOnce, $add, $append, $unset)"},"time":{"type":"string","required":false,"visibility":"user-or-llm","description":"Event timestamp in milliseconds since epoch"},"sessionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Session start time in milliseconds since epoch"},"insertId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Unique ID for deduplication (within 7-day window)"},"appVersion":{"type":"string","required":false,"visibility":"user-or-llm","description":"Application version string"},"platform":{"type":"string","required":false,"visibility":"user-or-llm","description":"Platform (e.g., \\"Web\\", \\"iOS\\", \\"Android\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code"},"language":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code (e.g., \\"en\\")"},"ip":{"type":"string","required":false,"visibility":"user-or-llm","description":"IP address for geo-location"},"price":{"type":"string","required":false,"visibility":"user-or-llm","description":"Price of the item purchased"},"quantity":{"type":"string","required":false,"visibility":"user-or-llm","description":"Quantity of items purchased"},"revenue":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue amount"},"productId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Product identifier"},"revenueType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue type (e.g., \\"purchase\\", \\"refund\\")"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_user_activity":{"id":"amplitude_user_activity","name":"Amplitude User Activity","description":"Get the event stream for a specific user by their Amplitude ID.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"amplitudeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Amplitude internal user ID"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Offset for pagination (default 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of events to return (default 1000, max 1000)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort direction: \\"latest\\" or \\"earliest\\" (default: latest)"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"amplitude_user_profile":{"id":"amplitude_user_profile","name":"Amplitude User Profile","description":"Get a user profile including properties, cohort memberships, and computed properties. Not available for EU data-residency projects.","version":"1.0.0","params":{"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"Amplitude API Key. With it, the request authenticates with both keys over Basic auth"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"External user ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"getAmpProps":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include Amplitude user properties (true/false, default: false)"},"getCohortIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include cohort IDs the user belongs to (true/false, default: false)"},"getComputations":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include computed user properties (true/false, default: false)"}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken"},"credentialSuppliedParams":["apiKey","secretKey"]},"hostedApiKey":"none"},"amplitude_user_search":{"id":"amplitude_user_search","name":"Amplitude User Search","description":"Search for a user by User ID, Device ID, or Amplitude ID using the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"user":{"type":"string","required":true,"visibility":"user-or-llm","description":"User ID, Device ID, or Amplitude ID to search for"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"oauth":{"required":false,"provider":"amplitude","credentialKind":"service-account","credentialParams":{"apiKey":"providerWorkspaceId","secretKey":"accessToken","dataResidency":"domain"},"credentialSuppliedParams":["apiKey","secretKey","dataResidency"]},"hostedApiKey":"none"},"apify_get_dataset_items":{"id":"apify_get_dataset_items","name":"APIFY Get Dataset Items","description":"Retrieve items stored in an APIFY dataset","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"datasetId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Dataset ID to read items from. Example: \\"9RnD3Pql2vGZkc5H5\\""},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max items to return (1-250000). Default: all items. Example: 500"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to skip at the start. Default: 0"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of fields to include. Example: \\"title,url,price\\""}},"oauth":{"required":false,"provider":"apify","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"apify_get_run":{"id":"apify_get_run","name":"APIFY Get Run","description":"Get the status and details of an APIFY actor run","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"runId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor run ID to fetch. Example: \\"HG7ML7M8z78YcAPEB\\""}},"oauth":{"required":false,"provider":"apify","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"apify_run_actor_async":{"id":"apify_run_actor_async","name":"APIFY Run Actor (Async)","description":"Start an APIFY Actor run and poll it within the same workflow step until completion or the polling deadline","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ], \\"maxPages\\": 10 }"},"waitForFinish":{"type":"number","required":false,"visibility":"user-or-llm","description":"Initial wait time in seconds (0-60) before polling starts. Example: 30"},"itemLimit":{"type":"number","required":false,"default":100,"visibility":"user-or-llm","description":"Max dataset items to fetch (1-250000). Default: 100. Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"oauth":{"required":false,"provider":"apify","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"apify_run_actor_sync":{"id":"apify_run_actor_sync","name":"APIFY Run Actor (Sync)","description":"Run an APIFY actor synchronously and get results (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ], \\"maxPages\\": 10 }"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"oauth":{"required":false,"provider":"apify","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"apify_run_task":{"id":"apify_run_task","name":"APIFY Run Task","description":"Run a saved APIFY actor task synchronously and get dataset items (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task ID or username/task-name. Examples: \\"janedoe/my-task\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON string that overrides the task\'s saved input. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ] }"},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max dataset items to return (1-250000). Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the run (128-32768). Example: 1024 for 1GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the run. Example: 300 for 5 minutes"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\""}},"oauth":{"required":false,"provider":"apify","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"apollo_account_bulk_create":{"id":"apollo_account_bulk_create","name":"Apollo Bulk Create Accounts","description":"Create up to 100 accounts at once in your Apollo database. Set run_dedupe=true to deduplicate by domain, organization_id, and name. Master key required.","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"accounts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of accounts to create (max 100). Each account should include a name, and may optionally include domain, phone, phone_status_cd, raw_address, owner_id, linkedin_url, facebook_url, twitter_url, salesforce_id, and hubspot_id."},"append_label_names":{"type":"array","required":false,"visibility":"user-only","description":"Array of label names to add to ALL accounts in this request"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, performs aggressive deduplication by domain, organization_id, and name (defaults to false)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_account_bulk_update":{"id":"apollo_account_bulk_update","name":"Apollo Bulk Update Accounts","description":"Update up to 1000 existing accounts at once in your Apollo database (higher limit than contacts!). Each account must include an id field. Master key required.","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"account_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of account IDs to update with the same values (max 1000). Use with name/owner_id for uniform updates. Use either this OR account_attributes."},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this name to all accounts"},"owner_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this owner to all accounts"},"account_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this account stage to all accounts"},"account_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of account objects with individual updates (each must include id). Example: [{\\"id\\": \\"acc1\\", \\"name\\": \\"Acme\\", \\"owner_id\\": \\"u1\\", \\"account_stage_id\\": \\"s1\\", \\"typed_custom_fields\\": {\\"field_id\\": \\"value\\"}}]"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, processes the update asynchronously. Only supported when using account_ids; returns 422 if used with account_attributes."}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_account_create":{"id":"apollo_account_create","name":"Apollo Create Account","description":"Create a new account (company) in your Apollo database","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain without www. prefix (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the account"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_account_search":{"id":"apollo_account_search","name":"Apollo Search Accounts","description":"Search your team\'s accounts in Apollo. Display limit: 50,000 records (100 records per page, 500 pages max). Use filters to narrow results. Master key required.","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter accounts by organization name (partial-match search)"},"account_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account stage IDs"},"account_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account label IDs"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"account_last_activity_date\\", \\"account_created_at\\", or \\"account_updated_at\\""},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Sort ascending when true. Defaults to descending."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_account_update":{"id":"apollo_account_update","name":"Apollo Update Account","description":"Update an existing account in your Apollo database","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the account to update (e.g., \\"acc_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company phone number"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_contact_bulk_create":{"id":"apollo_contact_bulk_create","name":"Apollo Bulk Create Contacts","description":"Create up to 100 contacts at once in your Apollo database. Supports deduplication to prevent creating duplicate contacts. Master key required.","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contacts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contacts to create (max 100). Each contact may include first_name, last_name, email, title, organization_name, account_id, owner_id, contact_stage_id, linkedin_url, phone (single string) or phone_numbers (array of {raw_number, position}), contact_emails, typed_custom_fields, and CRM IDs (salesforce_contact_id, hubspot_id, team_id) for cross-system matching"},"append_label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Label names to add to all contacts in this request (e.g., [\\"Hot Lead\\"])"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"Enable deduplication to prevent creating duplicate contacts. When true, existing contacts are returned without modification"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_contact_bulk_update":{"id":"apollo_contact_bulk_update","name":"Apollo Bulk Update Contacts","description":"Update up to 100 existing contacts at once in your Apollo database. Each contact must include an id field. Master key required.","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to update. Must be paired with an object-form contact_attributes specifying the fields to apply uniformly to all listed contacts."},"contact_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Required. Either an array of per-contact updates (each with id) — used standalone — or a single object of attributes to apply to all contact_ids. Supported fields: owner_id, email, organization_name, title, first_name, last_name, account_id, present_raw_address, linkedin_url, typed_custom_fields"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"Force asynchronous processing. Automatically enabled for >100 contacts"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_contact_create":{"id":"apollo_contact_create","name":"Apollo Create Contact","description":"Create a new contact in your Apollo database","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the contact"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID to associate with (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for POST /contacts)"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, Apollo deduplicates against existing contacts"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_contact_search":{"id":"apollo_contact_search","name":"Apollo Search Contacts","description":"Search your team\'s contacts in Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"contact_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by contact stage IDs"},"contact_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by Apollo label IDs (lists)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-only","description":"Sort field: contact_last_activity_date, contact_email_last_opened_at, contact_email_last_clicked_at, contact_created_at, or contact_updated_at"},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, sort ascending. Must be used together with sort_by_field"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_contact_update":{"id":"apollo_contact_update","name":"Apollo Update Contact","description":"Update an existing contact in your Apollo database","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"contact_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the contact to update (e.g., \\"con_abc123\\")"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for PATCH /contacts/{id})"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_email_accounts":{"id":"apollo_email_accounts","name":"Apollo Get Email Accounts","description":"Get list of team\'s linked email accounts in Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_opportunity_create":{"id":"apollo_opportunity_create","name":"Apollo Create Opportunity","description":"Create a new deal for an account in your Apollo database (master key required)","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of the account this opportunity belongs to (e.g., \\"acc_abc123\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_opportunity_get":{"id":"apollo_opportunity_get","name":"Apollo Get Opportunity","description":"Retrieve complete details of a specific deal/opportunity by ID","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to retrieve (e.g., \\"opp_abc123\\")"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_opportunity_search":{"id":"apollo_opportunity_search","name":"Apollo Search Opportunities","description":"Search and list all deals/opportunities in your team\'s Apollo account","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"amount\\", \\"is_closed\\", or \\"is_won\\""},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_opportunity_update":{"id":"apollo_opportunity_update","name":"Apollo Update Opportunity","description":"Update an existing deal/opportunity in your Apollo database","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to update (e.g., \\"opp_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_organization_bulk_enrich":{"id":"apollo_organization_bulk_enrich","name":"Apollo Bulk Organization Enrichment","description":"Enrich data for up to 10 organizations at once using Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domains":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of company domains to enrich (max 10, no www. or @, e.g., [\\"apollo.io\\", \\"stripe.com\\"])"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_organization_enrich":{"id":"apollo_organization_enrich","name":"Apollo Organization Enrichment","description":"Enrich data for a single organization using Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domain":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_organization_search":{"id":"apollo_organization_search","name":"Apollo Organization Search","description":"Search Apollo\'s database for companies using filters","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company HQ locations (cities, US states, or countries)"},"organization_not_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Exclude companies whose HQ is in these locations"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges as \\"min,max\\" strings (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"q_organization_keyword_tags":{"type":"array","required":false,"visibility":"user-or-llm","description":"Industry or keyword tags"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Organization name to search for (e.g., \\"Acme\\", \\"TechCorp\\")"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to include (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Domain names to filter by (no www. or @, up to 1,000)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_people_bulk_enrich":{"id":"apollo_people_bulk_enrich","name":"Apollo Bulk People Enrichment","description":"Enrich data for up to 10 people at once using Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"people":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of people to enrich (max 10)"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_people_enrich":{"id":"apollo_people_enrich","name":"Apollo People Enrichment","description":"Enrich data for a single person using Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the person"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the person"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Full name of the person (alternative to first_name/last_name)"},"id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the person"},"hashed_email":{"type":"string","required":false,"visibility":"user-or-llm","description":"MD5 or SHA-256 hashed email"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the person"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name where the person works"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"},"linkedin_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_people_search":{"id":"apollo_people_search","name":"Apollo People Search","description":"Search Apollo\'s database for people using demographic filters","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"person_titles":{"type":"array","required":false,"visibility":"user-or-llm","description":"Job titles to search for (e.g., [\\"CEO\\", \\"VP of Sales\\"])"},"include_similar_titles":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to return people with job titles similar to person_titles"},"person_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Locations to search in (e.g., [\\"San Francisco, CA\\", \\"New York, NY\\"])"},"person_seniorities":{"type":"array","required":false,"visibility":"user-or-llm","description":"Seniority levels (one of: owner, founder, c_suite, partner, vp, head, director, manager, senior, entry, intern)"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to filter by (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"organization_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company names to search within (legacy filter)"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Headquarters locations of the people\'s current employer (e.g., [\'texas\', \'tokyo\', \'spain\'])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employer domain names (e.g., [\\"apollo.io\\", \\"microsoft.com\\"]) — up to 1,000, no www. or @"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges for the person\'s current employer. Each entry is \\"min,max\\" (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"contact_email_status":{"type":"array","required":false,"visibility":"user-or-llm","description":"Email statuses to filter by: \\"verified\\", \\"unverified\\", \\"likely to engage\\", \\"unavailable\\""},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination, default 1 (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, default 25, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_sequence_add_contacts":{"id":"apollo_sequence_add_contacts","name":"Apollo Add Contacts to Sequence","description":"Add contacts to an Apollo sequence","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sequence_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the sequence to add contacts to (e.g., \\"seq_abc123\\")"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to add to the sequence (e.g., [\\"con_abc123\\", \\"con_def456\\"]). Either contact_ids or label_names must be provided."},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of label names to identify contacts to add to the sequence. Either contact_ids or label_names must be provided."},"send_email_from_email_account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the email account to send from. Use the Get Email Accounts operation to look this up."},"send_email_from_email_address":{"type":"string","required":false,"visibility":"user-only","description":"Specific email address to send from within the email account."},"sequence_no_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they have no email address"},"sequence_unverified_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts with unverified email addresses"},"sequence_job_change":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who recently changed jobs"},"sequence_active_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts active in other campaigns"},"sequence_finished_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who finished other campaigns"},"sequence_same_company_in_same_campaign":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if others from the same company are in the sequence"},"contacts_without_ownership_permission":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts without ownership permission"},"add_if_in_queue":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they are in the queue"},"contact_verification_skipped":{"type":"boolean","required":false,"visibility":"user-only","description":"Skip contact verification when adding"},"user_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the user performing the action"},"status":{"type":"string","required":false,"visibility":"user-only","description":"Initial status for added contacts: \\"active\\" or \\"paused\\""},"auto_unpause_at":{"type":"string","required":false,"visibility":"user-only","description":"ISO 8601 datetime to automatically unpause contacts"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_sequence_search":{"id":"apollo_sequence_search","name":"Apollo Search Sequences","description":"Search for sequences/campaigns in your team\'s Apollo account (master key required)","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search sequences by name (e.g., \\"Outbound Q1\\", \\"Follow-up\\")"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_task_create":{"id":"apollo_task_create","name":"Apollo Create Task","description":"Create one or more tasks in Apollo (one task per contact_id, master key required)","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"user_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the Apollo user the task is assigned to"},"contact_ids":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contact IDs. One task is created per contact."},"priority":{"type":"string","required":false,"visibility":"user-or-llm","description":"Task priority: \\"high\\", \\"medium\\", or \\"low\\" (defaults to \\"medium\\")"},"due_at":{"type":"string","required":true,"visibility":"user-or-llm","description":"Due date/time in ISO 8601 format (e.g., \\"2024-12-31T23:59:59Z\\")"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task type: \\"call\\", \\"outreach_manual_email\\", \\"linkedin_step_connect\\", \\"linkedin_step_message\\", \\"linkedin_step_view_profile\\", \\"linkedin_step_interact_post\\", or \\"action_item\\""},"status":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task status: \\"scheduled\\", \\"completed\\", or \\"skipped\\""},"note":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-form note providing context for the task"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"apollo_task_search":{"id":"apollo_task_search","name":"Apollo Search Tasks","description":"Search for tasks in Apollo","version":"1.0.0","params":{"credentialType":{"type":"string","required":false,"visibility":"hidden","description":"Stored credential type supplied by credential resolution"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"task_due_at\\" or \\"task_priority\\""},"open_factor_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Filter by status. Common values: [\\"task_types\\"] for open tasks, [\\"task_completed_at\\"] for completed tasks."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"oauth":{"required":false,"provider":"apollo","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"],"authoritativeParams":["credentialType"]},"hostedApiKey":"none"},"appconfig_create_application":{"id":"appconfig_create_application","name":"AppConfig Create Application","description":"Create an application in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the application to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the application"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_create_configuration_profile":{"id":"appconfig_create_configuration_profile","name":"AppConfig Create Configuration Profile","description":"Create a configuration profile in an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the configuration profile in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the configuration profile"},"locationUri":{"type":"string","required":true,"visibility":"user-or-llm","description":"Where the configuration is stored. Use \\"hosted\\" for AppConfig-hosted configurations, or an SSM/S3 URI"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"ARN of an IAM role to retrieve the configuration (required for non-hosted URIs)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Profile type: AWS.Freeform (default) or AWS.AppConfig.FeatureFlags"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_create_environment":{"id":"appconfig_create_environment","name":"AppConfig Create Environment","description":"Create an environment for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the environment in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the environment to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the environment"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_create_hosted_configuration_version":{"id":"appconfig_create_hosted_configuration_version","name":"AppConfig Create Hosted Configuration Version","description":"Create a new hosted configuration version for an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to add the version to"},"content":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration content (e.g., a JSON or YAML document)"},"contentType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Content type of the configuration (e.g., application/json, text/plain)"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration version"},"latestVersionNumber":{"type":"number","required":false,"visibility":"user-or-llm","description":"The version number of the latest version, used for optimistic concurrency"},"versionLabel":{"type":"string","required":false,"visibility":"user-or-llm","description":"A user-defined label for the configuration version"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_delete_application":{"id":"appconfig_delete_application","name":"AppConfig Delete Application","description":"Delete an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to delete"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_delete_configuration_profile":{"id":"appconfig_delete_configuration_profile","name":"AppConfig Delete Configuration Profile","description":"Delete an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to delete"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_delete_environment":{"id":"appconfig_delete_environment","name":"AppConfig Delete Environment","description":"Delete an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to delete"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_delete_hosted_configuration_version":{"id":"appconfig_delete_hosted_configuration_version","name":"AppConfig Delete Hosted Configuration Version","description":"Delete a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID that owns the version"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to delete"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_application":{"id":"appconfig_get_application","name":"AppConfig Get Application","description":"Get details about a single AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to retrieve"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_configuration":{"id":"appconfig_get_configuration","name":"AppConfig Get Configuration","description":"Retrieve the latest deployed configuration for an AppConfig application, environment, and profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID or name to retrieve configuration for"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID or name to retrieve configuration for"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID or name to retrieve"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_configuration_profile":{"id":"appconfig_get_configuration_profile","name":"AppConfig Get Configuration Profile","description":"Get details about a single AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to retrieve"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_deployment":{"id":"appconfig_get_deployment","name":"AppConfig Get Deployment","description":"Get details about a specific AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_environment":{"id":"appconfig_get_environment","name":"AppConfig Get Environment","description":"Get details about a single AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to retrieve"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_get_hosted_configuration_version":{"id":"appconfig_get_hosted_configuration_version","name":"AppConfig Get Hosted Configuration Version","description":"Retrieve a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to read the version from"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to retrieve"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_applications":{"id":"appconfig_list_applications","name":"AppConfig List Applications","description":"List applications in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of applications to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_configuration_profiles":{"id":"appconfig_list_configuration_profiles","name":"AppConfig List Configuration Profiles","description":"List configuration profiles for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profiles"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of configuration profiles to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_deployment_strategies":{"id":"appconfig_list_deployment_strategies","name":"AppConfig List Deployment Strategies","description":"List deployment strategies available in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployment strategies to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_deployments":{"id":"appconfig_list_deployments","name":"AppConfig List Deployments","description":"List deployments for an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployments"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_environments":{"id":"appconfig_list_environments","name":"AppConfig List Environments","description":"List environments for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of environments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_list_hosted_configuration_versions":{"id":"appconfig_list_hosted_configuration_versions","name":"AppConfig List Hosted Configuration Versions","description":"List hosted configuration versions for an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to list versions for"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of versions to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_start_deployment":{"id":"appconfig_start_deployment","name":"AppConfig Start Deployment","description":"Start deploying a configuration version to an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to deploy in"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to deploy to"},"deploymentStrategyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The deployment strategy ID to use"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to deploy"},"configurationVersion":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration version to deploy"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the deployment"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_stop_deployment":{"id":"appconfig_stop_deployment","name":"AppConfig Stop Deployment","description":"Stop an in-progress AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment to stop"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_update_application":{"id":"appconfig_update_application","name":"AppConfig Update Application","description":"Update the name or description of an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the application"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the application"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_update_configuration_profile":{"id":"appconfig_update_configuration_profile","name":"AppConfig Update Configuration Profile","description":"Update the name, description, or retrieval role of an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the configuration profile"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"New ARN of the IAM role used to retrieve the configuration"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"appconfig_update_environment":{"id":"appconfig_update_environment","name":"AppConfig Update Environment","description":"Update the name or description of an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the environment"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the environment"}},"oauth":{"required":false,"provider":"aws","credentialKind":"service-account","credentialSuppliedParams":["accessKeyId","secretAccessKey","awsAccessKeyId","awsSecretAccessKey"]},"hostedApiKey":"none"},"arxiv_get_author_papers":{"id":"arxiv_get_author_papers","name":"ArXiv Get Author Papers","description":"Search for papers by a specific author on ArXiv.","version":"1.0.0","params":{"authorName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Author name to search for"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"}},"hostedApiKey":"none"},"arxiv_get_paper":{"id":"arxiv_get_paper","name":"ArXiv Get Paper","description":"Get detailed information about a specific ArXiv paper by its ID.","version":"1.0.0","params":{"paperId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ArXiv paper ID (e.g., \\"1706.03762\\")"}},"hostedApiKey":"none"},"arxiv_search":{"id":"arxiv_search","name":"ArXiv Search","description":"Search for academic papers on ArXiv by keywords, authors, titles, or other fields.","version":"1.0.0","params":{"searchQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The search query to execute"},"searchField":{"type":"string","required":false,"visibility":"user-only","description":"Field to search in: all, ti (title), au (author), abs (abstract), co (comment), jr (journal), cat (category), rn (report number)"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"},"sortBy":{"type":"string","required":false,"visibility":"user-only","description":"Sort by: relevance, lastUpdatedDate, submittedDate (default: relevance)"},"sortOrder":{"type":"string","required":false,"visibility":"user-only","description":"Sort order: ascending, descending (default: descending)"}},"hostedApiKey":"none"},"asana_add_comment":{"id":"asana_add_comment","name":"Asana Add Comment","description":"Add a comment (story) to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string)"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The text content of the comment"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_add_followers":{"id":"asana_add_followers","name":"Asana Add Followers","description":"Add one or more followers to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task (numeric string)"},"followers":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of user GIDs to add as followers to the task"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_project":{"id":"asana_create_project","name":"Asana Create Project","description":"Create a new project in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the project will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the project"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the project"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_section":{"id":"asana_create_section","name":"Asana Create Section","description":"Create a new section in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to add the section to"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the section"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_subtask":{"id":"asana_create_subtask","name":"Asana Create Subtask","description":"Create a subtask under an existing Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the parent Asana task (numeric string)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the subtask"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the subtask"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the subtask to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_task":{"id":"asana_create_task","name":"Asana Create Task","description":"Create a new task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the task will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the task to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_delete_task":{"id":"asana_delete_task","name":"Asana Delete Task","description":"Delete an Asana task by its GID (moves it to the trash)","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task to delete (numeric string)"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_project":{"id":"asana_get_project","name":"Asana Get Project","description":"Retrieve a single Asana project by its GID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to retrieve"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_projects":{"id":"asana_get_projects","name":"Asana Get Projects","description":"Retrieve all projects from an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to retrieve projects from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_task":{"id":"asana_get_task","name":"Asana Get Task","description":"Retrieve a single task by GID or get multiple tasks with filters","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":false,"visibility":"user-or-llm","description":"The globally unique identifier (GID) of the task. If not provided, will get multiple tasks."},"workspace":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to filter tasks. Asana requires an assignee alongside a workspace filter; use project instead to list a project"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Assignee to filter tasks on (user GID, email, or \\"me\\"). Required by Asana when filtering by workspace; ignored when filtering by project"},"project":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to filter tasks"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of tasks to return, 1-100 (default: 50)"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination offset token from a previous response next_page.offset"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_sections":{"id":"asana_list_sections","name":"Asana List Sections","description":"List all sections in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to list sections from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_workspaces":{"id":"asana_list_workspaces","name":"Asana List Workspaces","description":"List all Asana workspaces and organizations the authenticated user belongs to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_search_tasks":{"id":"asana_search_tasks","name":"Asana Search Tasks","description":"Search for tasks in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to search tasks in"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Full-text search on task names and descriptions"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter tasks by assignee user GID"},"projects":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of Asana project GIDs (numeric strings) to filter tasks by"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Filter by completion status"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of tasks to return, 1-100"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_update_task":{"id":"asana_update_task","name":"Asana Update Task","description":"Update an existing task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string) of the task to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated name for the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated assignee user GID"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Mark task as completed or not completed"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"ashby_add_candidate_tag":{"id":"ashby_add_candidate_tag","name":"Ashby Add Candidate Tag","description":"Adds a tag to a candidate in Ashby and returns the updated candidate.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the tag to"},"tagId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the tag to add"}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_anonymize_candidate":{"id":"ashby_anonymize_candidate","name":"Ashby Anonymize Candidate","description":"Remove personally identifiable information from an Ashby candidate while retaining the candidate record and its applications. This operation does not delete the candidate. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the candidate to anonymize"}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_change_application_source":{"id":"ashby_change_application_source","name":"Ashby Change Application Source","description":"Changes the source attributed to an existing application, so programmatically created applications report correctly on the recruiting side. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the application whose source should change"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the application to, as returned by List Sources. Omit only when unsetSource is true."},"unsetSource":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Set true to deliberately clear the application source. Required to unset, so that a missing or empty sourceId cannot wipe attribution by accident."}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_change_application_stage":{"id":"ashby_change_application_stage","name":"Ashby Change Application Stage","description":"Moves an application to a different interview stage. Requires an archive reason when moving to an Archived stage.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the application to update the stage of"},"interviewStageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the interview stage to move the application to"},"archiveReasonId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Archive reason UUID. Required when moving to an Archived stage, ignored otherwise"},"archiveEmail":{"type":"json","required":false,"visibility":"user-or-llm","description":"Archive email configuration with communicationTemplateId and optional sendAt ISO 8601 timestamp. Pass null or omit to send no archive email."}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_create_application":{"id":"ashby_create_application","name":"Ashby Create Application","description":"Creates a new application for a candidate on a job. Optionally specify interview plan, stage, source, and credited user.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to consider for the job"},"jobId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the job to consider the candidate for"},"interviewPlanId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview plan to use (defaults to the job default plan)"},"interviewStageId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview stage to place the application in, or FirstPreInterviewScreen (defaults to the first Lead stage)"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to set on the application"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the user the application is credited to"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to set as the application creation date (defaults to now)"},"applicationHistory":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional documented application history entries to create with the application"}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_create_candidate":{"id":"ashby_create_candidate","name":"Ashby Create Candidate","description":"Creates a new candidate record in Ashby.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"The candidate full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary email address for the candidate"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the candidate"},"linkedInUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"githubUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"GitHub profile URL"},"website":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal website URL"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the candidate to"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the Ashby user to credit with sourcing this candidate"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdated creation timestamp in ISO 8601 (e.g. 2024-01-01T00:00:00Z). Defaults to now."},"alternateEmailAddresses":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of additional email address strings to add to the candidate, e.g. [\\"a@x.com\\",\\"b@y.com\\"]"},"location":{"type":"json","required":false,"visibility":"user-or-llm","description":"Candidate location object with optional city, region, and country"}},"oauth":{"required":false,"provider":"ashby","credentialKind":"service-account","credentialParams":{"apiKey":"accessToken"},"credentialSuppliedParams":["apiKey"]},"hostedApiKey":"none"},"ashby_create_note":{"id":"ashby_create_note","name":"Ashby Create Note","description":"Creates a note on a candidate in Ashby. Supports plain text and HTML content (bold, italic, underline, links, lists, code).","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the note to"},"note":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note content. If noteType is text/html, supports: , , , ,