diff --git a/apps/docs/content/docs/integrations/brex.mdx b/apps/docs/content/docs/integrations/brex.mdx
index db1e97f70a1..22c4ed719e3 100644
--- a/apps/docs/content/docs/integrations/brex.mdx
+++ b/apps/docs/content/docs/integrations/brex.mdx
@@ -39,7 +39,7 @@ List expenses in the Brex account with optional filters for user, status, paymen
| --------- | ---- | -------- | ----------- |
| `userIds` | string | No | Comma-separated user IDs to filter expenses by owner |
| `statuses` | string | No | Comma-separated expense statuses to filter by: DRAFT, SUBMITTED, APPROVED, OUT_OF_POLICY, VOID, CANCELED, SPLIT, SETTLED |
-| `paymentStatuses` | string | No | Comma-separated payment statuses to filter by: NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED |
+| `paymentStatuses` | string | No | Comma-separated payment statuses to filter by: NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED, HELD |
| `purchasedAtStart` | string | No | Only include expenses purchased at or after this ISO 8601 timestamp |
| `purchasedAtEnd` | string | No | Only include expenses purchased at or before this ISO 8601 timestamp |
| `cursor` | string | No | Pagination cursor from a previous response |
@@ -53,7 +53,7 @@ List expenses in the Brex account with optional filters for user, status, paymen
| ↳ `id` | string | Unique expense ID |
| ↳ `memo` | string | Memo on the expense |
| ↳ `status` | string | Expense status \(DRAFT, SUBMITTED, APPROVED, OUT_OF_POLICY, VOID, CANCELED, SPLIT, SETTLED\) |
-| ↳ `payment_status` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED\) |
+| ↳ `payment_status` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED, HELD\) |
| ↳ `expense_type` | string | Expense type \(CARD, BILLPAY, REIMBURSEMENT, CLAWBACK, UNSET\) |
| ↳ `category` | string | Expense category \(e.g., RESTAURANTS, RECURRING_SOFTWARE_AND_SAAS, AIRLINE_EXPENSES\) |
| ↳ `merchant` | json | Merchant details |
@@ -111,7 +111,7 @@ Get a single Brex expense by its ID, including merchant, user, and receipt detai
| `id` | string | Unique expense ID |
| `memo` | string | Memo on the expense |
| `status` | string | Expense status \(DRAFT, SUBMITTED, APPROVED, OUT_OF_POLICY, VOID, CANCELED, SPLIT, SETTLED\) |
-| `paymentStatus` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED\) |
+| `paymentStatus` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED, HELD\) |
| `expenseType` | string | Expense type \(CARD, BILLPAY, REIMBURSEMENT, CLAWBACK, UNSET\) |
| `category` | string | Expense category \(e.g., RESTAURANTS, RECURRING_SOFTWARE_AND_SAAS, AIRLINE_EXPENSES\) |
| `merchantId` | string | Merchant ID |
@@ -178,7 +178,7 @@ Update the memo of a Brex card expense
| `id` | string | Unique expense ID |
| `memo` | string | Updated memo on the expense |
| `status` | string | Expense status \(DRAFT, SUBMITTED, APPROVED, OUT_OF_POLICY, VOID, CANCELED, SPLIT, SETTLED\) |
-| `paymentStatus` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED\) |
+| `paymentStatus` | string | Payment status \(NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED, HELD\) |
| `category` | string | Expense category \(e.g., RESTAURANTS, RECURRING_SOFTWARE_AND_SAAS, AIRLINE_EXPENSES\) |
| `merchantId` | string | Merchant ID |
| `budgetId` | string | Budget ID |
@@ -491,7 +491,7 @@ List users in the Brex account, optionally filtered by email
| ↳ `first_name` | string | First name |
| ↳ `last_name` | string | Last name |
| ↳ `email` | string | Email address |
-| ↳ `status` | string | User status \(INVITED, ACTIVE, CLOSED, DISABLED, DELETED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
+| ↳ `status` | string | User status \(INVITED, ACTIVE, DISABLED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
| ↳ `manager_id` | string | ID of the manager |
| ↳ `department_id` | string | Department ID |
| ↳ `location_id` | string | Location ID |
@@ -520,7 +520,7 @@ Get a Brex user by their ID
| `firstName` | string | First name |
| `lastName` | string | Last name |
| `email` | string | Email address |
-| `status` | string | User status \(INVITED, ACTIVE, CLOSED, DISABLED, DELETED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
+| `status` | string | User status \(INVITED, ACTIVE, DISABLED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
| `managerId` | string | ID of the manager |
| `departmentId` | string | Department ID |
| `locationId` | string | Location ID |
@@ -547,7 +547,7 @@ Get the Brex user associated with the API token
| `firstName` | string | First name |
| `lastName` | string | Last name |
| `email` | string | Email address |
-| `status` | string | User status \(INVITED, ACTIVE, CLOSED, DISABLED, DELETED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
+| `status` | string | User status \(INVITED, ACTIVE, DISABLED, PENDING_ACTIVATION, INACTIVE, ARCHIVED\) |
| `managerId` | string | ID of the manager |
| `departmentId` | string | Department ID |
| `locationId` | string | Location ID |
@@ -656,6 +656,7 @@ List cards in the Brex account, optionally filtered by card owner
| ↳ `status` | string | Card status |
| ↳ `last_four` | string | Last four digits of the card number |
| ↳ `card_name` | string | Card name |
+| ↳ `created_at` | string | Card creation timestamp |
| ↳ `card_type` | string | Card type \(VIRTUAL or PHYSICAL\) |
| ↳ `limit_type` | string | Limit type \(CARD or USER\) |
| ↳ `spend_controls` | json | Spend controls on the card |
@@ -752,7 +753,7 @@ Get a Brex budget by its ID
| `amount` | json | Budget amount |
| ↳ `amount` | number | Amount in the smallest unit of the currency \(e.g., cents for USD\) |
| ↳ `currency` | string | ISO 4217 currency code \(e.g., USD\) |
-| `spendBudgetStatus` | string | Budget status \(ACTIVE, ARCHIVED, DELETED\) |
+| `spendBudgetStatus` | string | Budget status \(ACTIVE, ARCHIVED, DELETED, EXPIRED\) |
| `limitType` | string | Budget limit type \(HARD or SOFT\) |
@@ -887,7 +888,7 @@ Get a Brex spend limit by its ID
| `name` | string | Spend limit name |
| `description` | string | Spend limit description |
| `parentBudgetId` | string | Parent budget ID |
-| `status` | string | Spend limit status \(ACTIVE, EXPIRED, ARCHIVED\) |
+| `status` | string | Spend limit status \(ACTIVE, EXPIRED, ARCHIVED, DELETED\) |
| `periodRecurrenceType` | string | Period recurrence \(PER_WEEK, PER_MONTH, PER_QUARTER, PER_YEAR, ONE_TIME\) |
| `spendType` | string | Spend type of the limit |
| `startDate` | string | Spend limit start date |
@@ -932,7 +933,7 @@ Create a new spend limit (hard-authorization card program) in the Brex account
| `currency` | string | No | ISO 4217 currency code for the base limit \(defaults to USD\) |
| `authorizationType` | string | Yes | Whether authorizations decline based on available balance \(HARD, SOFT\) |
| `rolloverRefreshRate` | string | Yes | Recurrence at which rolled-over unused funds stop rolling over \(OFF, NEVER, PER_MONTH, PER_QUARTER, PER_YEAR\) |
-| `limitBufferPercentage` | number | No | Flexible buffer on the limit as a 0-100 percentage |
+| `limitBufferPercentage` | number | No | Flexible buffer on the limit as a whole-number percentage from 0 to 100 |
| `description` | string | No | Description of what the spend limit is used for |
| `parentBudgetId` | string | No | ID of the parent budget |
| `startDate` | string | No | Date the spend limit should start counting \(YYYY-MM-DD\) |
diff --git a/apps/docs/content/docs/integrations/calcom.mdx b/apps/docs/content/docs/integrations/calcom.mdx
index 9f23780f0de..a9b0c5ce177 100644
--- a/apps/docs/content/docs/integrations/calcom.mdx
+++ b/apps/docs/content/docs/integrations/calcom.mdx
@@ -156,7 +156,7 @@ Get details of a specific booking by its UID
### Cal.com List Bookings
-List all bookings with optional status filter
+List bookings, optionally filtered by status, attendee email, or time range
@@ -167,6 +167,10 @@ List all bookings with optional status filter
| `status` | string | No | Filter bookings by status: upcoming, recurring, past, cancelled, or unconfirmed |
| `take` | number | No | Number of bookings to return \(pagination limit\) |
| `skip` | number | No | Number of bookings to skip \(pagination offset\) |
+| `attendeeEmail` | string | No | Only return bookings that include an attendee with this email |
+| `afterStart` | string | No | Only return bookings starting after this ISO 8601 time |
+| `beforeEnd` | string | No | Only return bookings ending before this ISO 8601 time |
+| `sortStart` | string | No | Sort bookings by start time: asc or desc |
#### Output
@@ -485,6 +489,9 @@ Create a new event type in Cal.com
| ↳ `disableGuests` | boolean | Whether guests are disabled |
| ↳ `createdAt` | string | ISO timestamp of creation |
| ↳ `updatedAt` | string | ISO timestamp of last update |
+| ↳ `bookingUrl` | string | Public booking page URL for the event type |
+| ↳ `hidden` | boolean | Whether the event type is hidden from the profile |
+| ↳ `ownerId` | number | ID of the user who owns the event type |
@@ -519,6 +526,9 @@ Get detailed information about a specific event type
| ↳ `disableGuests` | boolean | Whether guests are disabled |
| ↳ `createdAt` | string | ISO timestamp of creation |
| ↳ `updatedAt` | string | ISO timestamp of last update |
+| ↳ `bookingUrl` | string | Public booking page URL for the event type |
+| ↳ `hidden` | boolean | Whether the event type is hidden from the profile |
+| ↳ `ownerId` | number | ID of the user who owns the event type |
@@ -553,6 +563,9 @@ Retrieve a list of all event types
| ↳ `disableGuests` | boolean | Whether guests are disabled |
| ↳ `createdAt` | string | ISO timestamp of creation |
| ↳ `updatedAt` | string | ISO timestamp of last update |
+| ↳ `bookingUrl` | string | Public booking page URL for the event type |
+| ↳ `hidden` | boolean | Whether the event type is hidden from the profile |
+| ↳ `ownerId` | number | ID of the user who owns the event type |
@@ -597,6 +610,9 @@ Update an existing event type in Cal.com
| ↳ `disableGuests` | boolean | Whether guests are disabled |
| ↳ `createdAt` | string | ISO timestamp of creation |
| ↳ `updatedAt` | string | ISO timestamp of last update |
+| ↳ `bookingUrl` | string | Public booking page URL for the event type |
+| ↳ `hidden` | boolean | Whether the event type is hidden from the profile |
+| ↳ `ownerId` | number | ID of the user who owns the event type |
diff --git a/apps/docs/content/docs/integrations/calendly.mdx b/apps/docs/content/docs/integrations/calendly.mdx
index 1b257c6091d..bdd8e9efefd 100644
--- a/apps/docs/content/docs/integrations/calendly.mdx
+++ b/apps/docs/content/docs/integrations/calendly.mdx
@@ -17,7 +17,7 @@ Webhook subscriptions require a paid plan and the permissions for their user or
## Use the block [#usage-instructions]
-Manage event types, scheduled events, invitees, and webhooks. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted).
+Manage event types, scheduled events, invitees, bookings, availability, and routing forms. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted).
## Actions
@@ -93,12 +93,12 @@ Retrieve a list of all event types for a user or organization
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `user` | string | No | Return only event types that belong to this user. Format: URI \(e.g., "https://api.calendly.com/users/abc123-def456") |
-| `organization` | string | No | Return only event types that belong to this organization. Format: URI \(e.g., "https://api.calendly.com/organizations/abc123-def456") |
+| `user` | string | No | Return event types available to this user. Either user or organization is required. Format: URI \(e.g., "https://api.calendly.com/users/abc123-def456") |
+| `organization` | string | No | Return event types that belong to this organization. Either user or organization is required. Format: URI \(e.g., "https://api.calendly.com/organizations/abc123-def456") |
| `count` | number | No | Number of results per page. Format: integer \(default: 20, max: 100\) |
| `pageToken` | string | No | Page token for pagination. Format: opaque string from previous response next_page_token |
| `sort` | string | No | Sort order for results. Format: "field:direction" \(e.g., "name:asc", "name:desc"\) |
-| `active` | boolean | No | When true, show only active event types. When false or unchecked, show all event types \(both active and inactive\). |
+| `active` | boolean | No | When true, return only active event types. When false, return only inactive event types. When omitted, return all event types. |
#### Output
@@ -416,6 +416,8 @@ Book a meeting by creating an invitee on an event type at a chosen time. Require
| `inviteeLastName` | string | No | Last name of the invitee |
| `textReminderNumber` | string | No | Phone number for SMS reminders. Format: E.164 phone number \(e.g., "+14155551234"\) |
| `eventGuests` | json | No | Additional guests to copy on the invite. Format: array of email strings \(max 10, e.g., \["guest@example.com"\]\) |
+| `location` | json | No | Meeting location. Must match a location configured on the event type; omit for round robin event types. Format: object with "kind" \(physical, inbound_call, outbound_call, zoom_conference, google_conference, gotomeeting_conference, microsoft_teams_conference, webex_conference, ask_invitee, custom\) and, for physical, outbound_call, ask_invitee and custom, a "location" string \(e.g., \{"kind": "outbound_call", "location": "+14155551234"\}\) |
+| `questionsAndAnswers` | json | No | Answers to the event type's booking questions. Required questions must be answered, and each question must match the event type's question text exactly. Format: array of objects with "question", "answer" and "position" \(e.g., \[\{"question": "Company", "answer": "Acme", "position": 0\}\]\) |
#### Output
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/discord.mdx b/apps/docs/content/docs/integrations/discord.mdx
index d63441d0f7a..4fa9fa03acf 100644
--- a/apps/docs/content/docs/integrations/discord.mdx
+++ b/apps/docs/content/docs/integrations/discord.mdx
@@ -40,14 +40,14 @@ Send a message to a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to send the message to, e.g., 123456789012345678 |
| `content` | string | No | The text content of the message |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
| `files` | file[] | No | Files to attach to the message |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `message` | string | Success or error message |
+| `message` | string | Content of the sent message |
| `files` | file[] | Files attached to the message |
| `data` | object | Discord message data |
| ↳ `id` | string | Message ID |
@@ -80,6 +80,9 @@ Retrieve messages from a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to retrieve messages from, e.g., 123456789012345678 |
| `limit` | number | No | Maximum number of messages to retrieve \(default: 10, max: 100\) |
+| `before` | string | No | Return messages before this message ID, to page back through history. Use only one of before, after, or around. |
+| `after` | string | No | Return messages after this message ID, e.g. to read only messages newer than the last one seen |
+| `around` | string | No | Return messages around this message ID |
#### Output
@@ -157,11 +160,12 @@ Retrieve information about a Discord user
| ↳ `id` | string | User ID |
| ↳ `username` | string | Username |
| ↳ `discriminator` | string | User discriminator \(4-digit number\) |
+| ↳ `global_name` | string | User display name, if set |
| ↳ `avatar` | string | User avatar hash |
| ↳ `bot` | boolean | Whether user is a bot |
| ↳ `system` | boolean | Whether user is a system user |
-| ↳ `email` | string | User email \(if available\) |
-| ↳ `verified` | boolean | Whether user email is verified |
+| ↳ `email` | string | User email. Not returned for a user looked up by ID |
+| ↳ `verified` | boolean | Whether the user email is verified. Not returned for a user looked up by ID |
@@ -178,7 +182,7 @@ Edit an existing message in a Discord channel
| `channelId` | string | Yes | The Discord channel ID containing the message, e.g., 123456789012345678 |
| `messageId` | string | Yes | The ID of the message to edit, e.g., 123456789012345678 |
| `content` | string | No | The new text content for the message |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -205,7 +209,7 @@ Delete a message from a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID containing the message, e.g., 123456789012345678 |
| `messageId` | string | Yes | The ID of the message to delete, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -227,7 +231,7 @@ Delete 2-100 messages from a Discord channel in a single request
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to delete messages from, e.g., 123456789012345678 |
| `messageIds` | json | Yes | Array of 2-100 message IDs to delete. Messages older than 2 weeks cannot be bulk deleted. |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -250,7 +254,7 @@ Add a reaction emoji to a Discord message
| `channelId` | string | Yes | The Discord channel ID containing the message, e.g., 123456789012345678 |
| `messageId` | string | Yes | The ID of the message to react to, e.g., 123456789012345678 |
| `emoji` | string | Yes | The emoji to react with \(unicode emoji or custom emoji in name:id format\) |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -274,7 +278,7 @@ Remove a reaction from a Discord message
| `messageId` | string | Yes | The ID of the message with the reaction, e.g., 123456789012345678 |
| `emoji` | string | Yes | The emoji to remove \(unicode emoji or custom emoji in name:id format\) |
| `userId` | string | No | The user ID whose reaction to remove \(omit to remove bot's own reaction\), e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -296,7 +300,7 @@ Pin a message in a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID containing the message, e.g., 123456789012345678 |
| `messageId` | string | Yes | The ID of the message to pin, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -318,7 +322,7 @@ Unpin a message in a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID containing the message, e.g., 123456789012345678 |
| `messageId` | string | Yes | The ID of the message to unpin, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -375,7 +379,7 @@ Create a thread in a Discord channel
| `messageId` | string | No | The message ID to create a thread from \(if creating from existing message\), e.g., 123456789012345678 |
| `autoArchiveDuration` | number | No | Duration in minutes to auto-archive the thread \(60, 1440, 4320, 10080\) |
| `isPublic` | boolean | No | Whether the standalone thread is public \(visible to everyone in the channel\) or private. Ignored when creating a thread from an existing message, which always inherits the parent channel visibility. Defaults to public if omitted. |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -402,7 +406,7 @@ Join a thread in Discord
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `threadId` | string | Yes | The thread ID to join, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -423,7 +427,7 @@ Leave a thread in Discord
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `threadId` | string | Yes | The thread ID to leave, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -445,7 +449,7 @@ Archive or unarchive a thread in Discord
| --------- | ---- | -------- | ----------- |
| `threadId` | string | Yes | The thread ID to archive/unarchive, e.g., 123456789012345678 |
| `archived` | boolean | Yes | Whether to archive \(true\) or unarchive \(false\) the thread |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -470,8 +474,8 @@ Create a new channel in a Discord server
| --------- | ---- | -------- | ----------- |
| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
| `name` | string | Yes | The name of the channel \(1-100 characters\) |
-| `type` | number | No | Channel type \(0=text, 2=voice, 4=category, 5=announcement, 13=stage\) |
-| `topic` | string | No | Channel topic \(0-1024 characters\) |
+| `type` | number | No | Channel type \(0=text, 2=voice, 4=category, 5=announcement, 13=stage, 15=forum\) |
+| `topic` | string | No | Channel topic \(up to 1024 characters for text channels, 4096 for forum channels\) |
| `parentId` | string | No | Parent category ID for the channel, e.g., 123456789012345678 |
#### Output
@@ -500,7 +504,7 @@ Update a Discord channel
| `channelId` | string | Yes | The Discord channel ID to update, e.g., 123456789012345678 |
| `name` | string | No | The new name for the channel |
| `topic` | string | No | The new topic for the channel |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -526,7 +530,7 @@ Delete a Discord channel
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to delete, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -552,7 +556,7 @@ Get information about a Discord channel
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to retrieve, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -884,7 +888,7 @@ Create an invite link for a Discord channel
| `maxAge` | number | No | Duration of invite in seconds \(0 = never expires, default 86400\) |
| `maxUses` | number | No | Max number of uses \(0 = unlimited, default 0\) |
| `temporary` | boolean | No | Whether invite grants temporary membership |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -911,7 +915,7 @@ Get information about a Discord invite
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `inviteCode` | string | Yes | The invite code to retrieve |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -938,7 +942,7 @@ Delete a Discord invite
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `inviteCode` | string | Yes | The invite code to delete |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -960,7 +964,7 @@ Create a webhook in a Discord channel
| --------- | ---- | -------- | ----------- |
| `channelId` | string | Yes | The Discord channel ID to create the webhook in, e.g., 123456789012345678 |
| `name` | string | Yes | Name of the webhook \(1-80 characters\) |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -990,7 +994,7 @@ Execute a Discord webhook to send a message
| `webhookToken` | string | Yes | The webhook token |
| `content` | string | Yes | The message content to send |
| `username` | string | No | Override the default username of the webhook |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -1016,7 +1020,7 @@ Get information about a Discord webhook
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhookId` | string | Yes | The webhook ID to retrieve, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
@@ -1043,7 +1047,7 @@ Delete a Discord webhook
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhookId` | string | Yes | The webhook ID to delete, e.g., 123456789012345678 |
-| `serverId` | string | Yes | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
+| `serverId` | string | No | The Discord server ID \(guild ID\), e.g., 123456789012345678 |
#### Output
diff --git a/apps/docs/content/docs/integrations/github.mdx b/apps/docs/content/docs/integrations/github.mdx
index 6d53cce14ca..9be5babec1a 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
@@ -208,6 +210,8 @@ Retrieve the latest commit from a GitHub repository
| Parameter | Type | Description |
| --------- | ---- | ----------- |
+| `sha` | string | Commit SHA |
+| `html_url` | string | GitHub web URL |
| `commit` | object | Core commit data |
| ↳ `url` | string | Commit API URL |
| ↳ `message` | string | Commit message |
@@ -246,8 +250,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 |
@@ -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. Omit both page and per_page to get up to 250 commits in one response. |
#### 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..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, 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 name, summary, severity_id, incident_type_id, and incident_status_id.
@@ -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..6a538b56b57 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\) |
@@ -1613,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).
@@ -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 |
@@ -2432,7 +2455,7 @@ Update a project status in Linear
### Linear Delete 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/mailgun.mdx b/apps/docs/content/docs/integrations/mailgun.mdx
index fb9d98f75e3..199f747e4fa 100644
--- a/apps/docs/content/docs/integrations/mailgun.mdx
+++ b/apps/docs/content/docs/integrations/mailgun.mdx
@@ -94,7 +94,7 @@ List events (logs) for messages sent through Mailgun
| --------- | ---- | -------- | ----------- |
| `domain` | string | Yes | Mailgun domain for listing events \(e.g., mg.example.com\) |
| `event` | string | No | Filter by event type \(accepted, delivered, failed, opened, clicked, etc.\) |
-| `limit` | number | No | Maximum number of events to return \(default: 100\) |
+| `limit` | number | No | Maximum number of events to return \(default: 100, max: 300\) |
#### Output
diff --git a/apps/docs/content/docs/integrations/okta.mdx b/apps/docs/content/docs/integrations/okta.mdx
index d5d2eeec9be..74d1372bac0 100644
--- a/apps/docs/content/docs/integrations/okta.mdx
+++ b/apps/docs/content/docs/integrations/okta.mdx
@@ -268,6 +268,28 @@ Unsuspend a previously suspended user in your Okta organization. Returns the use
+### Unlock User in Okta
+
+Unlock a LOCKED_OUT user, or an ACTIVE user blocked from unknown devices, so they can sign in with their current password. Works only for Okta-sourced users, not directory-sourced accounts such as Active Directory.
+
+
+
+#### Input
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `userId` | string | Yes | User ID or login to unlock |
+
+#### Output
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| `userId` | string | Unlocked user ID |
+| `unlocked` | boolean | Whether the user was unlocked |
+| `success` | boolean | Operation success status |
+
+
+
### Reset Password in Okta
Generate a one-time token to reset a user password. Can email the reset link to the user or return it directly. Transitions the user to RECOVERY status.
@@ -542,6 +564,39 @@ List all members of a specific group in your Okta organization
+### List User Groups from Okta
+
+List the groups a user is a member of, one page at a time (pass nextCursor back as after while hasMore is true). Use it for access reviews and offboarding instead of scanning the members of each group.
+
+
+
+#### Input
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `userId` | string | Yes | User ID or login whose groups to list |
+| `after` | string | No | Opaque pagination cursor returned as nextCursor by a previous call |
+| `limit` | number | No | Maximum number of groups to return per page \(Okta default: 200\) |
+
+#### Output
+
+| Parameter | Type | Description |
+| --------- | ---- | ----------- |
+| `groups` | array | Array of groups the user belongs to |
+| ↳ `id` | string | Group ID |
+| ↳ `name` | string | Group name |
+| ↳ `description` | string | Group description |
+| ↳ `type` | string | Group type \(OKTA_GROUP, APP_GROUP, BUILT_IN\) |
+| ↳ `created` | string | Creation timestamp |
+| ↳ `lastUpdated` | string | Last update timestamp |
+| ↳ `lastMembershipUpdated` | string | Last membership change timestamp |
+| `count` | number | Number of groups returned |
+| `nextCursor` | string | Cursor for the next page, or null on the last page |
+| `hasMore` | boolean | Whether more groups are available |
+| `success` | boolean | Operation success status |
+
+
+
### List Group Rules from Okta
List the group rules in your Okta organization. Each rule assigns users to groups automatically based on an expression over their profile, so this shows how group membership is being driven.
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/resend.mdx b/apps/docs/content/docs/integrations/resend.mdx
index cefddb4d4b3..72f5929cb7a 100644
--- a/apps/docs/content/docs/integrations/resend.mdx
+++ b/apps/docs/content/docs/integrations/resend.mdx
@@ -141,6 +141,8 @@ List all contacts in Resend
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
+| `limit` | number | No | Number of contacts to return, 1 to 100 \(Resend defaults to 20\) |
+| `after` | string | No | Pagination cursor: the ID of the last contact from the previous page, to fetch the next page |
#### Output
@@ -315,7 +317,7 @@ Delete an audience from Resend by ID
### Create Broadcast
-Create a broadcast email for an audience in Resend
+Create a broadcast email for a segment (or legacy audience) in Resend
@@ -323,7 +325,8 @@ Create a broadcast email for an audience in Resend
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `audienceId` | string | Yes | The ID of the audience to send the broadcast to |
+| `segmentId` | string | No | The ID of the segment to send the broadcast to. Provide this or audienceId; segmentId takes precedence |
+| `audienceId` | string | No | Deprecated by Resend in favor of segmentId: the ID of the audience to send the broadcast to |
| `broadcastFrom` | string | Yes | Sender email address \(e.g., "sender@example.com" or "Sender Name <sender@example.com>"\) |
| `broadcastSubject` | string | Yes | Broadcast email subject line |
| `broadcastHtml` | string | No | HTML content of the broadcast |
@@ -383,7 +386,7 @@ Retrieve details of a broadcast by ID
| `segmentId` | string | Segment ID \(the current recipient field\) |
| `from` | string | Sender email address |
| `subject` | string | Broadcast subject |
-| `replyTo` | string | Reply-to email address |
+| `replyTo` | array | Reply-to email addresses |
| `previewText` | string | Inbox preview text |
| `status` | string | Broadcast status \(e.g., draft, sent\) |
| `createdAt` | string | Broadcast creation timestamp |
@@ -402,6 +405,8 @@ List all verified domains in your Resend account
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
+| `limit` | number | No | Number of domains to return, 1 to 100 \(Resend defaults to 20\) |
+| `after` | string | No | Pagination cursor: the ID of the last domain from the previous page, to fetch the next page |
#### Output
diff --git a/apps/docs/content/docs/integrations/rippling.mdx b/apps/docs/content/docs/integrations/rippling.mdx
index 39e4bc686b4..09414f62e7a 100644
--- a/apps/docs/content/docs/integrations/rippling.mdx
+++ b/apps/docs/content/docs/integrations/rippling.mdx
@@ -31,14 +31,29 @@ List all workers with optional filtering and pagination
| --------- | ---- | -------- | ----------- |
| `filter` | string | No | Filter expression |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `workers` | array | List of workers |
+| ↳ `job_function_id` | string | Job function ID |
+| ↳ `pay_schedule_id` | string | Pay schedule ID |
+| ↳ `original_start_date` | string | Original start date |
+| ↳ `work_schedule` | json | Work schedule |
+| ↳ `compensation_grade` | json | Compensation grade |
+| ↳ `user` | json | Expanded user \(expand=user\) |
+| ↳ `manager` | json | Expanded manager \(expand=manager\) |
+| ↳ `legal_entity` | json | Expanded legal entity \(expand=legal_entity\) |
+| ↳ `employment_type` | json | Expanded employment type \(expand=employment_type\) |
+| ↳ `compensation` | json | Expanded compensation \(expand=compensation\) |
+| ↳ `department` | json | Expanded department \(expand=department\) |
+| ↳ `teams` | json | Expanded teams, when requested via expand |
+| ↳ `level` | json | Expanded level, when requested via expand |
+| ↳ `job_function` | json | Expanded job function, when requested via expand |
+| ↳ `business_partners` | json | Expanded business partners, when requested via expand |
| ↳ `id` | string | Worker ID |
| ↳ `created_at` | string | Record creation date |
| ↳ `updated_at` | string | Record update date |
@@ -73,6 +88,7 @@ List all workers with optional filtering and pagination
| ↳ `country_fields` | json | Country-specific fields |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -126,6 +142,21 @@ Get a specific worker by ID
| `termination_details` | json | Termination details |
| `custom_fields` | json | Custom fields |
| `country_fields` | json | Country-specific fields |
+| `job_function_id` | string | Job function ID |
+| `pay_schedule_id` | string | Pay schedule ID |
+| `original_start_date` | string | Original start date |
+| `work_schedule` | json | Work schedule |
+| `compensation_grade` | json | Compensation grade |
+| `user` | json | Expanded user \(expand=user\) |
+| `manager` | json | Expanded manager \(expand=manager\) |
+| `legal_entity` | json | Expanded legal entity \(expand=legal_entity\) |
+| `employment_type` | json | Expanded employment type \(expand=employment_type\) |
+| `compensation` | json | Expanded compensation \(expand=compensation\) |
+| `department` | json | Expanded department \(expand=department\) |
+| `teams` | json | Expanded teams, when requested via expand |
+| `level` | json | Expanded level, when requested via expand |
+| `job_function` | json | Expanded job function, when requested via expand |
+| `business_partners` | json | Expanded business partners, when requested via expand |
| `__meta` | json | Metadata including redacted_fields |
@@ -140,8 +171,8 @@ List all users with optional pagination
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -165,6 +196,7 @@ List all users with optional pagination
| ↳ `photos` | json | Array of photo objects |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -215,8 +247,8 @@ List all companies
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -234,8 +266,11 @@ List all companies
| ↳ `parent_legal_entity_id` | string | Parent legal entity ID |
| ↳ `legal_entities_id` | json | Array of legal entity IDs |
| ↳ `physical_address` | json | Physical address of the holding entity |
+| ↳ `parent_legal_entity` | json | Expanded parent legal entity \(expand=parent_legal_entity\) |
+| ↳ `legal_entities` | json | Expanded legal entities \(expand=legal_entities\) |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -301,8 +336,8 @@ List all departments
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -320,6 +355,7 @@ List all departments
| ↳ `department_hierarchy` | json | Expanded department hierarchy |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -426,8 +462,8 @@ List all teams
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -442,6 +478,7 @@ List all teams
| ↳ `parent` | json | Expanded parent team |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -483,8 +520,8 @@ List all employment types
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -501,6 +538,7 @@ List all employment types
| ↳ `amount_worked` | string | Amount worked \(PART-TIME, FULL-TIME, TEMPORARY\) |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -543,8 +581,8 @@ List all titles
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -557,6 +595,7 @@ List all titles
| ↳ `name` | string | Title name |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -662,8 +701,8 @@ List all custom fields
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -677,8 +716,10 @@ List all custom fields
| ↳ `description` | string | Field description |
| ↳ `required` | boolean | Whether the field is required |
| ↳ `type` | string | Field type \(TEXT, DATE, NUMBER, CURRENCY, etc.\) |
+| ↳ `options` | json | Choice values for SELECT and RADIO fields \(null for other types\) |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -693,8 +734,8 @@ List all job functions
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -707,6 +748,7 @@ List all job functions
| ↳ `name` | string | Job function name |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -745,8 +787,8 @@ List all work locations
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -760,6 +802,7 @@ List all work locations
| ↳ `address` | json | Address object |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -882,14 +925,17 @@ List all business partners
| --------- | ---- | -------- | ----------- |
| `filter` | string | No | Filter expression |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `businessPartners` | array | List of businessPartners |
+| ↳ `business_partner_group` | json | Expanded business partner group \(expand=business_partner_group\) |
+| ↳ `worker` | json | Expanded worker \(expand=worker\) |
+| ↳ `client_group` | json | Expanded client group \(expand=client_group\) |
| ↳ `id` | string | Business partner ID |
| ↳ `created_at` | string | Record creation date |
| ↳ `updated_at` | string | Record update date |
@@ -899,6 +945,7 @@ List all business partners
| ↳ `client_group_member_count` | number | Client group member count |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -927,6 +974,9 @@ Get a specific business partner by ID
| `worker_id` | string | Worker ID |
| `client_group_id` | string | Client group ID |
| `client_group_member_count` | number | Client group member count |
+| `business_partner_group` | json | Expanded business partner group \(expand=business_partner_group\) |
+| `worker` | json | Expanded worker \(expand=worker\) |
+| `client_group` | json | Expanded client group \(expand=client_group\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -989,14 +1039,15 @@ List all business partner groups
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `expand` | string | No | Comma-separated fields to expand |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `businessPartnerGroups` | array | List of businessPartnerGroups |
+| ↳ `default_business_partner` | json | Expanded default business partner \(expand=default_business_partner\) |
| ↳ `id` | string | Business partner group ID |
| ↳ `created_at` | string | Record creation date |
| ↳ `updated_at` | string | Record update date |
@@ -1005,6 +1056,7 @@ List all business partner groups
| ↳ `default_business_partner_id` | string | Default business partner ID |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1032,6 +1084,7 @@ Get a specific business partner group by ID
| `name` | string | Name |
| `domain` | string | Domain |
| `default_business_partner_id` | string | Default partner ID |
+| `default_business_partner` | json | Expanded default business partner \(expand=default_business_partner\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1094,7 +1147,8 @@ List all supergroups
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `filter` | string | No | Filter expression \(filterable fields: app_owner_id, group_type\) |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1122,6 +1176,7 @@ List all supergroups
| ↳ `ignore_prov_group_matching` | boolean | Whether to ignore provisioning group matching |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1177,7 +1232,8 @@ List members of a supergroup
| --------- | ---- | -------- | ----------- |
| `groupId` | string | Yes | Supergroup ID |
| `expand` | string | No | Fields to expand \(e.g., worker\) |
-| `orderBy` | string | No | Sort field |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1193,6 +1249,7 @@ List members of a supergroup
| ↳ `worker` | json | Expanded worker object |
| `totalCount` | number | Number of members returned |
| `nextLink` | string | Next page link |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1209,7 +1266,8 @@ List inclusion members of a supergroup
| --------- | ---- | -------- | ----------- |
| `groupId` | string | Yes | Supergroup ID |
| `expand` | string | No | Fields to expand \(e.g., worker\) |
-| `orderBy` | string | No | Sort field |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1225,6 +1283,7 @@ List inclusion members of a supergroup
| ↳ `worker` | json | Expanded worker object |
| `totalCount` | number | Number of members returned |
| `nextLink` | string | Next page link |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1241,7 +1300,8 @@ List exclusion members of a supergroup
| --------- | ---- | -------- | ----------- |
| `groupId` | string | Yes | Supergroup ID |
| `expand` | string | No | Fields to expand \(e.g., worker\) |
-| `orderBy` | string | No | Sort field |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1257,6 +1317,7 @@ List exclusion members of a supergroup
| ↳ `worker` | json | Expanded worker object |
| `totalCount` | number | Number of members returned |
| `nextLink` | string | Next page link |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -1313,6 +1374,7 @@ List all custom objects
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1333,6 +1395,7 @@ List all custom objects
| ↳ `enable_history` | boolean | Whether history is enabled |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
@@ -1467,6 +1530,7 @@ List all fields for a custom object
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1488,6 +1552,7 @@ List all fields for a custom object
| ↳ `managed_package_install_id` | string | Package install ID |
| `totalCount` | number | Number of fields returned |
| `nextLink` | string | Next page link |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
@@ -1643,6 +1708,7 @@ List all records for a custom object
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -1661,6 +1727,7 @@ List all records for a custom object
| ↳ `data` | json | Full record data including dynamic fields |
| `totalCount` | number | Number of records returned |
| `nextLink` | string | Next page link |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
@@ -1737,7 +1804,9 @@ Query custom object records with filters
| `customObjectApiName` | string | Yes | Custom object API name |
| `query` | string | No | Query expression |
| `limit` | number | No | Maximum number of records to return |
-| `cursor` | string | No | Pagination cursor |
+| `search` | string | No | Search record names or owners \(token/prefix match\); ANDed with query |
+| `orderBy` | string | No | One field API name with optional asc or desc, e.g. name desc |
+| `cursor` | string | No | Pagination cursor: the cursor output of the previous page |
#### Output
@@ -1771,7 +1840,7 @@ Create a custom object record
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
| `externalId` | string | No | External ID for the record |
-| `data` | json | Yes | Record data |
+| `data` | json | Yes | Field values keyed by field API name \(e.g. \{"name": "License 4", "status__c": "ACTIVE"\}\) |
#### Output
@@ -1803,7 +1872,7 @@ Update a custom object record
| `customObjectApiName` | string | Yes | Custom object API name |
| `codrId` | string | Yes | Record ID |
| `externalId` | string | No | External ID for the record |
-| `data` | json | No | Updated record data |
+| `data` | json | No | Field values to set, keyed by field API name \(e.g. \{"status__c": "FINAL"\}\) |
#### Output
@@ -1854,7 +1923,7 @@ Bulk create custom object records
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
-| `rowsToWrite` | json | Yes | Array of records to create \[\{external_id?, data\}\] |
+| `rowsToWrite` | json | Yes | Array of flat records \[\{external_id?, <field_api_name>: value\}\] \(max 200\) |
| `allOrNothing` | boolean | No | If true, fail entire batch on any error |
#### Output
@@ -1877,7 +1946,7 @@ Bulk update custom object records
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
-| `rowsToUpdate` | json | Yes | Array of records to update |
+| `rowsToUpdate` | json | Yes | Array of flat records \[\{id, <field_api_name>: value\}\] \(max 200\) |
| `allOrNothing` | boolean | No | If true, fail entire batch on any error |
#### Output
@@ -1900,14 +1969,15 @@ Bulk delete custom object records
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `customObjectApiName` | string | Yes | Custom object API name |
-| `rowsToDelete` | json | Yes | Array of records to delete |
+| `rowsToDelete` | json | Yes | Array of record ID strings to delete \(max 200\) |
| `allOrNothing` | boolean | No | If true, fail entire batch on any error |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `deleted` | boolean | Whether the bulk delete succeeded |
+| `deleted` | boolean | Whether the bulk delete request succeeded |
+| `deletedRecordIds` | array | IDs whose deletion was applied; may be partial or empty when records fail or await approval |
@@ -2195,8 +2265,8 @@ List all custom settings
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `orderBy` | string | No | Sort field. Prefix with - for descending |
-| `cursor` | string | No | Pagination cursor from previous response |
+| `orderBy` | string | No | Sort field\(s\), comma-separated; append " desc" for descending \(e.g. created_at desc\) |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -2209,12 +2279,13 @@ List all custom settings
| ↳ `display_name` | string | Display name |
| ↳ `api_name` | string | API name |
| ↳ `data_type` | string | Data type |
-| ↳ `secret_value` | string | Secret value |
+| ↳ `secret_value` | string | Always null: Rippling never returns secret values |
| ↳ `string_value` | string | String value |
| ↳ `number_value` | number | Number value |
| ↳ `boolean_value` | boolean | Boolean value |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
| `__meta` | json | Metadata including redacted_fields |
@@ -2229,7 +2300,7 @@ Get a specific custom setting
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `id` | string | Yes | Resource ID |
+| `id` | string | Yes | Custom setting API name \(api_name\) |
#### Output
@@ -2241,7 +2312,7 @@ Get a specific custom setting
| `display_name` | string | Display name |
| `api_name` | string | API name |
| `data_type` | string | Data type |
-| `secret_value` | string | Secret value |
+| `secret_value` | string | Always null: Rippling never returns secret values |
| `string_value` | string | String value |
| `number_value` | number | Number value |
| `boolean_value` | boolean | Boolean value |
@@ -2277,7 +2348,7 @@ Create a new custom setting
| `display_name` | string | Display name |
| `api_name` | string | API name |
| `data_type` | string | Data type |
-| `secret_value` | string | Secret value |
+| `secret_value` | string | Always null: Rippling never returns secret values |
| `string_value` | string | String value |
| `number_value` | number | Number value |
| `boolean_value` | boolean | Boolean value |
@@ -2294,7 +2365,7 @@ Update a custom setting
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `id` | string | Yes | Setting ID |
+| `id` | string | Yes | Custom setting API name \(api_name\) |
| `displayName` | string | No | Display name |
| `apiName` | string | No | Unique API name |
| `dataType` | string | No | Data type of the setting |
@@ -2313,7 +2384,7 @@ Update a custom setting
| `display_name` | string | Display name |
| `api_name` | string | API name |
| `data_type` | string | Data type |
-| `secret_value` | string | Secret value |
+| `secret_value` | string | Always null: Rippling never returns secret values |
| `string_value` | string | String value |
| `number_value` | number | Number value |
| `boolean_value` | boolean | Boolean value |
@@ -2330,7 +2401,7 @@ Delete a custom setting
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `id` | string | Yes | ID of the resource to delete |
+| `id` | string | Yes | Custom setting API name \(api_name\) to delete |
#### Output
@@ -2350,6 +2421,7 @@ List all object categories
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
+| `cursor` | string | No | Pagination cursor: the nextCursor output of the previous page |
#### Output
@@ -2363,6 +2435,7 @@ List all object categories
| ↳ `description` | string | Description |
| `totalCount` | number | Number of items returned |
| `nextLink` | string | Link to next page of results |
+| `nextCursor` | string | Cursor for the next page; pass it back as the cursor param \(null on the last page\) |
diff --git a/apps/docs/content/docs/integrations/sendgrid.mdx b/apps/docs/content/docs/integrations/sendgrid.mdx
index 869ebd7997b..3114b13c0d1 100644
--- a/apps/docs/content/docs/integrations/sendgrid.mdx
+++ b/apps/docs/content/docs/integrations/sendgrid.mdx
@@ -331,7 +331,7 @@ Get a specific template by ID from SendGrid
### SendGrid List Templates
-Get all email templates from SendGrid
+List email templates from SendGrid. Returns legacy templates only unless generations includes dynamic
@@ -339,7 +339,7 @@ Get all email templates from SendGrid
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `generations` | string | No | Filter by generation \(legacy, dynamic, or both\) |
+| `generations` | string | No | Template generations to return: legacy, dynamic, or legacy,dynamic \(default when omitted: legacy only\) |
| `pageSize` | number | No | Number of templates to return per page \(default: 20, max: 200\). When paginating with pageToken, pass the same pageSize used on the first request to keep page boundaries consistent. |
| `pageToken` | string | No | Page token from a previous response \(nextPageToken\) to fetch the next page |
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/shopify.mdx b/apps/docs/content/docs/integrations/shopify.mdx
index e110438e1f4..7d007722288 100644
--- a/apps/docs/content/docs/integrations/shopify.mdx
+++ b/apps/docs/content/docs/integrations/shopify.mdx
@@ -1388,7 +1388,7 @@ List inventory locations from your Shopify store. Use this to find location IDs
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `reverse` | boolean | No | Reverse the result sort order \(default false\) |
-| `sortKey` | string | No | Sort results by ID, NAME, RELEVANCE \(default Shopify ordering\) |
+| `sortKey` | string | No | Sort results by CREATED_AT, ID, NAME, RELEVANCE \(default Shopify ordering\) |
| `query` | string | No | Shopify location search query, e.g. name:Warehouse |
| `includeLegacy` | boolean | No | Include legacy fulfillment-service locations \(default false\) |
| `shopDomain` | string | No | Your Shopify store domain \(e.g., mystore.myshopify.com\) |
diff --git a/apps/docs/content/docs/integrations/slack.mdx b/apps/docs/content/docs/integrations/slack.mdx
index ee31effedea..a7260e75879 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. |
+| `channel_ids` | json | No | One Slack channel ID to remove, as \["C123"\] or C123. |
#### 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/apps/docs/content/docs/integrations/snowflake.mdx b/apps/docs/content/docs/integrations/snowflake.mdx
index fbbbde187e7..bbb8877af4f 100644
--- a/apps/docs/content/docs/integrations/snowflake.mdx
+++ b/apps/docs/content/docs/integrations/snowflake.mdx
@@ -72,7 +72,7 @@ Execute one parameterized SQL statement through the Snowflake SQL API.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -117,7 +117,7 @@ Check a running or completed statement and retrieve exactly one result partition
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -160,7 +160,7 @@ Cancel a running Snowflake SQL API statement.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -209,7 +209,7 @@ Insert structured JSON rows using bound values.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -259,7 +259,7 @@ Update matching rows with a bound MERGE statement without inserting new rows.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -309,7 +309,7 @@ Update matching rows and insert unmatched rows with a bound MERGE statement.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -358,7 +358,7 @@ Delete rows matching a required set of bound column filters.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -414,7 +414,7 @@ Load files from an existing Snowflake stage with COPY INTO.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -469,7 +469,7 @@ Export a Snowflake table to files in a stage with COPY INTO.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -515,7 +515,7 @@ List the databases the credential can access.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -562,7 +562,7 @@ List the schemas in a Snowflake database.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -610,7 +610,7 @@ List the tables in a Snowflake schema.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -656,7 +656,7 @@ List warehouses visible to the active Snowflake role.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -701,7 +701,7 @@ Get the full details for a Snowflake virtual warehouse.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -746,7 +746,7 @@ Resume a Snowflake virtual warehouse if it is suspended.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -791,7 +791,7 @@ Suspend a Snowflake virtual warehouse.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -839,7 +839,7 @@ Resize a Snowflake warehouse or change its auto-suspend and auto-resume settings
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -887,7 +887,7 @@ List tasks in a Snowflake schema.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -934,7 +934,7 @@ Describe a Snowflake task.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -982,7 +982,7 @@ Run a Snowflake task immediately, optionally retrying its last failed graph.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1029,7 +1029,7 @@ Resume a suspended Snowflake task so its schedule runs again.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1076,7 +1076,7 @@ Suspend a Snowflake task so its schedule stops triggering runs.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1126,7 +1126,7 @@ Query up to seven days of Snowflake task history, capped at 10000 rows.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1175,7 +1175,7 @@ Find one task history record by query ID within Snowflake’s seven-day window a
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1221,7 +1221,7 @@ Cancel one running task query by query ID with SYSTEM$CANCEL_QUERY. Task runs al
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1268,7 +1268,7 @@ Read a task query result with RESULT_SCAN during Snowflake’s 24-hour retention
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1280,7 +1280,7 @@ Read a task query result with RESULT_SCAN during Snowflake’s 24-hour retention
### Snowflake List Query History
-List queries that completed in the last seven days, optionally filtered.
+List queries from the last seven days, optionally filtered. Queries still running are included unless an end time is set.
@@ -1319,7 +1319,7 @@ List queries that completed in the last seven days, optionally filtered.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1370,7 +1370,7 @@ List staged-file load results for a table over the last fourteen days.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1420,7 +1420,7 @@ Inspect table and column metadata through Snowflake INFORMATION_SCHEMA views.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1470,7 +1470,7 @@ Call a stored procedure with explicitly typed Snowflake bindings.
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
@@ -1546,7 +1546,7 @@ Ask Snowflake Cortex Analyst a question in natural language against a semantic v
| ↳ `currentPartition` | number | Zero-based partition returned |
| ↳ `partitionCount` | number | Total partitions in the result set. Snowflake reports this only on the first partition, so pass it back to Get Statement when fetching later partitions |
| ↳ `nextPartition` | number | Next partition to request with Get Statement, if one exists |
-| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
+| ↳ `truncated` | boolean | Whether more result partitions remain to fetch with Get Statement, or null when Snowflake returned a metadata-less partition response and partitionCount was not supplied. Also true, with nextPartition null, when Snowflake returned code 391908 \(result set too large to return in full\); narrow the query or lower the row limit instead of fetching more partitions. Snowflake does not report when the requested row limit capped the result set, so that cap is never reflected here |
| ↳ `dml` | object | Completed DML statistics, or null when the statement has no DML statistics |
| ↳ `rowsInserted` | number | Rows inserted by the statement |
| ↳ `rowsUpdated` | number | Rows updated by the statement |
diff --git a/apps/docs/content/docs/integrations/telegram.mdx b/apps/docs/content/docs/integrations/telegram.mdx
index 0701da3bf4f..25b20f19e5f 100644
--- a/apps/docs/content/docs/integrations/telegram.mdx
+++ b/apps/docs/content/docs/integrations/telegram.mdx
@@ -85,7 +85,7 @@ Delete messages in Telegram channels or chats through the Telegram Bot API. Requ
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `chatId` | string | Yes | Telegram chat ID \(numeric, can be negative for groups\) |
-| `messageId` | string | Yes | Telegram message ID \(numeric identifier of the message to delete\) |
+| `messageId` | number | Yes | Telegram message ID \(numeric identifier of the message to delete\) |
#### Output
@@ -119,16 +119,16 @@ Send photos to Telegram channels or users through the Telegram Bot API.
| `message` | string | Success or error message |
| `data` | object | Telegram message data including optional photo\(s\) |
| ↳ `message_id` | number | Unique Telegram message identifier |
-| ↳ `from` | object | Chat information |
-| ↳ `id` | number | Chat ID |
-| ↳ `is_bot` | boolean | Whether the chat is a bot or not |
-| ↳ `first_name` | string | Chat username \(if available\) |
-| ↳ `username` | string | Chat title \(for groups and channels\) |
-| ↳ `chat` | object | Information about the bot that sent the message |
-| ↳ `id` | number | Bot user ID |
-| ↳ `first_name` | string | Bot first name |
-| ↳ `username` | string | Bot username |
-| ↳ `type` | string | Chat type \(private, group, supergroup, channel\) |
+| ↳ `from` | object | Sender information |
+| ↳ `id` | number | Sender user ID |
+| ↳ `is_bot` | boolean | Whether the sender is a bot |
+| ↳ `first_name` | string | Sender first name |
+| ↳ `username` | string | Sender username, when available |
+| ↳ `chat` | object | Recipient chat information |
+| ↳ `id` | number | Recipient chat ID |
+| ↳ `first_name` | string | Chat first name, for private chats |
+| ↳ `username` | string | Chat username, when available |
+| ↳ `type` | string | Chat type: private, group, supergroup, or channel |
| ↳ `date` | number | Unix timestamp when message was sent |
| ↳ `text` | string | Text content of the sent message \(if applicable\) |
| ↳ `photo` | array | List of photos included in the message |
@@ -173,7 +173,22 @@ Send videos to Telegram channels or users through the Telegram Bot API.
| ↳ `type` | string | Type of chat \(private, group, supergroup, or channel\) |
| ↳ `date` | number | Unix timestamp when the message was sent |
| ↳ `text` | string | Text content of the sent message \(if applicable\) |
-| ↳ `format` | object | Media format information \(for videos, GIFs, etc.\) |
+| ↳ `video` | object | Video sent in the message |
+| ↳ `file_id` | string | Video file ID, reusable to resend the file |
+| ↳ `file_unique_id` | string | Unique video file identifier |
+| ↳ `width` | number | Video width in pixels |
+| ↳ `height` | number | Video height in pixels |
+| ↳ `duration` | number | Duration of the video in seconds |
+| ↳ `thumbnail` | object | Video thumbnail details |
+| ↳ `file_id` | string | Thumbnail file ID |
+| ↳ `file_unique_id` | string | Unique thumbnail file identifier |
+| ↳ `file_size` | number | Thumbnail file size in bytes |
+| ↳ `width` | number | Thumbnail width in pixels |
+| ↳ `height` | number | Thumbnail height in pixels |
+| ↳ `file_name` | string | Original video file name |
+| ↳ `mime_type` | string | Video MIME type |
+| ↳ `file_size` | number | Video file size in bytes |
+| ↳ `format` | object | Legacy key: Telegram returns no format object, so this is never populated. Read video instead. |
| ↳ `file_name` | string | Media file name |
| ↳ `mime_type` | string | Media MIME type |
| ↳ `duration` | number | Duration of media in seconds |
@@ -293,7 +308,22 @@ Send animations (GIFs) to Telegram channels or users through the Telegram Bot AP
| ↳ `type` | string | Type of chat \(private, group, supergroup, or channel\) |
| ↳ `date` | number | Unix timestamp when the message was sent |
| ↳ `text` | string | Text content of the sent message \(if applicable\) |
-| ↳ `format` | object | Media format information \(for videos, GIFs, etc.\) |
+| ↳ `animation` | object | Animation sent in the message |
+| ↳ `file_id` | string | Animation file ID, reusable to resend the file |
+| ↳ `file_unique_id` | string | Unique animation file identifier |
+| ↳ `width` | number | Animation width in pixels |
+| ↳ `height` | number | Animation height in pixels |
+| ↳ `duration` | number | Duration of the animation in seconds |
+| ↳ `thumbnail` | object | Animation thumbnail details |
+| ↳ `file_id` | string | Thumbnail file ID |
+| ↳ `file_unique_id` | string | Unique thumbnail file identifier |
+| ↳ `file_size` | number | Thumbnail file size in bytes |
+| ↳ `width` | number | Thumbnail width in pixels |
+| ↳ `height` | number | Thumbnail height in pixels |
+| ↳ `file_name` | string | Original animation file name |
+| ↳ `mime_type` | string | Animation MIME type |
+| ↳ `file_size` | number | Animation file size in bytes |
+| ↳ `format` | object | Legacy key: Telegram returns no format object, so this is never populated. Read animation instead. |
| ↳ `file_name` | string | Media file name |
| ↳ `mime_type` | string | Media MIME type |
| ↳ `duration` | number | Duration of media in seconds |
@@ -518,7 +548,7 @@ Send a native poll to a Telegram chat through the Telegram Bot API.
| --------- | ---- | -------- | ----------- |
| `chatId` | string | Yes | Telegram chat ID \(numeric, can be negative for groups\) |
| `question` | string | Yes | Poll question \(1-300 characters\) |
-| `options` | json | Yes | List of 2-10 answer options as text strings |
+| `options` | json | Yes | List of 1-12 answer options as text strings |
| `isAnonymous` | boolean | No | Whether the poll needs to be anonymous \(defaults to true\) |
| `allowsMultipleAnswers` | boolean | No | Whether the poll allows multiple answers |
diff --git a/apps/docs/content/docs/integrations/twilio_sms.mdx b/apps/docs/content/docs/integrations/twilio_sms.mdx
index ee940ea75b2..2014aa93ece 100644
--- a/apps/docs/content/docs/integrations/twilio_sms.mdx
+++ b/apps/docs/content/docs/integrations/twilio_sms.mdx
@@ -23,7 +23,7 @@ Send SMS messages.
### Twilio Send SMS
-Send text messages to single or multiple recipients using the Twilio API.
+Send a text message to one recipient using the Twilio API. Call once per recipient to reach several numbers.
@@ -31,9 +31,10 @@ Send text messages to single or multiple recipients using the Twilio API.
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `phoneNumbers` | string | Yes | Phone numbers to send the message to in E.164 format \(e.g., +15551234567\), separated by newlines |
+| `phoneNumbers` | string | Yes | Recipient phone number in E.164 format \(e.g., +15551234567\) or a channel address \(e.g., whatsapp:+15551234567\). Only the first line is used. |
| `message` | string | Yes | Message to send |
-| `fromNumber` | string | Yes | Twilio phone number to send the message from in E.164 format \(e.g., +15551234567\) |
+| `fromNumber` | string | No | Sender: a Twilio phone number in E.164 format \(e.g., +15551234567\), alphanumeric sender ID, short code, or channel address. Required unless a Messaging Service SID is given. |
+| `messagingServiceSid` | string | No | Messaging Service SID \(MG...\). When set without a From number, Twilio picks the sender from the service sender pool. |
#### Output
diff --git a/apps/docs/content/docs/integrations/twilio_voice.mdx b/apps/docs/content/docs/integrations/twilio_voice.mdx
index cc8d55d5ef8..acabacca60d 100644
--- a/apps/docs/content/docs/integrations/twilio_voice.mdx
+++ b/apps/docs/content/docs/integrations/twilio_voice.mdx
@@ -72,9 +72,10 @@ Retrieve a list of calls made to and from an account.
| `to` | string | No | Filter by calls to this phone number in E.164 format \(e.g., +14155551234\) |
| `from` | string | No | Filter by calls from this phone number in E.164 format \(e.g., +14155559876\) |
| `status` | string | No | Filter by call status \(e.g., queued, ringing, in-progress, completed, busy, failed, no-answer, canceled\) |
-| `startTimeAfter` | string | No | Filter calls that started on or after this date \(YYYY-MM-DD\) |
-| `startTimeBefore` | string | No | Filter calls that started on or before this date \(YYYY-MM-DD\) |
+| `startTimeAfter` | string | No | Filter calls that started on or after this date \(YYYY-MM-DD, UTC; inclusive\) |
+| `startTimeBefore` | string | No | Filter calls that started before this date \(YYYY-MM-DD, UTC; exclusive\) |
| `pageSize` | number | No | Number of records to return \(max 1000, default 50\) |
+| `pageToken` | string | No | Page token from a previous result \(nextPageToken\) to fetch the next page |
#### Output
@@ -82,9 +83,10 @@ Retrieve a list of calls made to and from an account.
| --------- | ---- | ----------- |
| `success` | boolean | Whether the calls were successfully retrieved |
| `calls` | array | Array of call objects |
-| `total` | number | Total number of calls returned |
+| `total` | number | Number of calls returned on this page |
| `page` | number | Current page number |
| `pageSize` | number | Number of calls per page |
+| `nextPageToken` | string | Pass as pageToken to fetch the next page; null on the last page |
| `error` | string | Error message if retrieval failed |
diff --git a/apps/docs/content/docs/integrations/typeform.mdx b/apps/docs/content/docs/integrations/typeform.mdx
index c7840979332..d1d5e7788f7 100644
--- a/apps/docs/content/docs/integrations/typeform.mdx
+++ b/apps/docs/content/docs/integrations/typeform.mdx
@@ -33,9 +33,10 @@ Retrieve form responses from Typeform
| `pageSize` | number | No | Number of responses to retrieve \(e.g., 10, 25, 50\) |
| `before` | string | No | Cursor token for fetching the next page of older responses |
| `after` | string | No | Cursor token for fetching the next page of newer responses |
-| `since` | string | No | Retrieve responses submitted after this date \(e.g., "2024-01-01T00:00:00Z"\) |
-| `until` | string | No | Retrieve responses submitted before this date \(e.g., "2024-12-31T23:59:59Z"\) |
-| `completed` | string | No | Filter by completion status \(e.g., "true", "false", "all"\) |
+| `since` | string | No | Retrieve responses submitted on or after this date \(e.g., "2024-01-01T00:00:00Z"\) |
+| `until` | string | No | Retrieve responses submitted on or before this date \(e.g., "2024-12-31T23:59:59Z"\) |
+| `completed` | string | No | Filter by completion status: "true" \(submitted only\), "false" \(started but not submitted\), or "all" \(no filter sent, so Typeform returns submitted responses only\). Ignored when responseType is set |
+| `responseType` | string | No | Comma-separated response types to return \(e.g., "partial,completed"\). Typeform returns only "completed" when omitted. Takes precedence over completed |
#### Output
@@ -183,7 +184,7 @@ Create a new form with fields and settings
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `title` | string | Yes | Form title |
-| `type` | string | No | Form type \(default: "form"\). Options: "form", "quiz" |
+| `type` | string | No | Form type: "quiz", "classification", "score", "branching", "classification_branching", or "score_branching" \(Typeform default: "quiz"\) |
| `workspaceId` | string | No | Workspace ID to create the form in \(e.g., "ws_abc123"\) |
| `fields` | json | No | Array of field objects defining the form structure. Each field needs: type, title, and optional properties/validations |
| `settings` | json | No | Form settings object \(language, progress_bar, etc.\) |
@@ -217,7 +218,7 @@ Update an existing form using JSON Patch operations
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `formId` | string | Yes | Form unique identifier to update \(e.g., "abc123XYZ"\) |
-| `operations` | json | Yes | Array of JSON Patch operations \(RFC 6902\). Each operation needs: op \(add/remove/replace\), path, and value \(for add/replace\) |
+| `operations` | json | Yes | Array of JSON Patch operations \(RFC 6902\), each with op, path, and value. Typeform accepts only these paths: /title, /settings/is_public, /settings/meta, /settings/google_analytics, /settings/google_tag_manager, /settings/facebook_pixel, /settings/enrichment_in_renderer, /settings/email_consent_notifications_config, /theme, /workspace |
#### Output
diff --git a/apps/docs/content/docs/integrations/webflow.mdx b/apps/docs/content/docs/integrations/webflow.mdx
index f557bf5a8b2..af64967c48b 100644
--- a/apps/docs/content/docs/integrations/webflow.mdx
+++ b/apps/docs/content/docs/integrations/webflow.mdx
@@ -48,10 +48,10 @@ List items from a Webflow CMS collection
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `siteId` | string | Yes | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\) |
+| `siteId` | string | No | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\). Not sent to Webflow; item requests are scoped by collection. |
| `collectionId` | string | Yes | ID of the collection \(e.g., "580e63fc8c9a982ac9b8b745"\) |
| `offset` | number | No | Offset for pagination \(e.g., 0, 100, 200\) |
-| `limit` | number | No | Maximum number of items to return \(e.g., 10, 50, 100; default: 100\) |
+| `limit` | number | No | Maximum number of items to return, max 100 \(e.g., 10, 50, 100; default: 100\) |
#### Output
@@ -84,7 +84,7 @@ Get a single item from a Webflow CMS collection
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `siteId` | string | Yes | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\) |
+| `siteId` | string | No | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\). Not sent to Webflow; item requests are scoped by collection. |
| `collectionId` | string | Yes | ID of the collection \(e.g., "580e63fc8c9a982ac9b8b745"\) |
| `itemId` | string | Yes | ID of the item to retrieve \(e.g., "580e64008c9a982ac9b8b754"\) |
@@ -92,8 +92,17 @@ Get a single item from a Webflow CMS collection
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `item` | json | The retrieved item object |
-| `metadata` | json | Metadata about the retrieved item |
+| `item` | object | The retrieved item object |
+| ↳ `id` | string | Unique item ID |
+| ↳ `cmsLocaleId` | string | CMS locale ID |
+| ↳ `lastPublished` | string | Last published date \(ISO 8601\) |
+| ↳ `lastUpdated` | string | Last updated date \(ISO 8601\) |
+| ↳ `createdOn` | string | Creation date \(ISO 8601\) |
+| ↳ `isArchived` | boolean | Whether the item is archived |
+| ↳ `isDraft` | boolean | Whether the item is a draft |
+| ↳ `fieldData` | object | Collection-specific field data \(varies by collection schema\) |
+| `metadata` | object | Metadata about the retrieved item |
+| ↳ `itemId` | string | ID of the retrieved item |
@@ -107,7 +116,7 @@ Create a new item in a Webflow CMS collection
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `siteId` | string | Yes | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\) |
+| `siteId` | string | No | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\). Not sent to Webflow; item requests are scoped by collection. |
| `collectionId` | string | Yes | ID of the collection \(e.g., "580e63fc8c9a982ac9b8b745"\) |
| `fieldData` | json | Yes | Field data for the new item as a JSON object. Keys should match collection field names. |
@@ -115,8 +124,17 @@ Create a new item in a Webflow CMS collection
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `item` | json | The created item object |
-| `metadata` | json | Metadata about the created item |
+| `item` | object | The created item object |
+| ↳ `id` | string | Unique item ID |
+| ↳ `cmsLocaleId` | string | CMS locale ID |
+| ↳ `lastPublished` | string | Last published date \(ISO 8601\) |
+| ↳ `lastUpdated` | string | Last updated date \(ISO 8601\) |
+| ↳ `createdOn` | string | Creation date \(ISO 8601\) |
+| ↳ `isArchived` | boolean | Whether the item is archived |
+| ↳ `isDraft` | boolean | Whether the item is a draft |
+| ↳ `fieldData` | object | Collection-specific field data \(varies by collection schema\) |
+| `metadata` | object | Metadata about the created item |
+| ↳ `itemId` | string | ID of the created item |
@@ -130,7 +148,7 @@ Update an existing item in a Webflow CMS collection
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `siteId` | string | Yes | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\) |
+| `siteId` | string | No | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\). Not sent to Webflow; item requests are scoped by collection. |
| `collectionId` | string | Yes | ID of the collection \(e.g., "580e63fc8c9a982ac9b8b745"\) |
| `itemId` | string | Yes | ID of the item to update \(e.g., "580e64008c9a982ac9b8b754"\) |
| `fieldData` | json | Yes | Field data to update as a JSON object. Only include fields you want to change. |
@@ -139,8 +157,17 @@ Update an existing item in a Webflow CMS collection
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `item` | json | The updated item object |
-| `metadata` | json | Metadata about the updated item |
+| `item` | object | The updated item object |
+| ↳ `id` | string | Unique item ID |
+| ↳ `cmsLocaleId` | string | CMS locale ID |
+| ↳ `lastPublished` | string | Last published date \(ISO 8601\) |
+| ↳ `lastUpdated` | string | Last updated date \(ISO 8601\) |
+| ↳ `createdOn` | string | Creation date \(ISO 8601\) |
+| ↳ `isArchived` | boolean | Whether the item is archived |
+| ↳ `isDraft` | boolean | Whether the item is a draft |
+| ↳ `fieldData` | object | Collection-specific field data \(varies by collection schema\) |
+| `metadata` | object | Metadata about the updated item |
+| ↳ `itemId` | string | ID of the updated item |
@@ -154,7 +181,7 @@ Delete an item from a Webflow CMS collection
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `siteId` | string | Yes | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\) |
+| `siteId` | string | No | ID of the Webflow site \(e.g., "580e63e98c9a982ac9b8b741"\). Not sent to Webflow; item requests are scoped by collection. |
| `collectionId` | string | Yes | ID of the collection \(e.g., "580e63fc8c9a982ac9b8b745"\) |
| `itemId` | string | Yes | ID of the item to delete \(e.g., "580e64008c9a982ac9b8b754"\) |
@@ -163,7 +190,8 @@ Delete an item from a Webflow CMS collection
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `success` | boolean | Whether the deletion was successful |
-| `metadata` | json | Metadata about the deletion |
+| `metadata` | object | Metadata about the deletion |
+| ↳ `deleted` | boolean | Whether the item was deleted |
diff --git a/apps/docs/content/docs/integrations/whatsapp.mdx b/apps/docs/content/docs/integrations/whatsapp.mdx
index 73c43736eb5..7dc39c57741 100644
--- a/apps/docs/content/docs/integrations/whatsapp.mdx
+++ b/apps/docs/content/docs/integrations/whatsapp.mdx
@@ -153,39 +153,16 @@ Send an image, document, video, audio, or sticker message. Accepts an uploaded f
| Parameter | Type | Description |
| --------- | ---- | ----------- |
-| `success` | boolean | Send success status |
-| `messageId` | string | WhatsApp message identifier |
-| `messageStatus` | string | Pacing status from the send API: accepted, held_for_quality_assessment, or paused. Acceptance is not delivery — use the webhook trigger for delivery status. |
-| `messagingProduct` | string | Messaging product returned by the send API |
-| `inputPhoneNumber` | string | Recipient phone number echoed by the send API |
-| `whatsappUserId` | string | Resolved WhatsApp user ID for the recipient |
-| `contacts` | array | Recipient contacts returned by the send API \(each item includes input and wa_id\) |
-| `mediaId` | string | Media asset ID from Upload Media, or the ID downloaded by Download Media |
-| `file` | file | Media downloaded by Download Media, stored as a workflow file |
-| `fileName` | string | Name of the file uploaded by Upload Media |
-| `mimeType` | string | MIME type of the uploaded or downloaded media |
-| `size` | number | Size in bytes of the file uploaded by Upload Media |
-| `fileSize` | number | Size in bytes of the downloaded media |
-| `sha256` | string | SHA-256 hash WhatsApp reported for the downloaded media |
-| `eventType` | string | Webhook classification such as incoming_message, message_status, or mixed |
-| `from` | string | Sender phone number from the first incoming message |
-| `recipientId` | string | Recipient phone number from the first status update in the batch |
-| `phoneNumberId` | string | Business phone number ID from the first message or status item in the batch |
-| `displayPhoneNumber` | string | Business display phone number from the first message or status item in the batch |
-| `text` | string | Text body from the first incoming text message |
-| `timestamp` | string | Timestamp from the first message or status item in the batch |
-| `messageType` | string | Type of the first incoming message in the batch, such as text, image, or system |
-| `mediaMimeType` | string | MIME type of the first incoming media message in the webhook batch |
-| `caption` | string | Caption on the first incoming image, video, or document message |
-| `status` | string | First outgoing message status in the batch, such as sent, delivered, or read |
-| `contact` | json | First sender contact in the webhook batch \(wa_id, profile.name\) |
-| `messages` | json | All incoming message objects from the webhook batch, flattened across entries/changes |
-| `statuses` | json | All message status objects from the webhook batch, flattened across entries/changes |
-| `webhookContacts` | json | All sender contact profiles from the webhook batch |
-| `conversation` | json | Conversation metadata from the first status update in the batch \(id, expiration_timestamp, origin.type\) |
-| `pricing` | json | Pricing metadata from the first status update in the batch \(billable, pricing_model, category\) |
-| `raw` | json | Full structured WhatsApp webhook payload |
-| `error` | string | Error information if sending fails |
+| `success` | boolean | WhatsApp message send success status |
+| `messageId` | string | Unique WhatsApp message identifier |
+| `messageStatus` | string | Message pacing status when WhatsApp returns one: accepted, held_for_quality_assessment, or paused. Acceptance is not delivery — subscribe to the webhook trigger for delivery status. |
+| `messagingProduct` | string | Messaging product returned by the API |
+| `inputPhoneNumber` | string | Recipient phone number echoed back by WhatsApp |
+| `whatsappUserId` | string | WhatsApp user ID resolved for the recipient |
+| `contacts` | array | Recipient contact records returned by WhatsApp |
+| ↳ `input` | string | Input phone number sent to the API |
+| ↳ `wa_id` | string | WhatsApp user ID associated with the recipient |
+| `mediaId` | string | Media ID WhatsApp assigned when a file was uploaded for this send \(reusable for 30 days\) |
diff --git a/apps/docs/content/docs/integrations/wordpress.mdx b/apps/docs/content/docs/integrations/wordpress.mdx
index 4c7213c1740..d6b75d6d359 100644
--- a/apps/docs/content/docs/integrations/wordpress.mdx
+++ b/apps/docs/content/docs/integrations/wordpress.mdx
@@ -51,6 +51,7 @@ Create a new blog post in WordPress.com
| `tags` | string | No | Comma-separated tag IDs |
| `featuredMedia` | number | No | Featured image media ID |
| `slug` | string | No | URL slug for the post |
+| `date` | string | No | Publish date in the site timezone, ISO 8601 \(e.g., 2026-12-01T09:00:00\). A future date with status publish schedules the post |
#### Output
@@ -94,6 +95,7 @@ Update an existing blog post in WordPress.com
| `tags` | string | No | Comma-separated tag IDs |
| `featuredMedia` | number | No | Featured image media ID |
| `slug` | string | No | URL slug for the post |
+| `date` | string | No | Publish date in the site timezone, ISO 8601 \(e.g., 2026-12-01T09:00:00\). A future date with status publish schedules the post |
#### Output
@@ -247,12 +249,13 @@ Create a new page in WordPress.com
| `siteId` | string | Yes | WordPress.com site ID or domain \(e.g., 12345678 or mysite.wordpress.com\) |
| `title` | string | Yes | Page title |
| `content` | string | No | Page content \(HTML or plain text\) |
-| `status` | string | No | Page status: publish, draft, pending, private |
+| `status` | string | No | Page status: publish, draft, pending, private, or future |
| `excerpt` | string | No | Page excerpt |
| `parent` | number | No | Parent page ID for hierarchical pages |
| `menuOrder` | number | No | Order in page menu |
| `featuredMedia` | number | No | Featured image media ID |
| `slug` | string | No | URL slug for the page |
+| `date` | string | No | Publish date in the site timezone, ISO 8601 \(e.g., 2026-12-01T09:00:00\). A future date with status publish schedules the page |
#### Output
@@ -290,12 +293,13 @@ Update an existing page in WordPress.com
| `pageId` | number | Yes | The ID of the page to update |
| `title` | string | No | Page title |
| `content` | string | No | Page content \(HTML or plain text\) |
-| `status` | string | No | Page status: publish, draft, pending, private |
+| `status` | string | No | Page status: publish, draft, pending, private, or future |
| `excerpt` | string | No | Page excerpt |
| `parent` | number | No | Parent page ID for hierarchical pages |
| `menuOrder` | number | No | Order in page menu |
| `featuredMedia` | number | No | Featured image media ID |
| `slug` | string | No | URL slug for the page |
+| `date` | string | No | Publish date in the site timezone, ISO 8601 \(e.g., 2026-12-01T09:00:00\). A future date with status publish schedules the page |
#### Output
@@ -631,10 +635,11 @@ List comments from WordPress.com with optional filters
| `perPage` | number | No | Number of comments per request \(e.g., 10, 25, 50\). Default: 10, max: 100 |
| `page` | number | No | Page number for pagination \(e.g., 1, 2, 3\) |
| `postId` | number | No | Filter by post ID \(e.g., 123, 456\) |
-| `status` | string | No | Filter by comment status: approved, hold, spam, trash |
+| `status` | string | No | Filter by comment status: approve, hold, spam, trash, all |
| `search` | string | No | Search term to filter comments \(e.g., "question", "feedback"\) |
| `orderBy` | string | No | Order by field: date, id, parent |
| `order` | string | No | Order direction: asc or desc |
+| `context` | string | No | Response context: view \(default\) or edit. edit returns author_email but requires the moderate_comments capability |
#### Output
@@ -646,7 +651,7 @@ List comments from WordPress.com with optional filters
| ↳ `parent` | number | Parent comment ID |
| ↳ `author` | number | Author user ID |
| ↳ `author_name` | string | Author display name |
-| ↳ `author_email` | string | Author email |
+| ↳ `author_email` | string | Author email \(edit context only\) |
| ↳ `author_url` | string | Author URL |
| ↳ `date` | string | Comment date |
| ↳ `content` | object | Comment content object |
@@ -1082,6 +1087,7 @@ List users from WordPress.com (requires admin privileges)
| `search` | string | No | Search term to filter users \(e.g., "john", "admin"\) |
| `roles` | string | No | Comma-separated role names to filter by \(e.g., "administrator,editor"\) |
| `order` | string | No | Order direction: asc or desc |
+| `context` | string | No | Response context: view \(default\) or edit. edit returns username, first_name, last_name, email and roles but requires the list_users capability |
#### Output
@@ -1089,16 +1095,16 @@ List users from WordPress.com (requires admin privileges)
| --------- | ---- | ----------- |
| `users` | array | List of users |
| ↳ `id` | number | User ID |
-| ↳ `username` | string | Username |
+| ↳ `username` | string | Username \(edit context only\) |
| ↳ `name` | string | Display name |
-| ↳ `first_name` | string | First name |
-| ↳ `last_name` | string | Last name |
-| ↳ `email` | string | Email address |
+| ↳ `first_name` | string | First name \(edit context only\) |
+| ↳ `last_name` | string | Last name \(edit context only\) |
+| ↳ `email` | string | Email address \(edit context only\) |
| ↳ `url` | string | User website URL |
| ↳ `description` | string | User bio |
| ↳ `link` | string | Author archive URL |
| ↳ `slug` | string | User slug |
-| ↳ `roles` | array | User roles |
+| ↳ `roles` | array | User roles \(edit context only\) |
| ↳ `avatar_urls` | object | Avatar URLs at different sizes |
| `total` | number | Total number of users |
| `totalPages` | number | Total number of result pages |
@@ -1124,16 +1130,16 @@ Get a specific user from WordPress.com by ID
| --------- | ---- | ----------- |
| `user` | object | The retrieved user |
| ↳ `id` | number | User ID |
-| ↳ `username` | string | Username |
+| ↳ `username` | string | Username \(edit context only\) |
| ↳ `name` | string | Display name |
-| ↳ `first_name` | string | First name |
-| ↳ `last_name` | string | Last name |
-| ↳ `email` | string | Email address |
+| ↳ `first_name` | string | First name \(edit context only\) |
+| ↳ `last_name` | string | Last name \(edit context only\) |
+| ↳ `email` | string | Email address \(edit context only\) |
| ↳ `url` | string | User website URL |
| ↳ `description` | string | User bio |
| ↳ `link` | string | Author archive URL |
| ↳ `slug` | string | User slug |
-| ↳ `roles` | array | User roles |
+| ↳ `roles` | array | User roles \(edit context only\) |
| ↳ `avatar_urls` | object | Avatar URLs at different sizes |
@@ -1160,7 +1166,7 @@ Search across all content types in WordPress.com (posts, pages, media)
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `results` | array | Search results |
-| ↳ `id` | number | Content ID |
+| ↳ `id` | number | Content ID \(a string slug for post-format results\) |
| ↳ `title` | string | Content title |
| ↳ `url` | string | Content URL |
| ↳ `type` | string | Content type \(post, term, or post-format\) |
diff --git a/apps/docs/content/docs/integrations/zoho_desk.mdx b/apps/docs/content/docs/integrations/zoho_desk.mdx
index 260d52aaad7..1611239c25c 100644
--- a/apps/docs/content/docs/integrations/zoho_desk.mdx
+++ b/apps/docs/content/docs/integrations/zoho_desk.mdx
@@ -212,7 +212,7 @@ Update fields on an existing Zoho Desk ticket.
| `language` | string | No | Ticket language |
| `channel` | string | No | Ticket origin channel |
| `webUrl` | string | No | URL to access the ticket |
-| `sharedDepartments` | array | No | JSON array of shared departments and access privileges |
+| `sharedDepartments` | array | No | Departments to share the ticket with, each as \{"id": departmentId, "type": "READ_ONLY" \| "READ_WRITE" \| "RESTRICTED_ACCESS"\}. JSON array. |
| `teamId` | string | No | Team ID |
| `secondaryContacts` | array | No | JSON array of secondary contact IDs |
| `entitySkills` | array | No | JSON array of skill IDs in priority order; at most 10 |
@@ -353,7 +353,7 @@ Add a comment to a Zoho Desk ticket.
### Zoho Desk List Threads
-List conversation threads on a Zoho Desk ticket, newest first (Zoho sorts by sendDateTime descending by default). Returns a list projection: message bodies (content, summary, to/cc/bcc) come back only from Get Thread.
+List conversation threads on a Zoho Desk ticket, newest first (Zoho sorts by sendDateTime descending by default). Returns a list projection: message bodies (content) come back only from Get Thread.
@@ -588,7 +588,7 @@ Create Ticket in Zoho Desk.
| `uploads` | array | No | File attachments in the ticket. For more information, refer to the Uploads section JSON array. |
| `resolution` | string | No | Resolution notes of the ticket |
| `webUrl` | string | No | URL to access the resource |
-| `sharedDepartments` | array | No | List of departments to which the ticket could be shared, along with the access privileges for each department JSON array. |
+| `sharedDepartments` | array | No | Departments to share the ticket with, each as \{"id": departmentId, "type": "READ_ONLY" \| "READ_WRITE" \| "RESTRICTED_ACCESS"\}. JSON array. |
| `teamId` | string | No | ID of the team to assign the ticket |
| `secondaryContacts` | array | No | List of Secondary contacts JSON array. |
| `entitySkills` | array | No | JSON array of up to 10 skill IDs, ordered from highest to lowest assignment priority. |
diff --git a/apps/docs/content/docs/integrations/zoom.mdx b/apps/docs/content/docs/integrations/zoom.mdx
index 316e6e41fb3..6e571bd6852 100644
--- a/apps/docs/content/docs/integrations/zoom.mdx
+++ b/apps/docs/content/docs/integrations/zoom.mdx
@@ -267,7 +267,7 @@ Update an existing Zoom meeting
| `joinBeforeHost` | boolean | No | Allow participants to join before host |
| `muteUponEntry` | boolean | No | Mute participants upon entry |
| `waitingRoom` | boolean | No | Enable waiting room |
-| `autoRecording` | string | No | Auto recording setting: local, cloud, or none |
+| `autoRecording` | string | No | Auto recording setting: local or cloud. Omit to leave unchanged; turning auto recording off is not supported on update. |
#### Output
@@ -289,8 +289,8 @@ Delete or cancel a Zoom meeting
| --------- | ---- | -------- | ----------- |
| `meetingId` | string | Yes | The meeting ID to delete \(e.g., "1234567890" or "85746065432"\) |
| `occurrenceId` | string | No | Occurrence ID for deleting a specific occurrence of a recurring meeting |
-| `scheduleForReminder` | boolean | No | Send cancellation reminder email to registrants |
-| `cancelMeetingReminder` | boolean | No | Send cancellation email to registrants and alternative hosts |
+| `scheduleForReminder` | boolean | No | Email the host and alternative hosts about the cancellation |
+| `cancelMeetingReminder` | boolean | No | Email the meeting registrants about the cancellation |
#### Output
@@ -331,8 +331,8 @@ List all cloud recordings for a Zoom user
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `userId` | string | Yes | The user ID or email address \(e.g., "me", "user@example.com", or "AbcDefGHi"\). Use "me" for the authenticated user with OAuth credentials. With a Zoom server-to-server service account, "me" is not supported — provide the target user ID or email address. |
-| `from` | string | No | Start date in yyyy-mm-dd format \(within last 6 months\) |
-| `to` | string | No | End date in yyyy-mm-dd format |
+| `from` | string | No | Start date in yyyy-mm-dd format \(UTC\). Zoom allows at most a one-month range and defaults to today when omitted |
+| `to` | string | No | End date in yyyy-mm-dd format \(UTC\) |
| `pageSize` | number | No | Number of records per page, 1-300 \(e.g., 30, 50, 100\) |
| `nextPageToken` | string | No | Token for pagination to get next page of results |
| `trash` | boolean | No | Set to true to list recordings from trash |
@@ -432,7 +432,7 @@ Delete cloud recordings for a Zoom meeting
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `meetingId` | string | Yes | The meeting ID or meeting UUID \(e.g., "1234567890" or "4444AAABBBccccc12345=="\) |
-| `recordingId` | string | No | Specific recording file ID to delete. If not provided, deletes all recordings. |
+| `recordingId` | string | No | Specific recording file ID to delete. If not provided, deletes all recordings of the meeting, which needs the cloud_recording:delete:meeting_recording scope. |
| `action` | string | No | Delete action: "trash" \(move to trash\) or "delete" \(permanently delete\) |
#### Output
diff --git a/apps/docs/scripts/compile-content.ts b/apps/docs/scripts/compile-content.ts
index 7081d373098..1aa1b7b7cfd 100644
--- a/apps/docs/scripts/compile-content.ts
+++ b/apps/docs/scripts/compile-content.ts
@@ -211,7 +211,8 @@ async function generate() {
const dates = lastModified()
let compiled = 0
for (const file of await filesIn(CONTENT_ROOT)) {
- const relative = path.relative(CONTENT_ROOT, file)
+ // Navigation keys and page URLs below assume `/`; on Windows path.relative returns `\`.
+ const relative = path.relative(CONTENT_ROOT, file).split(path.sep).join('/')
if (relative.endsWith('meta.json')) {
const parsed = metadataSchema.safeParse(JSON.parse(await readFile(file, 'utf8')))
if (!parsed.success) throw new Error(`${relative}: ${parsed.error.message}`)
diff --git a/apps/pii/server.py b/apps/pii/server.py
index 405d96e13bc..3f39210010a 100644
--- a/apps/pii/server.py
+++ b/apps/pii/server.py
@@ -8,9 +8,10 @@
import json
import logging
+import threading
import time
from collections.abc import AsyncIterator
-from contextlib import asynccontextmanager
+from contextlib import asynccontextmanager, nullcontext
from typing import Any
import regex as regex_module
@@ -184,7 +185,6 @@ def build_analyzer() -> AnalyzerEngine:
anonymizer: AnonymizerEngine
NER_ENTITIES: frozenset
_BLANK_ARTIFACTS: dict
-_NLP_MAX_LENGTH: dict
# Every entity the spaCy NER recognizers can actually produce. A request touching
# any of these must run spaCy; a request naming only non-NER (regex/checksum)
@@ -228,19 +228,22 @@ def _regex_only(entities: list[str] | None, score_threshold: float | None) -> bo
)
-# spaCy refuses (error E088) any text longer than its model's `max_length`, so a
-# longer text runs NER in windows of this many characters, following spaCy's
-# guidance to segment long documents (it sizes NER memory at roughly 1GB per
-# 100,000 characters of one text).
+# A text longer than this runs NER in windows of this many characters, following
+# spaCy's guidance to segment long documents. One NER pass costs memory that grows
+# with the text's length (about 3GB for 900,000 characters), enough to get a worker
+# OOM-killed, so no pass sees more than one window. That also keeps every pass under
+# spaCy's `max_length`, which it refuses with error E088.
NER_WINDOW_CHARS = 100_000
# How much of the previous window each window repeats. Far longer than any entity
# spaCy tags, so an entity cut by one window's edge lies whole inside the next.
NER_WINDOW_OVERLAP = 1_000
-
-def _exceeds_nlp_length(text: str, language: str) -> bool:
- limit = _NLP_MAX_LENGTH.get(language)
- return limit is not None and len(text) > limit
+# One NER pass (a batch, a short text, or one window) at a time per worker. FastAPI
+# runs these sync endpoints on a threadpool, so without it a worker runs one pass per
+# request in flight and their memory adds up until it is OOM-killed. A long text
+# takes it per window, so it interleaves with other requests. Regex-only requests
+# never take it.
+_NER_SLOT = threading.Lock()
def _window_entities(
@@ -265,7 +268,7 @@ def _analyze_long(
return_decision_process: bool = False,
ad_hoc_recognizers: list[PatternRecognizer] | None = None,
) -> list[RecognizerResult]:
- """Analyze a text longer than spaCy's `max_length`.
+ """Analyze a text longer than NER_WINDOW_CHARS.
Pattern, checksum, and custom recognizers have no length limit, so they run
once over the whole text (against blank NLP artifacts, as the regex-only path
@@ -291,13 +294,15 @@ def _analyze_long(
return results
step = NER_WINDOW_CHARS - NER_WINDOW_OVERLAP
for start in range(0, len(text), step):
- for result in analyzer.analyze(
- text=text[start : start + NER_WINDOW_CHARS],
- language=language,
- entities=window_entities,
- score_threshold=score_threshold,
- return_decision_process=return_decision_process,
- ):
+ with _NER_SLOT:
+ window_results = analyzer.analyze(
+ text=text[start : start + NER_WINDOW_CHARS],
+ language=language,
+ entities=window_entities,
+ score_threshold=score_threshold,
+ return_decision_process=return_decision_process,
+ )
+ for result in window_results:
results.append(
RecognizerResult(
result.entity_type,
@@ -327,7 +332,7 @@ def _analyze_one(
ad_hoc_recognizers: list[PatternRecognizer] | None = None,
):
regex_only = _regex_only(entities, score_threshold)
- if not regex_only and _exceeds_nlp_length(text, language):
+ if not regex_only and len(text) > NER_WINDOW_CHARS:
return _analyze_long(
text, language, entities, score_threshold, return_decision_process, ad_hoc_recognizers
)
@@ -335,15 +340,16 @@ def _analyze_one(
# otherwise analyze() computes artifacts (runs spaCy) as usual. Custom-pattern
# recognizers are regex-based, so they run fine against the blank artifacts.
nlp_artifacts = _BLANK_ARTIFACTS.get(language) if regex_only else None
- return analyzer.analyze(
- text=text,
- language=language,
- entities=entities or None,
- score_threshold=score_threshold,
- return_decision_process=return_decision_process,
- nlp_artifacts=nlp_artifacts,
- ad_hoc_recognizers=ad_hoc_recognizers or None,
- )
+ with nullcontext() if regex_only else _NER_SLOT:
+ return analyzer.analyze(
+ text=text,
+ language=language,
+ entities=entities or None,
+ score_threshold=score_threshold,
+ return_decision_process=return_decision_process,
+ nlp_artifacts=nlp_artifacts,
+ ad_hoc_recognizers=ad_hoc_recognizers or None,
+ )
# Presidio's BatchAnalyzerEngine defaults nlp.pipe to batch_size=1, so a 2000-text
@@ -358,9 +364,10 @@ def _analyze_many(
score_threshold: float | None,
ad_hoc_recognizers: list[PatternRecognizer] | None = None,
):
- """Analyze many texts, skipping the spaCy pass for regex-only requests and
- analyzing any text longer than spaCy's `max_length` on its own (see
- `_analyze_long`)."""
+ """Analyze many texts, skipping the spaCy pass for regex-only requests. A text
+ longer than NER_WINDOW_CHARS is analyzed on its own (see `_analyze_long`); the
+ rest share NER passes of at most NER_WINDOW_CHARS in total, since a batched pass
+ costs memory for every character in it, like one long text."""
if _regex_only(entities, score_threshold):
blank = _BLANK_ARTIFACTS.get(language)
return [
@@ -374,20 +381,32 @@ def _analyze_many(
)
for text in texts
]
- long_indices = {i for i, text in enumerate(texts) if _exceeds_nlp_length(text, language)}
- short_indices = [i for i in range(len(texts)) if i not in long_indices]
+ long_indices: list[int] = []
+ batches: list[list[int]] = []
+ batch_chars = 0
+ for i, text in enumerate(texts):
+ if len(text) > NER_WINDOW_CHARS:
+ long_indices.append(i)
+ continue
+ if not batches or batch_chars + len(text) > NER_WINDOW_CHARS:
+ batches.append([])
+ batch_chars = 0
+ batches[-1].append(i)
+ batch_chars += len(text)
results: list[list[RecognizerResult]] = [[] for _ in texts]
- short_results = batch_analyzer.analyze_iterator(
- texts=[texts[i] for i in short_indices],
- language=language,
- batch_size=NLP_BATCH_SIZE,
- entities=entities or None,
- score_threshold=score_threshold,
- ad_hoc_recognizers=ad_hoc_recognizers or None,
- )
- for i, per_text in zip(short_indices, short_results):
- results[i] = list(per_text)
- for i in sorted(long_indices):
+ for batch in batches:
+ with _NER_SLOT:
+ batch_results = batch_analyzer.analyze_iterator(
+ texts=[texts[i] for i in batch],
+ language=language,
+ batch_size=NLP_BATCH_SIZE,
+ entities=entities or None,
+ score_threshold=score_threshold,
+ ad_hoc_recognizers=ad_hoc_recognizers or None,
+ )
+ for i, per_text in zip(batch, batch_results):
+ results[i] = list(per_text)
+ for i in long_indices:
results[i] = _analyze_long(
texts[i], language, entities, score_threshold, ad_hoc_recognizers=ad_hoc_recognizers
)
@@ -396,7 +415,7 @@ def _analyze_many(
@asynccontextmanager
async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
- global analyzer, batch_analyzer, anonymizer, NER_ENTITIES, _BLANK_ARTIFACTS, _NLP_MAX_LENGTH
+ global analyzer, batch_analyzer, anonymizer, NER_ENTITIES, _BLANK_ARTIFACTS
logger.info("building analyzer (spacy)")
analyzer = build_analyzer()
batch_analyzer = BatchAnalyzerEngine(analyzer_engine=analyzer)
@@ -423,10 +442,6 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
language: analyzer.nlp_engine.process_text("", language)
for language in SUPPORTED_LANGUAGES
}
- _NLP_MAX_LENGTH = {
- language: nlp.max_length
- for language, nlp in getattr(analyzer.nlp_engine, "nlp", {}).items()
- }
yield
@@ -686,8 +701,10 @@ def run_anonymize(
)
+# Async so it answers on the event loop: requests queued on _NER_SLOT hold
+# threadpool threads, and the load balancer's health check must not wait behind them.
@app.get("/health")
-def health() -> dict[str, str]:
+async def health() -> dict[str, str]:
return {"status": "ok"}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/param-dependents.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/param-dependents.ts
index 5751d69b74c..145f9bb42ac 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/param-dependents.ts
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/param-dependents.ts
@@ -1,4 +1,5 @@
import { getTransitiveSubBlockDependents } from '@/lib/workflows/subblocks/dependencies'
+import { omitConditionHiddenParams } from '@/lib/workflows/tool-input/hidden-params'
import type { StoredTool } from '@/lib/workflows/tool-input/types'
import { getBlock } from '@/blocks/registry'
import type { ToolMetadata } from '@/tools/metadata'
@@ -27,10 +28,14 @@ export function clearDependentToolParams(
return next ?? params
}
-/** Keeps user-configured inputs that the newly selected operation accepts. */
+/**
+ * Keeps user-configured inputs that the newly selected operation accepts and still shows: a
+ * value whose fields the operation hides would otherwise linger out of sight and still run.
+ */
export function getParamsForToolOperation(
tool: Pick,
- nextTool: ToolMetadata
+ nextTool: ToolMetadata,
+ operation: string
): Record {
const newParamIds = new Set(
Object.entries(nextTool.params ?? {})
@@ -64,5 +69,6 @@ export function getParamsForToolOperation(
Object.entries(tool.params || {}).forEach(([paramId, value]) => {
if (newParamIds.has(paramId) && value) preservedParams[paramId] = value
})
- return clearDependentToolParams(tool.type, preservedParams, 'operation')
+ const visibleParams = omitConditionHiddenParams(subBlocks, preservedParams, operation)
+ return clearDependentToolParams(tool.type, visibleParams, 'operation')
}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx
index bd584693029..6d2c81d98ae 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx
@@ -981,7 +981,7 @@ export const ToolInput = memo(function ToolInput({
return
}
- const preservedParams = getParamsForToolOperation(tool, newToolConfig)
+ const preservedParams = getParamsForToolOperation(tool, newToolConfig, operation)
if (tool.type === 'jira') {
const subBlockStore = useSubBlockStore.getState()
diff --git a/apps/sim/blocks/blocks/affinity.test.ts b/apps/sim/blocks/blocks/affinity.test.ts
new file mode 100644
index 00000000000..19b372a3933
--- /dev/null
+++ b/apps/sim/blocks/blocks/affinity.test.ts
@@ -0,0 +1,79 @@
+import { describe, expect, it, vi } from 'vitest'
+
+vi.mock('@/lib/internal/workflows/read-tool-enrichment', () => ({
+ readWorkflowInputFieldsForTool: vi.fn(),
+ readWorkflowMetadataForTool: vi.fn(),
+}))
+
+import { AffinityBlock } from '@/blocks/blocks/affinity'
+import { ToolCallParamsError } from '@/providers/tool-params-error'
+import { prepareToolExecution, transformBlockTool } from '@/providers/utils'
+import { affinityCreateListFieldDropdownOptionTool } from '@/tools/affinity/create_list_field_dropdown_option'
+
+/** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */
+function toolCall(args: Record, operation: string) {
+ const mapParams = AffinityBlock.tools.config?.params
+ if (!mapParams) throw new Error('Affinity block has no params mapper')
+ return { ...args, ...mapParams(args, { operation }) }
+}
+
+describe('AffinityBlock agent tool calls', () => {
+ it('maps block-field keys and keeps model args instead of dropping them', () => {
+ const result = toolCall(
+ { apiKey: 'key', noteEntityType: 'company', entityId: '42', limit: '10' },
+ 'list_entity_notes'
+ )
+ expect(result).toMatchObject({ entityType: 'company', entityId: '42', limit: 10 })
+ expect(result.noteEntityType).toBeUndefined()
+
+ expect(
+ toolCall({ apiKey: 'key', name: 'Deals', type: 'company', isPublic: true }, 'create_list')
+ ).toMatchObject({ name: 'Deals', type: 'company', isPublic: true })
+ })
+})
+
+describe('AffinityBlock dropdown option rank and win rate on a tool call', () => {
+ const operation = 'create_list_field_dropdown_option'
+
+ async function prepare(stored: Record, modelArgs: Record) {
+ const providerTool = await transformBlockTool(
+ { type: AffinityBlock.type, operation, params: { apiKey: 'key', ...stored } },
+ {
+ selectedOperation: operation,
+ getAllBlocks: () => [AffinityBlock],
+ getTool: () => affinityCreateListFieldDropdownOptionTool,
+ }
+ )
+ if (!providerTool) throw new Error('Affinity agent tool was not created')
+ return prepareToolExecution(providerTool, modelArgs, {}, undefined).executionParams
+ }
+
+ const pinnedStatusOption = {
+ listId: 'l1',
+ fieldId: 'f1',
+ optionType: 'status-dropdown',
+ optionText: 'Won',
+ optionColor: 'green',
+ optionStatusCategory: 'won',
+ }
+
+ it('fails the call instead of sending the model fields over the pinned option', async () => {
+ await expect(
+ prepare(pinnedStatusOption, { rank: 2, winRate: 150, type: 'ranked-dropdown', text: 'X' })
+ ).rejects.toThrow(ToolCallParamsError)
+ })
+
+ it.each([
+ ['Option Rank', { optionRank: ' ' }, { rank: 2.5 }],
+ ['Win Rate', { optionWinRate: ' ' }, { rank: 1, winRate: 250 }],
+ ])('validates the model value behind a blank %s', async (_label, stored, modelArgs) => {
+ await expect(prepare({ ...pinnedStatusOption, ...stored }, modelArgs)).rejects.toThrow(
+ ToolCallParamsError
+ )
+ })
+
+ it('sends a valid model rank behind a blank Option Rank', async () => {
+ const params = await prepare({ ...pinnedStatusOption, optionRank: ' ' }, { rank: 3 })
+ expect(params).toMatchObject({ type: 'status-dropdown', text: 'Won', rank: 3 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/affinity.ts b/apps/sim/blocks/blocks/affinity.ts
index 6bc3c72ed38..dadff8f1d3c 100644
--- a/apps/sim/blocks/blocks/affinity.ts
+++ b/apps/sim/blocks/blocks/affinity.ts
@@ -2,8 +2,12 @@ import { AffinityIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
+ failToolCallOnError,
+ isToolCall,
+ mapperOperation,
parseOptionalBooleanInput,
parseOptionalNumberInput,
+ toolCallArg,
withSavedCredential,
} from '@/blocks/utils'
@@ -1337,176 +1341,196 @@ export const AffinityBlock: BlockConfig = {
* omitting a key leaves the previous operation's value on the wire — an
* advanced field is serialized on non-emptiness alone, even while the UI
* hides it. `undefined` is what actually drops one.
+ *
+ * On a tool call the model's args arrive under the tool's own param names,
+ * so a tool param the selected operation does not fill from a block field
+ * keeps the model's value instead of being dropped.
*/
- params: (params) => {
- const operation = String(params.operation ?? '')
- const isIn = (group: readonly string[]) => group.includes(operation)
+ params: (params, context) =>
+ failToolCallOnError(context, () => {
+ const operation = mapperOperation(params, context)
+ const isIn = (group: readonly string[]) => group.includes(operation)
+
+ const isKeywordSearch = isIn(KEYWORD_SEARCH_OPERATIONS)
+ const isDropdownWrite = isIn(DROPDOWN_OPTION_WRITE_OPERATIONS)
+ const isEntitySearch = isIn(ENTITY_SEARCH_OPERATIONS)
+ const isFieldValueSelection = isIn(FIELD_VALUE_SELECTION_OPERATIONS)
+ const isNoteWrite = isIn(NOTE_WRITE_OPERATIONS)
+ const isCreateNote = operation === 'create_note'
+ const isCreateList = operation === 'create_list'
+ const isCreateReminder = operation === 'create_reminder'
- const isKeywordSearch = isIn(KEYWORD_SEARCH_OPERATIONS)
- const isDropdownWrite = isIn(DROPDOWN_OPTION_WRITE_OPERATIONS)
- const isEntitySearch = isIn(ENTITY_SEARCH_OPERATIONS)
- const isFieldValueSelection = isIn(FIELD_VALUE_SELECTION_OPERATIONS)
- const isNoteWrite = isIn(NOTE_WRITE_OPERATIONS)
- const isCreateNote = operation === 'create_note'
- const isCreateList = operation === 'create_list'
- const isCreateReminder = operation === 'create_reminder'
+ let entityType: unknown
+ if (isIn(FIELD_ENTITY_OPERATIONS)) entityType = params.fieldEntityType
+ else if (operation === 'list_entity_notes') entityType = params.noteEntityType
+ else if (isIn(MERGE_OPERATIONS)) entityType = params.mergeEntityType
+ else if (isCreateReminder) entityType = params.reminderEntityType
- let entityType: unknown
- if (isIn(FIELD_ENTITY_OPERATIONS)) entityType = params.fieldEntityType
- else if (operation === 'list_entity_notes') entityType = params.noteEntityType
- else if (isIn(MERGE_OPERATIONS)) entityType = params.mergeEntityType
- else if (isCreateReminder) entityType = params.reminderEntityType
+ let type: unknown
+ if (isCreateList) type = params.listType
+ else if (operation === 'create_list_field_dropdown_option') type = params.optionType
+ else if (isCreateNote) type = params.noteType
+ else if (isCreateReminder) type = params.reminderType
- let type: unknown
- if (isCreateList) type = params.listType
- else if (operation === 'create_list_field_dropdown_option') type = params.optionType
- else if (isCreateNote) type = params.noteType
- else if (isCreateReminder) type = params.reminderType
+ let filter: unknown
+ if (isIn(CONNECTION_OPERATIONS)) filter = params.connectionFilter
+ else if (isIn(FILTER_OPERATIONS)) filter = params.filter
- let filter: unknown
- if (isIn(CONNECTION_OPERATIONS)) filter = params.connectionFilter
- else if (isIn(FILTER_OPERATIONS)) filter = params.filter
+ let orderBy: unknown
+ if (operation === 'list_entity_relationships') orderBy = params.relationshipOrderBy
+ else if (operation === 'list_field_value_changes') orderBy = params.changeOrderBy
- let orderBy: unknown
- if (operation === 'list_entity_relationships') orderBy = params.relationshipOrderBy
- else if (operation === 'list_field_value_changes') orderBy = params.changeOrderBy
+ let includes: unknown
+ if (isIn(NOTE_INCLUDES_OPERATIONS)) includes = params.noteIncludes
+ else if (isIn(FIELD_INCLUDES_OPERATIONS)) includes = params.fieldIncludes
- let includes: unknown
- if (isIn(NOTE_INCLUDES_OPERATIONS)) includes = params.noteIncludes
- else if (isIn(FIELD_INCLUDES_OPERATIONS)) includes = params.fieldIncludes
+ let ids: unknown
+ if (isIn(ID_FILTER_OPERATIONS)) ids = params.entityIds
+ else if (isKeywordSearch) ids = params.searchIds
+ else if (isFieldValueSelection) ids = params.valueFieldIds
- let ids: unknown
- if (isIn(ID_FILTER_OPERATIONS)) ids = params.entityIds
- else if (isKeywordSearch) ids = params.searchIds
- else if (isFieldValueSelection) ids = params.valueFieldIds
+ /** A blank block field falls through to the model's value, which is validated too. */
+ const parseOptionRank = (value: unknown) =>
+ parseOptionalNumberInput(value, 'Option Rank', { integer: true, min: 0 })
+ const parseWinRate = (value: unknown) =>
+ parseOptionalNumberInput(value, 'Win Rate', { integer: true, min: 0, max: 100 })
- return {
- apiKey: params.apiKey,
- entityType,
- type,
- filter,
- orderBy,
- includes,
- ids,
- entityId: isIn(ENTITY_ID_OPERATIONS) ? params.entityId : undefined,
- companyId:
- operation === 'get_company'
- ? params.companyId
- : isKeywordSearch
- ? params.scopeCompanyId
+ const toolParams: Record = {
+ apiKey: params.apiKey,
+ entityType,
+ type,
+ filter,
+ orderBy,
+ includes,
+ ids,
+ entityId: isIn(ENTITY_ID_OPERATIONS) ? params.entityId : undefined,
+ companyId:
+ operation === 'get_company'
+ ? params.companyId
+ : isKeywordSearch
+ ? params.scopeCompanyId
+ : undefined,
+ personId: operation === 'get_person' ? params.personId : undefined,
+ opportunityId: operation === 'get_opportunity' ? params.opportunityId : undefined,
+ listId: isIn(LIST_ID_OPERATIONS) ? params.listId : undefined,
+ listEntryId: isIn(LIST_ENTRY_ID_OPERATIONS) ? params.listEntryId : undefined,
+ viewId:
+ operation === 'get_saved_view' || operation === 'list_saved_view_entries'
+ ? params.viewId
+ : undefined,
+ fieldId: isIn(FIELD_ID_OPERATIONS) ? params.fieldId : undefined,
+ dropdownOptionId: isIn(DROPDOWN_OPTION_ID_OPERATIONS)
+ ? params.dropdownOptionId
+ : undefined,
+ noteId: isIn(NOTE_ID_OPERATIONS) ? params.noteId : undefined,
+ transcriptId:
+ operation === 'get_transcript' || operation === 'list_transcript_fragments'
+ ? params.transcriptId
: undefined,
- personId: operation === 'get_person' ? params.personId : undefined,
- opportunityId: operation === 'get_opportunity' ? params.opportunityId : undefined,
- listId: isIn(LIST_ID_OPERATIONS) ? params.listId : undefined,
- listEntryId: isIn(LIST_ENTRY_ID_OPERATIONS) ? params.listEntryId : undefined,
- viewId:
- operation === 'get_saved_view' || operation === 'list_saved_view_entries'
- ? params.viewId
+ userId: operation === 'get_user' ? params.userId : undefined,
+ mergeId: operation === 'get_merge' ? params.mergeId : undefined,
+ taskId: operation === 'get_merge_task' ? params.taskId : undefined,
+ types: isFieldValueSelection ? params.valueFieldTypes : undefined,
+ fieldIds: isIn(FIELD_SELECTION_OPERATIONS) ? params.fieldIds : undefined,
+ fieldTypes: isIn(FIELD_SELECTION_OPERATIONS) ? params.fieldTypes : undefined,
+ filters: isEntitySearch ? params.searchFilters : undefined,
+ sorts: isEntitySearch ? params.searchSorts : undefined,
+ searchTerm: isEntitySearch ? params.searchTerm : undefined,
+ searchFieldIds: isEntitySearch ? params.searchTermFieldIds : undefined,
+ prompt: isIn(PROMPT_OPERATIONS) ? params.prompt : undefined,
+ listIds: operation === 'semantic_search' ? params.listIds : undefined,
+ term:
+ operation === 'list_lists' || operation === 'list_users' ? params.term : undefined,
+ name: isCreateList ? params.listName : undefined,
+ isPublic: isCreateList ? parseOptionalBooleanInput(params.isPublic) : undefined,
+ text: isDropdownWrite ? params.optionText : undefined,
+ rank: isDropdownWrite
+ ? (parseOptionRank(params.optionRank) ??
+ parseOptionRank(toolCallArg(context, params.rank)))
: undefined,
- fieldId: isIn(FIELD_ID_OPERATIONS) ? params.fieldId : undefined,
- dropdownOptionId: isIn(DROPDOWN_OPTION_ID_OPERATIONS)
- ? params.dropdownOptionId
- : undefined,
- noteId: isIn(NOTE_ID_OPERATIONS) ? params.noteId : undefined,
- transcriptId:
- operation === 'get_transcript' || operation === 'list_transcript_fragments'
- ? params.transcriptId
+ color: isDropdownWrite ? params.optionColor : undefined,
+ statusCategory: isDropdownWrite ? params.optionStatusCategory : undefined,
+ winRate: isDropdownWrite
+ ? (parseWinRate(params.optionWinRate) ??
+ parseWinRate(toolCallArg(context, params.winRate)))
: undefined,
- userId: operation === 'get_user' ? params.userId : undefined,
- mergeId: operation === 'get_merge' ? params.mergeId : undefined,
- taskId: operation === 'get_merge_task' ? params.taskId : undefined,
- types: isFieldValueSelection ? params.valueFieldTypes : undefined,
- fieldIds: isIn(FIELD_SELECTION_OPERATIONS) ? params.fieldIds : undefined,
- fieldTypes: isIn(FIELD_SELECTION_OPERATIONS) ? params.fieldTypes : undefined,
- filters: isEntitySearch ? params.searchFilters : undefined,
- sorts: isEntitySearch ? params.searchSorts : undefined,
- searchTerm: isEntitySearch ? params.searchTerm : undefined,
- searchFieldIds: isEntitySearch ? params.searchTermFieldIds : undefined,
- prompt: isIn(PROMPT_OPERATIONS) ? params.prompt : undefined,
- listIds: operation === 'semantic_search' ? params.listIds : undefined,
- term: operation === 'list_lists' || operation === 'list_users' ? params.term : undefined,
- name: isCreateList ? params.listName : undefined,
- isPublic: isCreateList ? parseOptionalBooleanInput(params.isPublic) : undefined,
- text: isDropdownWrite ? params.optionText : undefined,
- rank: isDropdownWrite
- ? parseOptionalNumberInput(params.optionRank, 'Option Rank', { integer: true, min: 0 })
- : undefined,
- color: isDropdownWrite ? params.optionColor : undefined,
- statusCategory: isDropdownWrite ? params.optionStatusCategory : undefined,
- winRate: isDropdownWrite
- ? parseOptionalNumberInput(params.optionWinRate, 'Win Rate', {
- integer: true,
- min: 0,
- max: 100,
- })
- : undefined,
- value: isIn(FIELD_VALUE_WRITE_OPERATIONS) ? params.fieldValue : undefined,
- updates: isIn(FIELD_BATCH_WRITE_OPERATIONS) ? params.fieldUpdates : undefined,
- html: isNoteWrite ? params.noteHtml : undefined,
- companyIds: isNoteWrite ? params.noteCompanyIds : undefined,
- personIds: isNoteWrite ? params.notePersonIds : undefined,
- opportunityIds: isNoteWrite ? params.noteOpportunityIds : undefined,
- interactionId: isCreateNote ? params.interactionId : undefined,
- interactionType: isCreateNote ? params.interactionType : undefined,
- parentId: isCreateNote ? params.parentId : undefined,
- creatorId: isCreateNote ? params.creatorId : undefined,
- createdAt: isCreateNote ? params.noteCreatedAt : undefined,
- primaryId: operation === 'create_merge' ? params.primaryId : undefined,
- duplicateId: operation === 'create_merge' ? params.duplicateId : undefined,
- dueDate: isCreateReminder ? params.dueDate : undefined,
- content: isCreateReminder ? params.reminderContent : undefined,
- ownerId: isCreateReminder ? params.ownerId : undefined,
- resetTrigger: isCreateReminder ? params.resetTrigger : undefined,
- periodDays: isCreateReminder
- ? parseOptionalNumberInput(params.periodDays, 'Period In Days', {
- integer: true,
- min: 1,
- })
- : undefined,
- cursor: isIn(CURSOR_OPERATIONS) ? params.cursor : undefined,
- limit: isIn(LIMIT_OPERATIONS)
- ? parseOptionalNumberInput(params.limit, 'Limit', { integer: true, min: 1 })
- : undefined,
- totalCount: isIn(TOTAL_COUNT_OPERATIONS)
- ? parseOptionalBooleanInput(params.totalCount)
- : undefined,
- fieldEntityType: undefined,
- noteEntityType: undefined,
- mergeEntityType: undefined,
- reminderEntityType: undefined,
- listName: undefined,
- listType: undefined,
- optionType: undefined,
- optionText: undefined,
- optionRank: undefined,
- optionColor: undefined,
- optionStatusCategory: undefined,
- optionWinRate: undefined,
- fieldValue: undefined,
- fieldUpdates: undefined,
- searchFilters: undefined,
- searchSorts: undefined,
- searchTermFieldIds: undefined,
- searchIds: undefined,
- scopeCompanyId: undefined,
- entityIds: undefined,
- valueFieldIds: undefined,
- valueFieldTypes: undefined,
- noteType: undefined,
- noteHtml: undefined,
- noteCompanyIds: undefined,
- notePersonIds: undefined,
- noteOpportunityIds: undefined,
- noteCreatedAt: undefined,
- reminderType: undefined,
- reminderContent: undefined,
- connectionFilter: undefined,
- relationshipOrderBy: undefined,
- changeOrderBy: undefined,
- noteIncludes: undefined,
- fieldIncludes: undefined,
- }
- },
+ value: isIn(FIELD_VALUE_WRITE_OPERATIONS) ? params.fieldValue : undefined,
+ updates: isIn(FIELD_BATCH_WRITE_OPERATIONS) ? params.fieldUpdates : undefined,
+ html: isNoteWrite ? params.noteHtml : undefined,
+ companyIds: isNoteWrite ? params.noteCompanyIds : undefined,
+ personIds: isNoteWrite ? params.notePersonIds : undefined,
+ opportunityIds: isNoteWrite ? params.noteOpportunityIds : undefined,
+ interactionId: isCreateNote ? params.interactionId : undefined,
+ interactionType: isCreateNote ? params.interactionType : undefined,
+ parentId: isCreateNote ? params.parentId : undefined,
+ creatorId: isCreateNote ? params.creatorId : undefined,
+ createdAt: isCreateNote ? params.noteCreatedAt : undefined,
+ primaryId: operation === 'create_merge' ? params.primaryId : undefined,
+ duplicateId: operation === 'create_merge' ? params.duplicateId : undefined,
+ dueDate: isCreateReminder ? params.dueDate : undefined,
+ content: isCreateReminder ? params.reminderContent : undefined,
+ ownerId: isCreateReminder ? params.ownerId : undefined,
+ resetTrigger: isCreateReminder ? params.resetTrigger : undefined,
+ periodDays: isCreateReminder
+ ? parseOptionalNumberInput(params.periodDays, 'Period In Days', {
+ integer: true,
+ min: 1,
+ })
+ : undefined,
+ cursor: isIn(CURSOR_OPERATIONS) ? params.cursor : undefined,
+ limit: isIn(LIMIT_OPERATIONS)
+ ? parseOptionalNumberInput(params.limit, 'Limit', { integer: true, min: 1 })
+ : undefined,
+ totalCount: isIn(TOTAL_COUNT_OPERATIONS)
+ ? parseOptionalBooleanInput(params.totalCount)
+ : undefined,
+ }
+
+ if (isToolCall(context)) {
+ for (const [key, value] of Object.entries(toolParams)) {
+ if (value === undefined) toolParams[key] = params[key]
+ }
+ }
+
+ return {
+ ...toolParams,
+ fieldEntityType: undefined,
+ noteEntityType: undefined,
+ mergeEntityType: undefined,
+ reminderEntityType: undefined,
+ listName: undefined,
+ listType: undefined,
+ optionType: undefined,
+ optionText: undefined,
+ optionRank: undefined,
+ optionColor: undefined,
+ optionStatusCategory: undefined,
+ optionWinRate: undefined,
+ fieldValue: undefined,
+ fieldUpdates: undefined,
+ searchFilters: undefined,
+ searchSorts: undefined,
+ searchTermFieldIds: undefined,
+ searchIds: undefined,
+ scopeCompanyId: undefined,
+ entityIds: undefined,
+ valueFieldIds: undefined,
+ valueFieldTypes: undefined,
+ noteType: undefined,
+ noteHtml: undefined,
+ noteCompanyIds: undefined,
+ notePersonIds: undefined,
+ noteOpportunityIds: undefined,
+ noteCreatedAt: undefined,
+ reminderType: undefined,
+ reminderContent: undefined,
+ connectionFilter: undefined,
+ relationshipOrderBy: undefined,
+ changeOrderBy: undefined,
+ noteIncludes: undefined,
+ fieldIncludes: undefined,
+ }
+ }),
},
},
diff --git a/apps/sim/blocks/blocks/agentmail.test.ts b/apps/sim/blocks/blocks/agentmail.test.ts
new file mode 100644
index 00000000000..5959ce72671
--- /dev/null
+++ b/apps/sim/blocks/blocks/agentmail.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from 'vitest'
+import { AgentMailBlock } from '@/blocks/blocks/agentmail'
+
+/** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */
+function toolCall(args: Record, operation: string) {
+ const mapParams = AgentMailBlock.tools.config?.params
+ if (!mapParams) throw new Error('AgentMail block has no params mapper')
+ return { ...args, ...mapParams(args, { operation }) }
+}
+
+describe('AgentMailBlock agent tool calls', () => {
+ it('maps the block-field reply message key and keeps the model recipients and flags', () => {
+ expect(
+ toolCall(
+ { inboxId: 'inbox', replyMessageId: 'msg-1', to: 'a@example.com', replyAll: true },
+ 'reply_message'
+ )
+ ).toMatchObject({ messageId: 'msg-1', to: 'a@example.com', replyAll: true })
+ })
+
+ it('keeps a boolean permanent flag from the model', () => {
+ expect(
+ toolCall({ inboxId: 'inbox', threadId: 't-1', permanent: true }, 'delete_thread')
+ ).toMatchObject({ permanent: true })
+ })
+
+ it('treats a stored "false" permanent dropdown as a trash move, not a permanent delete', () => {
+ expect(
+ toolCall({ inboxId: 'inbox', threadId: 't-1', permanent: 'false' }, 'delete_thread')
+ ).toMatchObject({ permanent: false })
+ })
+
+ it('treats a stored "false" reply-all dropdown as a reply to the sender only', () => {
+ expect(
+ toolCall({ inboxId: 'inbox', replyMessageId: 'msg-1', replyAll: 'false' }, 'reply_message')
+ ).toMatchObject({ replyAll: false })
+ })
+})
diff --git a/apps/sim/blocks/blocks/agentmail.ts b/apps/sim/blocks/blocks/agentmail.ts
index db6048ac1d3..d2f79653304 100644
--- a/apps/sim/blocks/blocks/agentmail.ts
+++ b/apps/sim/blocks/blocks/agentmail.ts
@@ -1,7 +1,7 @@
import { AgentMailIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const AgentMailBlock: BlockConfig = {
type: 'agentmail',
@@ -567,9 +567,9 @@ export const AgentMailBlock: BlockConfig = {
],
config: {
tool: (params) => `agentmail_${params.operation || 'send_message'}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
inboxIdParam,
permanent,
replyMessageId,
@@ -590,11 +590,11 @@ export const AgentMailBlock: BlockConfig = {
}
if (operation === 'delete_thread' && permanent !== undefined) {
- rest.permanent = permanent === 'true'
+ rest.permanent = permanent === true || permanent === 'true'
}
if (operation === 'reply_message' && replyAll !== undefined) {
- rest.replyAll = replyAll === 'true'
+ rest.replyAll = replyAll === true || replyAll === 'true'
}
if (operation === 'reply_message' && replyMessageId) {
@@ -604,7 +604,7 @@ export const AgentMailBlock: BlockConfig = {
if (operation === 'reply_message' && replyTo) {
rest.to = replyTo
} else if (operation === 'reply_message') {
- rest.to = undefined
+ rest.to = toolCallArg(context, rest.to)
}
if (operation === 'forward_message' && forwardMessageId) {
diff --git a/apps/sim/blocks/blocks/agentphone.test.ts b/apps/sim/blocks/blocks/agentphone.test.ts
new file mode 100644
index 00000000000..987946d1a89
--- /dev/null
+++ b/apps/sim/blocks/blocks/agentphone.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from 'vitest'
+import { AgentPhoneBlock } from '@/blocks/blocks/agentphone'
+
+/** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */
+function toolCall(args: Record, operation: string) {
+ const mapParams = AgentPhoneBlock.tools.config?.params
+ if (!mapParams) throw new Error('AgentPhone block has no params mapper')
+ return { ...args, ...mapParams(args, { operation }) }
+}
+
+describe('AgentPhoneBlock agent tool calls', () => {
+ it('maps block-field filters and coerces limits for an operation passed only in context', () => {
+ expect(
+ toolCall({ apiKey: 'key', callsStatus: 'completed', limit: '25' }, 'list_calls')
+ ).toMatchObject({ status: 'completed', limit: 25 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/agentphone.ts b/apps/sim/blocks/blocks/agentphone.ts
index 2212123f5dc..0159154666d 100644
--- a/apps/sim/blocks/blocks/agentphone.ts
+++ b/apps/sim/blocks/blocks/agentphone.ts
@@ -2,7 +2,7 @@ import { toError } from '@sim/utils/errors'
import { AgentPhoneIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
const CONVERSATION_OPS = [
'get_conversation',
@@ -588,9 +588,9 @@ export const AgentPhoneBlock: BlockConfig = {
],
config: {
tool: (params) => `agentphone_${params.operation || 'create_number'}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
attachAgentId,
callAgentId,
toNumberCall,
@@ -633,7 +633,7 @@ export const AgentPhoneBlock: BlockConfig = {
if (messageBody !== undefined) rest.body = messageBody
}
- if (['create_contact', 'update_contact'].includes(operation as string)) {
+ if (['create_contact', 'update_contact'].includes(operation)) {
if (contactPhoneNumber) rest.phoneNumber = contactPhoneNumber
if (contactName) rest.name = contactName
if (contactEmail) rest.email = contactEmail
diff --git a/apps/sim/blocks/blocks/airtable.ts b/apps/sim/blocks/blocks/airtable.ts
index 139dafaa2ad..e6f8d1f4329 100644
--- a/apps/sim/blocks/blocks/airtable.ts
+++ b/apps/sim/blocks/blocks/airtable.ts
@@ -3,7 +3,7 @@ import { AirtableIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { toolCallArg } from '@/blocks/utils'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/** Canonical account pair — an advanced-mode card only fills `manualCredential`. */
@@ -429,7 +429,7 @@ Return ONLY the valid JSON array of record ID strings - no explanations, no mark
...rest
} = params
/** Agent tool calls carry the stored operation only on `context`, not in `params`. */
- const operation = params.operation ?? context?.operation
+ const operation = mapperOperation(params, context)
let parsedRecords: unknown
let parsedFields: unknown
let parsedFieldsToMergeOn: unknown
diff --git a/apps/sim/blocks/blocks/algolia.test.ts b/apps/sim/blocks/blocks/algolia.test.ts
new file mode 100644
index 00000000000..c5c3c4e9d44
--- /dev/null
+++ b/apps/sim/blocks/blocks/algolia.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, it } from 'vitest'
+import { AlgoliaBlock } from '@/blocks/blocks/algolia'
+
+/** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */
+function toolCall(args: Record, operation: string) {
+ const mapParams = AlgoliaBlock.tools.config?.params
+ if (!mapParams) throw new Error('Algolia block has no params mapper')
+ return { ...args, ...mapParams(args, { operation }) }
+}
+
+describe('AlgoliaBlock agent tool calls', () => {
+ it('maps the block-field requests key on a tool call', () => {
+ expect(
+ toolCall({ indexName: 'products', getRecordsRequests: '[{"objectID":"1"}]' }, 'get_records')
+ ).toMatchObject({ requests: '[{"objectID":"1"}]' })
+ })
+
+ it('keeps the model filters, requests, and copy-or-move operation', () => {
+ expect(toolCall({ indexName: 'p', filters: 'brand:x' }, 'delete_by_filter')).toMatchObject({
+ filters: 'brand:x',
+ })
+ expect(
+ toolCall({ indexName: 'p', requests: [{ objectID: '1' }] }, 'get_records')
+ ).toMatchObject({ requests: [{ objectID: '1' }] })
+ expect(
+ toolCall({ indexName: 'p', destination: 'q', operation: 'move' }, 'copy_move_index')
+ ).toMatchObject({ operation: 'move' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/algolia.ts b/apps/sim/blocks/blocks/algolia.ts
index fbcbe319e9e..077b1164aa5 100644
--- a/apps/sim/blocks/blocks/algolia.ts
+++ b/apps/sim/blocks/blocks/algolia.ts
@@ -1,7 +1,7 @@
import { AlgoliaIcon } 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 { isToolCall, mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const AlgoliaBlock: BlockConfig = {
type: 'algolia',
@@ -593,11 +593,11 @@ Return ONLY the JSON array.`,
],
config: {
tool: (params: Record) => `algolia_${params.operation}`,
- params: (params: Record) => {
- const { operation, ...rest } = params
+ params: (params: Record, context?: BlockToolParamsContext) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
- for (const [key, value] of Object.entries(rest)) {
+ for (const [key, value] of Object.entries(params)) {
if (value === undefined || value === null || value === '') continue
result[key] = value
}
@@ -618,15 +618,18 @@ Return ONLY the JSON array.`,
result.getRankingInfo = toBool(result.getRankingInfo, false)
}
if (operation === 'copy_move_index') {
- result.operation = result.copyMoveOperation
+ // A tool call carries the tool's own copy-or-move `operation` as a model arg.
+ if (!isToolCall(context) || result.copyMoveOperation !== undefined) {
+ result.operation = result.copyMoveOperation
+ }
result.copyMoveOperation = undefined
}
if (operation === 'delete_by_filter') {
- result.filters = result.deleteFilters
+ result.filters = result.deleteFilters ?? toolCallArg(context, result.filters)
result.deleteFilters = undefined
}
if (operation === 'get_records') {
- result.requests = result.getRecordsRequests
+ result.requests = result.getRecordsRequests ?? toolCallArg(context, result.requests)
result.getRecordsRequests = undefined
}
diff --git a/apps/sim/blocks/blocks/amplitude.test.ts b/apps/sim/blocks/blocks/amplitude.test.ts
new file mode 100644
index 00000000000..3c4cbc212b2
--- /dev/null
+++ b/apps/sim/blocks/blocks/amplitude.test.ts
@@ -0,0 +1,20 @@
+import { describe, expect, it } from 'vitest'
+import { AmplitudeBlock } from '@/blocks/blocks/amplitude'
+
+/** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */
+function toolCall(args: Record, operation: string) {
+ const mapParams = AmplitudeBlock.tools.config?.params
+ if (!mapParams) throw new Error('Amplitude block has no params mapper')
+ return { ...args, ...mapParams(args, { operation }) }
+}
+
+describe('AmplitudeBlock agent tool calls', () => {
+ it('maps the block-field event key for an operation passed only in context', () => {
+ expect(
+ toolCall(
+ { apiKey: 'k', secretKey: 's', segmentationEventType: 'signup', start: '20260101' },
+ 'event_segmentation'
+ )
+ ).toMatchObject({ eventType: 'signup', start: '20260101' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/amplitude.ts b/apps/sim/blocks/blocks/amplitude.ts
index 22ff60e1c80..f2975f113e0 100644
--- a/apps/sim/blocks/blocks/amplitude.ts
+++ b/apps/sim/blocks/blocks/amplitude.ts
@@ -1,6 +1,6 @@
import { AmplitudeIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
/*
* Amplitude identifies a person by user id or device id — either one alone is
@@ -1012,10 +1012,10 @@ export const AmplitudeBlock: BlockConfig = {
],
config: {
tool: (params) => `amplitude_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'send_event':
if (params.sendEventUserProperties)
result.userProperties = params.sendEventUserProperties
diff --git a/apps/sim/blocks/blocks/apollo.test.ts b/apps/sim/blocks/blocks/apollo.test.ts
new file mode 100644
index 00000000000..3af28753040
--- /dev/null
+++ b/apps/sim/blocks/blocks/apollo.test.ts
@@ -0,0 +1,59 @@
+import { describe, expect, it } from 'vitest'
+import { ApolloBlock } from '@/blocks/blocks/apollo'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** The block's `tools.config.params` mapper; `context` is set on a tool call, absent on the canvas. */
+const buildParams = (
+ inputs: Record,
+ context?: BlockToolParamsContext
+): Record => ApolloBlock.tools.config?.params?.(inputs, context) ?? {}
+
+/**
+ * On an agent call the stored row params merge with the model args (keyed by the tool's param
+ * names), the operation reaches the mapper only on `context`, and the handler forwards
+ * `{ ...merged, ...mapped }`.
+ */
+describe('ApolloBlock agent tool calls', () => {
+ const agentCall = (
+ operation: string,
+ merged: Record
+ ): Record => {
+ return { ...merged, ...buildParams(merged, { operation }) }
+ }
+
+ it('forwards the row acting user and label names to sequence_add_contacts', () => {
+ const mapped = agentCall('sequence_add', {
+ apiKey: 'key',
+ sequence_id: 'seq_1',
+ contact_ids: ['c_1'],
+ send_email_from_email_account_id: 'ea_1',
+ sequence_user_id: 'user_1',
+ sequence_add_label_names: '["outbound"]',
+ })
+ expect(mapped).toMatchObject({ user_id: 'user_1', label_names: ['outbound'] })
+ expect(mapped.sequence_user_id).toBeUndefined()
+ expect(mapped.sequence_add_label_names).toBeUndefined()
+ })
+
+ it('sends the row initial status over a stale task status carried from another operation', () => {
+ const mapped = agentCall('sequence_add', {
+ apiKey: 'key',
+ sequence_id: 'seq_1',
+ contact_ids: ['c_1'],
+ send_email_from_email_account_id: 'ea_1',
+ sequence_status: 'paused',
+ status: 'scheduled',
+ })
+ expect(mapped.status).toBe('paused')
+ })
+
+ it('keeps the row initial status on the canvas', () => {
+ const mapped = buildParams({
+ operation: 'sequence_add',
+ apiKey: 'key',
+ sequence_status: 'paused',
+ status: 'active',
+ })
+ expect(mapped.status).toBe('paused')
+ })
+})
diff --git a/apps/sim/blocks/blocks/apollo.ts b/apps/sim/blocks/blocks/apollo.ts
index aba5a2b5a8a..7a851822308 100644
--- a/apps/sim/blocks/blocks/apollo.ts
+++ b/apps/sim/blocks/blocks/apollo.ts
@@ -3,7 +3,7 @@ import { getErrorMessage } from '@sim/utils/errors'
import { ApolloIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
/** Identifies a person by email when available, otherwise by given name. */
const PERSON_IDENTITY_FIELD = ['email', 'first_name'] as const
@@ -1112,7 +1112,8 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
throw new Error(`Invalid Apollo operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const { apiKey, ...rest } = params
const parsedParams: Record = { apiKey, ...rest }
@@ -1190,7 +1191,7 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
}
}
- if (params.operation === 'organization_bulk_enrich') {
+ if (operation === 'organization_bulk_enrich') {
// Back-compat: workflows saved before the `organizations` → `domains` rename stored an
// array of { name, domain? } objects (or plain strings) under `organizations`. Derive
// `domains` from it so those workflows keep running without manual migration.
@@ -1213,7 +1214,7 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
parsedParams.organizations = undefined
}
- if (params.operation === 'contact_bulk_update') {
+ if (operation === 'contact_bulk_update') {
const { ids, attributes } = splitBulkUpdateInput(parsedParams.contacts)
if (attributes) {
if (parsedParams.contact_attributes === undefined) {
@@ -1225,7 +1226,7 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
parsedParams.contacts = undefined
}
- if (params.operation === 'account_bulk_update') {
+ if (operation === 'account_bulk_update') {
const { ids, attributes } = splitBulkUpdateInput(parsedParams.accounts)
if (attributes) {
if (parsedParams.account_attributes === undefined) {
@@ -1249,23 +1250,23 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
parsedParams.account_bulk_update_account_stage_id = undefined
}
- if (params.operation === 'contact_create') {
+ if (operation === 'contact_create') {
if (rest.contact_run_dedupe !== undefined) {
parsedParams.run_dedupe = rest.contact_run_dedupe
}
parsedParams.contact_run_dedupe = undefined
}
- if (params.operation === 'account_create' || params.operation === 'account_update') {
+ if (operation === 'account_create' || operation === 'account_update') {
if (rest.account_name) parsedParams.name = rest.account_name
parsedParams.account_name = undefined
}
- if (params.operation === 'account_update') {
+ if (operation === 'account_update') {
parsedParams.account_id = rest.account_id
}
- if (params.operation === 'sequence_add') {
+ if (operation === 'sequence_add') {
if (parsedParams.sequence_add_label_names !== undefined) {
parsedParams.label_names = parsedParams.sequence_add_label_names
}
@@ -1280,17 +1281,14 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
parsedParams.sequence_status = undefined
}
- if (params.operation === 'task_create') {
+ if (operation === 'task_create') {
if (rest.task_notes !== undefined) {
parsedParams.note = rest.task_notes
}
parsedParams.task_notes = undefined
}
- if (
- params.operation === 'opportunity_create' ||
- params.operation === 'opportunity_update'
- ) {
+ if (operation === 'opportunity_create' || operation === 'opportunity_update') {
if (rest.opportunity_name) parsedParams.name = rest.opportunity_name
parsedParams.opportunity_name = undefined
}
diff --git a/apps/sim/blocks/blocks/asana.ts b/apps/sim/blocks/blocks/asana.ts
index 37f4325dbd3..c7678b64c98 100644
--- a/apps/sim/blocks/blocks/asana.ts
+++ b/apps/sim/blocks/blocks/asana.ts
@@ -2,7 +2,7 @@ import { AsanaIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { toolCallArg } from '@/blocks/utils'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
const WORKSPACE_FIELD = ['workspaceSelector', 'workspace'] as const
const GET_TASKS_WORKSPACE_FIELD = ['getTasksWorkspaceSelector', 'getTasks_workspace'] as const
@@ -521,7 +521,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
params: (params, context) => {
const { oauthCredential } = params
/** Agent tool calls carry the stored operation only on `context`, not in `params`. */
- const operation = params.operation ?? context?.operation
+ const operation = mapperOperation(params, context)
const splitGids = (value: unknown): string[] | undefined => {
if (Array.isArray(value)) return value.map(String)
diff --git a/apps/sim/blocks/blocks/ashby.test.ts b/apps/sim/blocks/blocks/ashby.test.ts
index 4678e846694..f4211b5dc1b 100644
--- a/apps/sim/blocks/blocks/ashby.test.ts
+++ b/apps/sim/blocks/blocks/ashby.test.ts
@@ -1,6 +1,9 @@
import { describe, expect, it } from 'vitest'
import { AshbyBlock } from './ashby'
+const blockParams = AshbyBlock.tools.config?.params
+if (!blockParams) throw new Error('AshbyBlock has no params mapper')
+
describe('AshbyBlock', () => {
const buildParams = (operation: string, extra: Record) => ({
operation,
@@ -9,7 +12,7 @@ describe('AshbyBlock', () => {
describe('alternateEmailAddresses parsing (create_candidate)', () => {
it('parses a comma-separated string into an array', () => {
- const result = AshbyBlock.tools.config.params!(
+ const result = blockParams(
buildParams('create_candidate', {
alternateEmailAddresses: 'a@x.com, b@x.com',
})
@@ -20,9 +23,7 @@ describe('AshbyBlock', () => {
describe('socialLinks parsing (update_candidate)', () => {
it('preserves an empty JSON array so users can clear all social links', () => {
- const result = AshbyBlock.tools.config.params!(
- buildParams('update_candidate', { socialLinks: '[]' })
- )
+ const result = blockParams(buildParams('update_candidate', { socialLinks: '[]' }))
expect(result.socialLinks).toEqual([])
})
@@ -30,24 +31,20 @@ describe('AshbyBlock', () => {
// A silent [] here would let the Ashby update proceed without applying
// the requested links and with no error shown to the workflow author.
expect(() =>
- AshbyBlock.tools.config.params!(
- buildParams('update_candidate', { socialLinks: 'not json' })
- )
+ blockParams(buildParams('update_candidate', { socialLinks: 'not json' }))
).toThrow(/Invalid JSON in Ashby social links/)
})
it('throws when the parsed JSON is not an array', () => {
expect(() =>
- AshbyBlock.tools.config.params!(
- buildParams('update_candidate', { socialLinks: '{"type":"Twitter"}' })
- )
+ blockParams(buildParams('update_candidate', { socialLinks: '{"type":"Twitter"}' }))
).toThrow(/expected a JSON array/)
})
})
describe('nullable candidate updates', () => {
it('preserves nulls from dynamic references for aliased update fields', () => {
- const result = AshbyBlock.tools.config.params!(
+ const result = blockParams(
buildParams('update_candidate', {
updateName: null,
candidateLocation: null,
@@ -63,17 +60,14 @@ describe('AshbyBlock', () => {
describe('archiveEmail parsing (change_application_stage)', () => {
it('rejects non-object archive email input', () => {
expect(() =>
- AshbyBlock.tools.config.params!(
- buildParams('change_application_stage', { archiveEmail: 'true' })
- )
+ blockParams(buildParams('change_application_stage', { archiveEmail: 'true' }))
).toThrow(/expected a JSON object/)
})
})
describe('fieldValue parsing (set_custom_field_value)', () => {
const parse = (fieldValue: unknown) =>
- AshbyBlock.tools.config.params!(buildParams('set_custom_field_value', { fieldValue }))
- .fieldValue
+ blockParams(buildParams('set_custom_field_value', { fieldValue })).fieldValue
it('decodes null so the annotation can be cleared', () => {
// Ashby clears a custom field when it receives an explicit null, which is
@@ -106,17 +100,13 @@ describe('AshbyBlock', () => {
describe('fieldValues parsing (set_custom_field_values)', () => {
it('throws instead of silently dropping the writes when the JSON is malformed', () => {
expect(() =>
- AshbyBlock.tools.config.params!(
- buildParams('set_custom_field_values', { fieldValues: 'not json' })
- )
+ blockParams(buildParams('set_custom_field_values', { fieldValues: 'not json' }))
).toThrow(/Invalid JSON in Ashby custom field values/)
})
it('throws when the parsed JSON is not an array', () => {
expect(() =>
- AshbyBlock.tools.config.params!(
- buildParams('set_custom_field_values', { fieldValues: '{"fieldId":"abc"}' })
- )
+ blockParams(buildParams('set_custom_field_values', { fieldValues: '{"fieldId":"abc"}' }))
).toThrow(/expected a JSON array/)
})
})
@@ -126,7 +116,7 @@ describe('AshbyBlock', () => {
// The Source ID field is hidden once the clear switch is on, but a value
// typed beforehand is still stored. Sending both would trip the tool's
// exclusivity guard and surface as an error the user cannot see the cause of.
- const result = AshbyBlock.tools.config.params!(
+ const result = blockParams(
buildParams('change_application_source', {
changeSourceId: 'src-left-over',
unsetSource: 'true',
@@ -146,7 +136,7 @@ describe('AshbyBlock', () => {
// result, not just the mapping, since that gap is where the bug lived.
const merge = (inputs: Record) => ({
...inputs,
- ...AshbyBlock.tools.config.params!(inputs),
+ ...blockParams(inputs),
})
const cleared = merge(
@@ -179,4 +169,33 @@ describe('AshbyBlock', () => {
expect(explicit.sourceId).toBe('src-intended')
})
})
+ describe('agent tool calls (operation only in context)', () => {
+ const toolCall = (operation: string, args: Record) => ({
+ ...args,
+ ...blockParams(args, { operation }),
+ })
+
+ it('maps block-only fields saved on the tool row to the tool params', () => {
+ const result = toolCall('create_application', {
+ appCandidateId: 'cand-1',
+ appCreatedAt: '2026-01-01T00:00:00Z',
+ jobId: 'job-1',
+ })
+ expect(result.candidateId).toBe('cand-1')
+ expect(result.createdAt).toBe('2026-01-01T00:00:00Z')
+ })
+
+ it('keeps model args keyed by the tool param names', () => {
+ const values = [{ fieldId: 'f-1', fieldValue: 'High' }]
+ expect(
+ toolCall('set_custom_field_values', { objectType: 'Candidate', objectId: 'c-1', values })
+ .values
+ ).toEqual(values)
+ expect(
+ toolCall('change_application_source', { applicationId: 'app-1', sourceId: 'src-1' })
+ .sourceId
+ ).toBe('src-1')
+ expect(toolCall('search_candidates', { name: 'Ada', limit: 5 }).limit).toBe(5)
+ })
+ })
})
diff --git a/apps/sim/blocks/blocks/ashby.ts b/apps/sim/blocks/blocks/ashby.ts
index 7c3d6af7950..b04c6993f08 100644
--- a/apps/sim/blocks/blocks/ashby.ts
+++ b/apps/sim/blocks/blocks/ashby.ts
@@ -1,7 +1,12 @@
import { getErrorMessage } from '@sim/utils/errors'
import { AshbyIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
function parseStringListInput(value: unknown): string[] {
@@ -1420,7 +1425,8 @@ Output only the JSON array.`,
],
config: {
tool: (params) => `ashby_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
if (params.perPage) result.perPage = Number(params.perPage)
if (params.searchName) result.name = params.searchName
@@ -1466,7 +1472,7 @@ Output only the JSON array.`,
params.includeUnpublishedJobPostingIds === 'true' ||
params.includeUnpublishedJobPostingIds === true
) {
- if (params.operation === 'list_jobs') result.includeUnpublishedJobPostingsIds = true
+ if (operation === 'list_jobs') result.includeUnpublishedJobPostingsIds = true
else result.includeUnpublishedJobPostingIds = true
}
if (params.excludeFormDefinition === 'true' || params.excludeFormDefinition === true) {
@@ -1486,7 +1492,7 @@ Output only the JSON array.`,
if (applicationHistory.length > 0) result.applicationHistory = applicationHistory
}
if (
- (params.operation === 'create_candidate' || params.operation === 'update_candidate') &&
+ (operation === 'create_candidate' || operation === 'update_candidate') &&
params.candidateLocation !== undefined &&
params.candidateLocation !== ''
) {
@@ -1507,28 +1513,30 @@ Output only the JSON array.`,
) {
result.startAutomaticActivities = true
}
- if (params.operation === 'search_jobs' || params.operation === 'search_candidates') {
- result.limit = params.perPage ? Number(params.perPage) : undefined
+ if (operation === 'search_jobs' || operation === 'search_candidates') {
+ result.limit = params.perPage
+ ? Number(params.perPage)
+ : toolCallArg(context, params.limit)
}
- if (params.operation === 'upload_resume' || params.operation === 'upload_candidate_file') {
+ if (operation === 'upload_resume' || operation === 'upload_candidate_file') {
const file = normalizeFileInput(params.file, { single: true })
if (!file) throw new Error('A candidate file is required.')
result.file = file
}
- if (params.operation === 'create_application' && params.appCandidateId) {
+ if (operation === 'create_application' && params.appCandidateId) {
result.candidateId = params.appCandidateId
}
- if (params.operation === 'create_application' && params.appCreatedAt) {
+ if (operation === 'create_application' && params.appCreatedAt) {
result.createdAt = params.appCreatedAt
}
if (
- (params.operation === 'create_candidate' || params.operation === 'update_candidate') &&
+ (operation === 'create_candidate' || operation === 'update_candidate') &&
params.candidateCreatedAt !== undefined &&
params.candidateCreatedAt !== ''
) {
result.createdAt = params.candidateCreatedAt
}
- if (params.operation === 'create_note' && params.noteCreatedAt) {
+ if (operation === 'create_note' && params.noteCreatedAt) {
result.createdAt = params.noteCreatedAt
}
if (params.updateName !== undefined && params.updateName !== '') {
@@ -1544,7 +1552,7 @@ Output only the JSON array.`,
) {
result.includeLocationHierarchy = true
}
- if (params.operation === 'list_offers' && params.offerApplicationId) {
+ if (operation === 'list_offers' && params.offerApplicationId) {
result.applicationId = params.offerApplicationId
}
if (params.alternateEmailAddresses) {
@@ -1559,13 +1567,15 @@ Output only the JSON array.`,
result.socialLinks = parseSocialLinksInput(socialLinksValue)
}
}
- if (params.operation === 'set_custom_field_value') {
+ if (operation === 'set_custom_field_value') {
result.fieldValue = parseCustomFieldValueInput(params.fieldValue)
}
- if (params.operation === 'set_custom_field_values') {
- result.values = parseCustomFieldValuesInput(params.fieldValues)
+ if (operation === 'set_custom_field_values') {
+ result.values = parseCustomFieldValuesInput(
+ params.fieldValues || toolCallArg(context, params.values)
+ )
}
- if (params.operation === 'change_application_source') {
+ if (operation === 'change_application_source') {
// sourceId is always assigned, never conditionally, because the executor
// merges `{ ...inputs, ...transformedParams }` and a key this mapping
// leaves unset simply inherits whatever was in inputs. The create-path
@@ -1576,8 +1586,9 @@ Output only the JSON array.`,
// Inheriting it would attribute a source nobody asked for, or collide
// with a clear request and fail with no visible cause.
const unsetSource = params.unsetSource === 'true' || params.unsetSource === true
+ const requestedSourceId = params.changeSourceId || toolCallArg(context, params.sourceId)
const changeSourceId =
- typeof params.changeSourceId === 'string' ? params.changeSourceId.trim() : ''
+ typeof requestedSourceId === 'string' ? requestedSourceId.trim() : ''
result.sourceId = unsetSource || !changeSourceId ? undefined : changeSourceId
if (unsetSource) result.unsetSource = true
}
diff --git a/apps/sim/blocks/blocks/athena.test.ts b/apps/sim/blocks/blocks/athena.test.ts
new file mode 100644
index 00000000000..cdbee96774b
--- /dev/null
+++ b/apps/sim/blocks/blocks/athena.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from 'vitest'
+import { AthenaBlock } from '@/blocks/blocks/athena'
+
+/**
+ * An agent tool call sends model args under the tool's param names (`workGroup`, `queryStatement`,
+ * `name`) with the operation only on `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+const agentCall = (operation: string, args: Record): Record => ({
+ ...args,
+ ...(AthenaBlock.tools.config?.params?.(args, { operation }) ?? {}),
+})
+
+const CREDENTIALS = { awsRegion: 'us-east-1', awsAccessKeyId: 'AKIA', awsSecretAccessKey: 'secret' }
+
+describe('AthenaBlock agent tool calls', () => {
+ it('keeps the model prepared statement workgroup and statement instead of throwing', () => {
+ expect(
+ agentCall('create_prepared_statement', {
+ ...CREDENTIALS,
+ statementName: 'by_day',
+ workGroup: 'primary',
+ queryStatement: 'SELECT * FROM t WHERE d = ?',
+ description: 'Daily rows',
+ })
+ ).toMatchObject({
+ statementName: 'by_day',
+ workGroup: 'primary',
+ queryStatement: 'SELECT * FROM t WHERE d = ?',
+ description: 'Daily rows',
+ })
+ })
+
+ it('keeps the model catalog name and coerces maxResults on list calls', () => {
+ expect(agentCall('get_data_catalog', { ...CREDENTIALS, name: 'AwsDataCatalog' })).toMatchObject(
+ { name: 'AwsDataCatalog' }
+ )
+ expect(agentCall('list_named_queries', { ...CREDENTIALS, maxResults: '5' })).toMatchObject({
+ maxResults: 5,
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/athena.ts b/apps/sim/blocks/blocks/athena.ts
index eb99711a3ca..a3b2d4580c2 100644
--- a/apps/sim/blocks/blocks/athena.ts
+++ b/apps/sim/blocks/blocks/athena.ts
@@ -1,7 +1,7 @@
import { AthenaIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/**
* Normalizes a switch value that may arrive as a boolean or as the strings 'true' / 'false'.
@@ -681,8 +681,9 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
throw new Error(`Invalid Athena operation: ${params.operation}`)
}
},
- params: (params) => {
- const { operation, maxResults, ...rest } = params
+ params: (params, context) => {
+ const { maxResults, ...rest } = params
+ const operation = mapperOperation(params, context)
const awsRegion = rest.awsRegion
const awsAccessKeyId = rest.awsAccessKeyId
@@ -696,6 +697,9 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
rest.resultReuseMaxAgeInMinutes !== ''
? Number.parseInt(String(rest.resultReuseMaxAgeInMinutes), 10)
: undefined
+ const queryName = rest.queryName || toolCallArg(context, rest.name)
+ const queryDescription = rest.queryDescription || toolCallArg(context, rest.description)
+ const workGroupName = rest.workGroupName || toolCallArg(context, rest.workGroup)
switch (operation) {
case 'start_query':
@@ -766,7 +770,7 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
}
case 'create_named_query': {
- if (!rest.queryName) {
+ if (!queryName) {
throw new Error('Query name is required')
}
if (!rest.database) {
@@ -779,10 +783,10 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
awsRegion,
awsAccessKeyId,
awsSecretAccessKey,
- name: rest.queryName,
+ name: queryName,
database: rest.database,
queryString: rest.queryString,
- ...(rest.queryDescription && { description: rest.queryDescription }),
+ ...(queryDescription && { description: queryDescription }),
...(rest.workGroup && { workGroup: rest.workGroup }),
}
}
@@ -879,7 +883,7 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
if (!rest.namedQueryId) {
throw new Error('Named query ID is required')
}
- if (!rest.queryName) {
+ if (!queryName) {
throw new Error('Query name is required')
}
if (!rest.queryString) {
@@ -888,64 +892,66 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
return {
...connection,
namedQueryId: rest.namedQueryId,
- name: rest.queryName,
+ name: queryName,
queryString: rest.queryString,
- ...(rest.queryDescription && { description: rest.queryDescription }),
+ ...(queryDescription && { description: queryDescription }),
}
case 'create_prepared_statement':
- case 'update_prepared_statement':
+ case 'update_prepared_statement': {
+ const queryStatement = rest.queryString || toolCallArg(context, rest.queryStatement)
if (!rest.statementName) {
throw new Error('Statement name is required')
}
- if (!rest.workGroupName) {
+ if (!workGroupName) {
throw new Error('Workgroup is required')
}
- if (!rest.queryString) {
+ if (!queryStatement) {
throw new Error('SQL query statement is required')
}
return {
...connection,
statementName: rest.statementName,
- workGroup: rest.workGroupName,
- queryStatement: rest.queryString,
- ...(rest.queryDescription && { description: rest.queryDescription }),
+ workGroup: workGroupName,
+ queryStatement,
+ ...(queryDescription && { description: queryDescription }),
}
+ }
case 'get_prepared_statement':
case 'delete_prepared_statement':
if (!rest.statementName) {
throw new Error('Statement name is required')
}
- if (!rest.workGroupName) {
+ if (!workGroupName) {
throw new Error('Workgroup is required')
}
return {
...connection,
statementName: rest.statementName,
- workGroup: rest.workGroupName,
+ workGroup: workGroupName,
}
case 'batch_get_prepared_statement':
if (!rest.preparedStatementNames) {
throw new Error('Statement names are required')
}
- if (!rest.workGroupName) {
+ if (!workGroupName) {
throw new Error('Workgroup is required')
}
return {
...connection,
preparedStatementNames: rest.preparedStatementNames,
- workGroup: rest.workGroupName,
+ workGroup: workGroupName,
}
case 'list_prepared_statements':
- if (!rest.workGroupName) {
+ if (!workGroupName) {
throw new Error('Workgroup is required')
}
return {
...connection,
- workGroup: rest.workGroupName,
+ workGroup: workGroupName,
...(parsedMaxResults !== undefined && { maxResults: parsedMaxResults }),
...(rest.nextToken && { nextToken: rest.nextToken }),
}
@@ -958,15 +964,17 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
...(rest.nextToken && { nextToken: rest.nextToken }),
}
- case 'get_data_catalog':
- if (!rest.catalogName) {
+ case 'get_data_catalog': {
+ const catalogName = rest.catalogName || toolCallArg(context, rest.name)
+ if (!catalogName) {
throw new Error('Data catalog name is required')
}
return {
...connection,
- name: rest.catalogName,
+ name: catalogName,
...(rest.workGroup && { workGroup: rest.workGroup }),
}
+ }
case 'get_database':
if (!rest.catalogName) {
@@ -1008,10 +1016,10 @@ Return ONLY a JSON array of strings — no explanations, no markdown code blocks
}
case 'get_work_group':
- if (!rest.workGroupName) {
+ if (!workGroupName) {
throw new Error('Workgroup is required')
}
- return { ...connection, workGroup: rest.workGroupName }
+ return { ...connection, workGroup: workGroupName }
default:
throw new Error(`Invalid Athena operation: ${operation}`)
diff --git a/apps/sim/blocks/blocks/attio.ts b/apps/sim/blocks/blocks/attio.ts
index 37a9aff63ab..7b4a406f937 100644
--- a/apps/sim/blocks/blocks/attio.ts
+++ b/apps/sim/blocks/blocks/attio.ts
@@ -1,6 +1,7 @@
import { AttioIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/*
@@ -1613,7 +1614,7 @@ Record reference: {"allowed_objects": ["people", "companies"]}`,
const cleanParams: Record = {
oauthCredential: params.oauthCredential,
}
- const op = params.operation ?? context?.operation
+ const op = mapperOperation(params, context)
// Record params — each field is only sent for the operations whose subBlock condition
// actually exposes it, so a stale value left over from switching operations never leaks
diff --git a/apps/sim/blocks/blocks/azure_data_explorer.ts b/apps/sim/blocks/blocks/azure_data_explorer.ts
index 8327179942c..a4955d44ce4 100644
--- a/apps/sim/blocks/blocks/azure_data_explorer.ts
+++ b/apps/sim/blocks/blocks/azure_data_explorer.ts
@@ -1,7 +1,7 @@
import { AzureDataExplorerIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/** Every operation except the cluster-level database listing runs in a database. */
const DATABASE_SCOPED_OPERATIONS = [
@@ -423,7 +423,7 @@ export const AzureDataExplorerBlock: BlockConfig = {
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
const auth = {
clusterUri: params.clusterUri,
tenantId: params.tenantId,
@@ -432,7 +432,7 @@ export const AzureDataExplorerBlock: BlockConfig = {
resource: params.resource || undefined,
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'azure_data_explorer_query':
return {
...auth,
@@ -467,9 +467,13 @@ export const AzureDataExplorerBlock: BlockConfig = {
...auth,
database: params.database,
table: params.table,
- mode: params.ingestMode || undefined,
+ mode: params.ingestMode || toolCallArg(context, params.mode) || undefined,
sourceQuery: params.sourceQuery,
- async: toBoolean(params.ingestAsync),
+ async:
+ params.ingestAsync === false || params.ingestAsync === 'false'
+ ? undefined
+ : (toBoolean(params.ingestAsync) ??
+ toBoolean(toolCallArg(context, params.async))),
ingestionProperties: params.ingestionProperties || undefined,
}
case 'azure_data_explorer_create_table':
diff --git a/apps/sim/blocks/blocks/azure_devops.test.ts b/apps/sim/blocks/blocks/azure_devops.test.ts
index df28ca4d0fc..0d39de51e21 100644
--- a/apps/sim/blocks/blocks/azure_devops.test.ts
+++ b/apps/sim/blocks/blocks/azure_devops.test.ts
@@ -11,11 +11,12 @@ const buildParams = (
/**
* On an agent call the model supplies `continuationToken`/`top`/`iterationPath`/`format` under the
* tool's own names; the per-operation fields (`pipelinesContinuationToken`, `queryTop`, …) are never
- * rendered in the agent tool input. The handler forwards `{ ...inputs, ...mapped }`.
+ * rendered in the agent tool input. A tool call carries the operation only in `context`, and the
+ * handler forwards `{ ...inputs, ...mapped }`.
*/
describe('AzureDevOpsBlock agent tool calls', () => {
const agentCall = (operation: string, args: Record): Record => {
- const inputs = { ...args, operation, organization: 'org', project: 'proj' }
+ const inputs = { ...args, organization: 'org', project: 'proj' }
return { ...inputs, ...buildParams(inputs, { operation }) }
}
@@ -28,6 +29,21 @@ describe('AzureDevOpsBlock agent tool calls', () => {
}
)
+ it.each(['azure_devops_create_work_item', 'azure_devops_update_work_item'])(
+ 'keeps a model zero for remainingWork, completedWork and effort on %s',
+ (operation) => {
+ const mapped = agentCall(operation, {
+ workItemId: 5,
+ workItemType: 'Task',
+ title: 't',
+ remainingWork: 0,
+ completedWork: 0,
+ effort: 0,
+ })
+ expect([mapped.remainingWork, mapped.completedWork, mapped.effort]).toEqual([0, 0, 0])
+ }
+ )
+
it('keeps the model top on azure_devops_query_work_items', () => {
expect(agentCall('azure_devops_query_work_items', { wiqlQuery: 'q', top: 5 }).top).toBe(5)
})
@@ -45,6 +61,23 @@ describe('AzureDevOpsBlock agent tool calls', () => {
expect(mapped.format).toBe('markdown')
})
+ it('keeps the model ids on azure_devops_get_work_items_batch', () => {
+ expect(agentCall('azure_devops_get_work_items_batch', { ids: '1,2' }).ids).toBe('1,2')
+ })
+
+ it('keeps the model text on azure_devops_add_comment', () => {
+ expect(agentCall('azure_devops_add_comment', { workItemId: 1, text: 'hi' }).text).toBe('hi')
+ })
+
+ it('expands a bare model start date on azure_devops_create_work_item', () => {
+ const mapped = agentCall('azure_devops_create_work_item', {
+ workItemType: 'Epic',
+ title: 't',
+ startDate: '2026-01-15',
+ })
+ expect(mapped.startDate).toBe('2026-01-15T00:00:00Z')
+ })
+
it('drops a List Builds token left over on the canvas under list pipelines', () => {
const inputs = { operation: 'azure_devops_list_pipelines', continuationToken: 'stale' }
expect({ ...inputs, ...buildParams(inputs) }.continuationToken).toBeUndefined()
diff --git a/apps/sim/blocks/blocks/azure_devops.ts b/apps/sim/blocks/blocks/azure_devops.ts
index f4a0a56b46c..af8defd0c07 100644
--- a/apps/sim/blocks/blocks/azure_devops.ts
+++ b/apps/sim/blocks/blocks/azure_devops.ts
@@ -1,7 +1,7 @@
import { AzureIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { toolCallArg, withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import type { AzureDevOpsBasicWorkItemType } from '@/tools/azure_devops/types'
import { AZURE_DEVOPS_BASIC_WORK_ITEM_STATES } from '@/tools/azure_devops/utils'
import { getTrigger } from '@/triggers'
@@ -22,6 +22,11 @@ function resolveTop(dedicated: unknown, shared: unknown): number | undefined {
return value ? Number(value) : undefined
}
+/** Coerces an optional numeric field, keeping `0` (a model may send it to clear remaining work). */
+function optionalNumber(value: unknown): number | undefined {
+ return value === undefined || value === null || value === '' ? undefined : Number(value)
+}
+
export const AzureDevOpsBlock: BlockConfig = {
type: 'azure_devops',
hideFromToolbar: true,
@@ -724,7 +729,7 @@ export const AzureDevOpsBlock: BlockConfig = {
organization: params.organization as string,
project: params.project as string,
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'azure_devops_list_pipelines':
return {
...base,
@@ -782,7 +787,10 @@ export const AzureDevOpsBlock: BlockConfig = {
case 'azure_devops_get_work_item':
return { ...base, workItemId: Number(params.workItemId) }
case 'azure_devops_get_work_items_batch':
- return { ...base, ids: params.workItemIds as string }
+ return {
+ ...base,
+ ids: (params.workItemIds as string) || toolCallArg(context, params.ids as string),
+ }
case 'azure_devops_create_work_item':
return {
...base,
@@ -791,12 +799,12 @@ export const AzureDevOpsBlock: BlockConfig = {
description: (params.description as string) || undefined,
assignedTo: (params.assignedTo as string) || undefined,
priority: params.priority ? Number(params.priority) : undefined,
- effort: params.effort ? Number(params.effort) : undefined,
+ effort: optionalNumber(params.effort),
startDate: normalizeDate(params.startDate),
targetDate: normalizeDate(params.targetDate),
activity: (params.activity as string) || undefined,
- remainingWork: params.remainingWork ? Number(params.remainingWork) : undefined,
- completedWork: params.completedWork ? Number(params.completedWork) : undefined,
+ remainingWork: optionalNumber(params.remainingWork),
+ completedWork: optionalNumber(params.completedWork),
areaPath: (params.areaPath as string) || undefined,
iterationPath: (params.iterationPath as string) || undefined,
tags: (params.tags as string) || undefined,
@@ -809,12 +817,12 @@ export const AzureDevOpsBlock: BlockConfig = {
state: (params.state as string) || undefined,
assignedTo: (params.assignedTo as string) || undefined,
priority: params.priority ? Number(params.priority) : undefined,
- effort: params.effort ? Number(params.effort) : undefined,
+ effort: optionalNumber(params.effort),
startDate: normalizeDate(params.startDate),
targetDate: normalizeDate(params.targetDate),
activity: (params.activity as string) || undefined,
- remainingWork: params.remainingWork ? Number(params.remainingWork) : undefined,
- completedWork: params.completedWork ? Number(params.completedWork) : undefined,
+ remainingWork: optionalNumber(params.remainingWork),
+ completedWork: optionalNumber(params.completedWork),
description: (params.description as string) || undefined,
areaPath: (params.areaPath as string) || undefined,
iterationPath:
@@ -827,7 +835,7 @@ export const AzureDevOpsBlock: BlockConfig = {
return {
...base,
workItemId: Number(params.workItemId),
- text: params.commentText as string,
+ text: (params.commentText as string) || toolCallArg(context, params.text as string),
format:
(params.commentFormat as string) ||
toolCallArg(context, params.format) ||
diff --git a/apps/sim/blocks/blocks/bitbucket.test.ts b/apps/sim/blocks/blocks/bitbucket.test.ts
new file mode 100644
index 00000000000..7e765b3d855
--- /dev/null
+++ b/apps/sim/blocks/blocks/bitbucket.test.ts
@@ -0,0 +1,33 @@
+import { describe, expect, it } from 'vitest'
+import { BitbucketBlock } from '@/blocks/blocks/bitbucket'
+
+/**
+ * On a tool call the model supplies args under the tool's param names (`refName`, `reviewerUuids`,
+ * …) and the operation arrives only in `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+const toolCall = (operation: string, args: Record): Record => {
+ const inputs = { workspaceSlug: 'ws', repoSlug: 'repo', ...args }
+ return { ...inputs, ...BitbucketBlock.tools.config?.params?.(inputs, { operation }) }
+}
+
+describe('BitbucketBlock tool calls', () => {
+ it('defaults the ref type and keeps the model ref name on bitbucket_trigger_pipeline', () => {
+ const mapped = toolCall('bitbucket_trigger_pipeline', { refName: 'main' })
+ expect(mapped).toMatchObject({ refType: 'branch', refName: 'main' })
+ })
+
+ it('splits model reviewers and keeps closeSourceBranch on bitbucket_create_pull_request', () => {
+ const mapped = toolCall('bitbucket_create_pull_request', {
+ title: 'PR',
+ sourceBranch: 'feature',
+ reviewerUuids: '{a}, {b}',
+ closeSourceBranch: true,
+ })
+ expect(mapped).toMatchObject({ reviewerUuids: ['{a}', '{b}'], closeSourceBranch: true })
+ })
+
+ it('keeps the model commit, path and filter on bitbucket_list_directory', () => {
+ const mapped = toolCall('bitbucket_list_directory', { commit: 'abc', path: 'src', q: 'x' })
+ expect(mapped).toMatchObject({ commit: 'abc', path: 'src', q: 'x' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/bitbucket.ts b/apps/sim/blocks/blocks/bitbucket.ts
index 75f6a873b90..4fb95b28807 100644
--- a/apps/sim/blocks/blocks/bitbucket.ts
+++ b/apps/sim/blocks/blocks/bitbucket.ts
@@ -1,6 +1,7 @@
import { BitbucketIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const WORKSPACE_FIELD = ['workspacePicker', 'workspaceSlugInput'] as const
@@ -925,10 +926,21 @@ export const BitbucketBlock: BlockConfig = {
}
return params.operation
},
- params: (params) => {
- if (!isBitbucketOperation(params.operation)) {
- throw new Error(`Invalid Bitbucket operation: ${String(params.operation)}`)
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ if (!isBitbucketOperation(operation)) {
+ throw new Error(`Invalid Bitbucket operation: ${operation}`)
}
+ /**
+ * The block field, else (on a tool call only) the model's arg, which arrives under the
+ * tool's param name rather than the block field id.
+ */
+ const fieldOrModelArg = (
+ parse: (value: unknown, name: string) => T | undefined,
+ field: string,
+ toolParam: string
+ ): T | undefined =>
+ parse(params[field], field) ?? parse(toolCallArg(context, params[toolParam]), toolParam)
const common = {
oauthCredential: params.oauthCredential,
@@ -940,7 +952,7 @@ export const BitbucketBlock: BlockConfig = {
nextUrl: optionalString(params.nextUrl, 'nextUrl'),
}
- switch (params.operation) {
+ switch (operation) {
case 'bitbucket_list_workspaces':
return {
oauthCredential: params.oauthCredential,
@@ -953,30 +965,31 @@ export const BitbucketBlock: BlockConfig = {
oauthCredential: params.oauthCredential,
workspaceSlug: optionalString(params.workspaceSlug, 'workspaceSlug'),
role: optionalString(params.role, 'role'),
- q: optionalString(params.query, 'query'),
+ q: fieldOrModelArg(optionalString, 'query', 'q'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
case 'bitbucket_list_branches':
return {
...common,
- q: optionalString(params.query, 'query'),
+ q: fieldOrModelArg(optionalString, 'query', 'q'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
case 'bitbucket_list_pipelines':
return {
...common,
- refType: optionalString(params.pipelineRefType, 'pipelineRefType'),
- refName: optionalString(params.pipelineRefName, 'pipelineRefName'),
- commitHash: optionalString(params.pipelineCommitHash, 'pipelineCommitHash'),
- selectorType: optionalString(params.pipelineSelectorType, 'pipelineSelectorType'),
- selectorPattern: optionalString(
- params.pipelineSelectorPattern,
- 'pipelineSelectorPattern'
+ refType: fieldOrModelArg(optionalString, 'pipelineRefType', 'refType'),
+ refName: fieldOrModelArg(optionalString, 'pipelineRefName', 'refName'),
+ commitHash: fieldOrModelArg(optionalString, 'pipelineCommitHash', 'commitHash'),
+ selectorType: fieldOrModelArg(optionalString, 'pipelineSelectorType', 'selectorType'),
+ selectorPattern: fieldOrModelArg(
+ optionalString,
+ 'pipelineSelectorPattern',
+ 'selectorPattern'
),
- triggerType: optionalString(params.pipelineTriggerType, 'pipelineTriggerType'),
- status: optionalString(params.pipelineStatus, 'pipelineStatus'),
+ triggerType: fieldOrModelArg(optionalString, 'pipelineTriggerType', 'triggerType'),
+ status: fieldOrModelArg(optionalString, 'pipelineStatus', 'status'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
@@ -985,40 +998,40 @@ export const BitbucketBlock: BlockConfig = {
case 'bitbucket_create_branch':
return {
...common,
- name: optionalString(params.branchName, 'branchName'),
+ name: fieldOrModelArg(optionalString, 'branchName', 'name'),
target: optionalString(params.target, 'target'),
}
case 'bitbucket_delete_branch':
- return { ...common, name: optionalString(params.branchName, 'branchName') }
+ return { ...common, name: fieldOrModelArg(optionalString, 'branchName', 'name') }
case 'bitbucket_list_commits':
return {
...common,
- include: stringList(params.commitInclude, 'commitInclude'),
- exclude: stringList(params.commitExclude, 'commitExclude'),
- path: optionalString(params.commitPath, 'commitPath'),
+ include: fieldOrModelArg(stringList, 'commitInclude', 'include'),
+ exclude: fieldOrModelArg(stringList, 'commitExclude', 'exclude'),
+ path: fieldOrModelArg(optionalString, 'commitPath', 'path'),
...pagination,
}
case 'bitbucket_get_commit':
- return { ...common, commit: optionalString(params.revision, 'revision') }
+ return { ...common, commit: fieldOrModelArg(optionalString, 'revision', 'commit') }
case 'bitbucket_list_directory':
return {
...common,
- commit: optionalString(params.revision, 'revision'),
+ commit: fieldOrModelArg(optionalString, 'revision', 'commit'),
path: optionalText(params.path, 'path'),
- q: optionalString(params.query, 'query'),
+ q: fieldOrModelArg(optionalString, 'query', 'q'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
case 'bitbucket_get_file_metadata':
return {
...common,
- commit: optionalString(params.revision, 'revision'),
+ commit: fieldOrModelArg(optionalString, 'revision', 'commit'),
path: optionalText(params.path, 'path'),
}
case 'bitbucket_get_file':
return {
...common,
- commit: optionalString(params.revision, 'revision'),
+ commit: fieldOrModelArg(optionalString, 'revision', 'commit'),
path: optionalText(params.path, 'path'),
maxCharacters: optionalInteger(params.maxCharacters, 'maxCharacters'),
}
@@ -1026,7 +1039,7 @@ export const BitbucketBlock: BlockConfig = {
return {
...common,
state: optionalString(params.state, 'state'),
- q: optionalString(params.query, 'query'),
+ q: fieldOrModelArg(optionalString, 'query', 'q'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
@@ -1042,10 +1055,11 @@ export const BitbucketBlock: BlockConfig = {
sourceBranch: optionalString(params.sourceBranch, 'sourceBranch'),
destinationBranch: optionalString(params.destinationBranch, 'destinationBranch'),
description: optionalText(params.description, 'description'),
- reviewerUuids: stringList(params.reviewerAccountIds, 'reviewerAccountIds'),
- closeSourceBranch: optionalBoolean(
- params.createCloseSourceBranch,
- 'createCloseSourceBranch'
+ reviewerUuids: fieldOrModelArg(stringList, 'reviewerAccountIds', 'reviewerUuids'),
+ closeSourceBranch: fieldOrModelArg(
+ optionalBoolean,
+ 'createCloseSourceBranch',
+ 'closeSourceBranch'
),
draft: optionalBoolean(params.draft, 'draft'),
}
@@ -1055,9 +1069,10 @@ export const BitbucketBlock: BlockConfig = {
prId: optionalInteger(params.prId, 'prId'),
mergeStrategy: optionalString(params.mergeStrategy, 'mergeStrategy'),
message: optionalText(params.message, 'message'),
- closeSourceBranch: optionalBoolean(
- params.mergeCloseSourceBranch,
- 'mergeCloseSourceBranch'
+ closeSourceBranch: fieldOrModelArg(
+ optionalBoolean,
+ 'mergeCloseSourceBranch',
+ 'closeSourceBranch'
),
}
case 'bitbucket_get_pull_request_merge_task_status':
@@ -1080,7 +1095,7 @@ export const BitbucketBlock: BlockConfig = {
return {
...common,
prId: optionalInteger(params.prId, 'prId'),
- q: optionalString(params.query, 'query'),
+ q: fieldOrModelArg(optionalString, 'query', 'q'),
sort: optionalString(params.sort, 'sort'),
...pagination,
}
@@ -1097,9 +1112,9 @@ export const BitbucketBlock: BlockConfig = {
case 'bitbucket_trigger_pipeline':
return {
...common,
- refType: optionalString(params.targetRefType, 'targetRefType') ?? 'branch',
- refName: optionalString(params.targetRef, 'targetRef'),
- commitHash: optionalString(params.targetCommitHash, 'targetCommitHash'),
+ refType: fieldOrModelArg(optionalString, 'targetRefType', 'refType') ?? 'branch',
+ refName: fieldOrModelArg(optionalString, 'targetRef', 'refName'),
+ commitHash: fieldOrModelArg(optionalString, 'targetCommitHash', 'commitHash'),
}
case 'bitbucket_list_pipeline_steps':
return {
diff --git a/apps/sim/blocks/blocks/box.ts b/apps/sim/blocks/blocks/box.ts
index c9d3113b371..90b2f9bc1eb 100644
--- a/apps/sim/blocks/blocks/box.ts
+++ b/apps/sim/blocks/blocks/box.ts
@@ -3,7 +3,7 @@ import { BoxCompanyIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, toolCallArg } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
/** Canonical pair for the upload payload: file picker in basic mode, file reference in advanced. */
const UPLOAD_FILE_FIELD = ['uploadFile', 'fileRef'] as const
@@ -534,8 +534,8 @@ export const BoxBlock = {
if (normalizedFile) {
params.file = normalizedFile
}
- const { credential, operation: storedOperation, ...rest } = params
- const operation = storedOperation ?? context?.operation
+ const { credential, ...rest } = params
+ const operation = mapperOperation(params, context)
const baseParams: Record = {
accessToken: credential,
diff --git a/apps/sim/blocks/blocks/brex.test.ts b/apps/sim/blocks/blocks/brex.test.ts
new file mode 100644
index 00000000000..8cf7fd36f0f
--- /dev/null
+++ b/apps/sim/blocks/blocks/brex.test.ts
@@ -0,0 +1,107 @@
+import { describe, expect, it } from 'vitest'
+import { BrexBlock } from '@/blocks/blocks/brex'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** Runs the mapper the way each executor path merges it over the incoming params. */
+function runMapper(params: Record, context?: BlockToolParamsContext) {
+ const mapper = BrexBlock.tools.config?.params
+ if (!mapper) throw new Error('Brex block has no params mapper')
+ return { ...params, ...mapper(params, context) }
+}
+
+describe('Brex tool-call mapping', () => {
+ it('prefers the block cash account field over the model cash account', () => {
+ const sent = runMapper(
+ {
+ apiKey: 'token',
+ accountId: 'acct_block',
+ cashAccountId: 'acct_model',
+ vendorPaymentInstrumentId: 'pi_1',
+ amount: 5000,
+ description: 'Invoice 42',
+ externalMemo: 'Thanks',
+ },
+ { operation: 'create_transfer' }
+ )
+ expect(sent.cashAccountId).toBe('acct_block')
+ expect(sent.amount).toBe(5000)
+ })
+
+ it('keeps the model cash account on a tool call when the block field is blank', () => {
+ const sent = runMapper(
+ {
+ apiKey: 'token',
+ cashAccountId: 'acct_model',
+ vendorPaymentInstrumentId: 'pi_1',
+ amount: 5000,
+ description: 'Invoice 42',
+ externalMemo: 'Thanks',
+ },
+ { operation: 'create_transfer' }
+ )
+ expect(sent.cashAccountId).toBe('acct_model')
+ })
+
+ it('prefers the block spend limit name, period and members over the model args', () => {
+ const sent = runMapper(
+ {
+ apiKey: 'token',
+ resourceName: 'Travel',
+ name: 'Model name',
+ spendLimitPeriodRecurrenceType: 'PER_MONTH',
+ periodRecurrenceType: 'PER_YEAR',
+ spendLimitMemberUserIds: 'u1,u2',
+ memberUserIds: 'u9',
+ baseLimitAmount: 1000,
+ },
+ { operation: 'create_spend_limit' }
+ )
+ expect(sent).toMatchObject({
+ name: 'Travel',
+ periodRecurrenceType: 'PER_MONTH',
+ memberUserIds: 'u1,u2',
+ baseLimitAmount: 1000,
+ })
+ })
+
+ it('prefers the block vendor email and phone fields over the model args', () => {
+ const sent = runMapper(
+ { apiKey: 'token', vendorId: 'v1', vendorEmail: 'ap@vendor.com', vendorPhone: '555' },
+ { operation: 'update_vendor' }
+ )
+ expect(sent).toMatchObject({ email: 'ap@vendor.com', phone: '555' })
+ })
+
+ it('keeps the model vendor email on a tool call when the block field is blank', () => {
+ const sent = runMapper(
+ { apiKey: 'token', companyName: 'Acme', email: 'model@vendor.com' },
+ { operation: 'create_vendor' }
+ )
+ expect(sent.email).toBe('model@vendor.com')
+ })
+})
+
+describe('Brex canvas list filters never reach writes', () => {
+ it('drops a saved List Users email filter from a vendor write', () => {
+ const sent = runMapper({
+ operation: 'update_vendor',
+ apiKey: 'token',
+ vendorId: 'v1',
+ companyName: 'Acme',
+ email: 'alice@corp.com',
+ })
+ expect(sent.email).toBeUndefined()
+ })
+
+ it('drops a saved List Spend Limits member filter from a new spend limit', () => {
+ const sent = runMapper({
+ operation: 'create_spend_limit',
+ apiKey: 'token',
+ resourceName: 'Travel',
+ spendLimitPeriodRecurrenceType: 'PER_MONTH',
+ baseLimitAmount: '1000',
+ memberUserIds: 'u1,u2',
+ })
+ expect(sent.memberUserIds).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/brex.ts b/apps/sim/blocks/blocks/brex.ts
index 51e119edd6e..81339f966f3 100644
--- a/apps/sim/blocks/blocks/brex.ts
+++ b/apps/sim/blocks/blocks/brex.ts
@@ -1,7 +1,12 @@
import { BrexIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
/** Coerces a required money-amount field to a finite number, throwing on blank/non-numeric input rather than silently sending 0 or NaN to Brex. */
function toRequiredAmount(value: unknown, fieldLabel: string): number {
@@ -640,7 +645,7 @@ export const BrexBlock: BlockConfig = {
id: 'limitBufferPercentage',
title: 'Limit Buffer Percentage',
type: 'short-input',
- placeholder: 'Flexible buffer on the limit as a 0-100 percentage',
+ placeholder: 'Flexible buffer on the limit as a whole-number percentage from 0 to 100',
mode: 'advanced',
condition: { field: 'operation', value: 'create_spend_limit' },
},
@@ -723,7 +728,7 @@ export const BrexBlock: BlockConfig = {
wandConfig: {
enabled: true,
prompt:
- 'Generate a comma-separated list of Brex expense payment statuses to filter by.\n\nValid statuses: NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED\n\nExamples:\n- "only cleared payments" -> CLEARED\n- "refunded or refunding" -> REFUNDED,REFUNDING\n\nReturn ONLY the comma-separated status values - no explanations, no extra text.',
+ 'Generate a comma-separated list of Brex expense payment statuses to filter by.\n\nValid statuses: NOT_STARTED, PROCESSING, CANCELED, DECLINED, CLEARED, REFUNDING, REFUNDED, CASH_ADVANCE, CREDITED, AWAITING_PAYMENT, SCHEDULED, HELD\n\nExamples:\n- "only cleared payments" -> CLEARED\n- "refunded or refunding" -> REFUNDED,REFUNDING\n\nReturn ONLY the comma-separated status values - no explanations, no extra text.',
placeholder: 'Describe which payment statuses to include...',
},
},
@@ -880,8 +885,9 @@ export const BrexBlock: BlockConfig = {
],
config: {
tool: (params) => `brex_${params.operation}`,
- params: (params) => {
- const { operation, apiKey } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { apiKey } = params
const result: Record = { apiKey }
switch (operation) {
@@ -943,7 +949,7 @@ export const BrexBlock: BlockConfig = {
result.budgetId = params.budgetId
break
case 'create_budget': {
- result.name = params.resourceName
+ result.name = params.resourceName || toolCallArg(context, params.name)
result.description = params.description
result.parentBudgetId = params.parentBudgetId
result.periodRecurrenceType = params.periodRecurrenceType
@@ -961,8 +967,10 @@ export const BrexBlock: BlockConfig = {
result.spendLimitId = params.spendLimitId
break
case 'create_spend_limit': {
- result.name = params.resourceName
- result.periodRecurrenceType = params.spendLimitPeriodRecurrenceType
+ result.name = params.resourceName || toolCallArg(context, params.name)
+ result.periodRecurrenceType =
+ params.spendLimitPeriodRecurrenceType ||
+ toolCallArg(context, params.periodRecurrenceType)
result.spendType = params.spendType
result.expenseVisibility = params.expenseVisibility
result.authorizationVisibility = params.authorizationVisibility
@@ -991,8 +999,8 @@ export const BrexBlock: BlockConfig = {
if (transactionLimitAmount !== undefined)
result.transactionLimitAmount = transactionLimitAmount
if (params.ownerUserIds) result.ownerUserIds = params.ownerUserIds
- if (params.spendLimitMemberUserIds)
- result.memberUserIds = params.spendLimitMemberUserIds
+ result.memberUserIds =
+ params.spendLimitMemberUserIds || toolCallArg(context, params.memberUserIds)
break
}
case 'get_vendor':
@@ -1000,20 +1008,20 @@ export const BrexBlock: BlockConfig = {
break
case 'create_vendor':
result.companyName = params.companyName
- if (params.vendorEmail) result.email = params.vendorEmail
- if (params.vendorPhone) result.phone = params.vendorPhone
+ result.email = params.vendorEmail || toolCallArg(context, params.email)
+ result.phone = params.vendorPhone || toolCallArg(context, params.phone)
break
case 'update_vendor':
result.vendorId = params.vendorId
if (params.companyName) result.companyName = params.companyName
- if (params.vendorEmail) result.email = params.vendorEmail
- if (params.vendorPhone) result.phone = params.vendorPhone
+ result.email = params.vendorEmail || toolCallArg(context, params.email)
+ result.phone = params.vendorPhone || toolCallArg(context, params.phone)
break
case 'get_transfer':
result.transferId = params.transferId
break
case 'create_transfer': {
- result.cashAccountId = params.accountId
+ result.cashAccountId = params.accountId || toolCallArg(context, params.cashAccountId)
result.vendorPaymentInstrumentId = params.vendorPaymentInstrumentId
result.amount = toRequiredAmount(params.amount, 'Amount')
if (params.currency) result.currency = params.currency
diff --git a/apps/sim/blocks/blocks/brightdata.test.ts b/apps/sim/blocks/blocks/brightdata.test.ts
new file mode 100644
index 00000000000..db28714d8a9
--- /dev/null
+++ b/apps/sim/blocks/blocks/brightdata.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest'
+import { BrightDataBlock } from '@/blocks/blocks/brightdata'
+
+const mapper = BrightDataBlock.tools.config?.params
+if (!mapper) throw new Error('BrightDataBlock has no params mapper')
+const mapToolParams = mapper
+
+/**
+ * Agent tool calls carry the operation only in `context` and key model args by the tool's
+ * param names; the result is spread over the merged params, as `buildBlockToolParamsTransform` does.
+ */
+const toolCall = (operation: string, merged: Record) => ({
+ ...merged,
+ ...mapToolParams(merged, { operation }),
+})
+
+describe('BrightDataBlock tool calls', () => {
+ it('maps stored block fields and keeps the model dataset and URLs for sync scrape', () => {
+ const params = toolCall('sync_scrape', {
+ apiKey: 'key',
+ datasetId: 'gd_model',
+ urls: '[{"url":"https://example.com"}]',
+ syncFormat: 'csv',
+ })
+
+ expect(params.datasetId).toBe('gd_model')
+ expect(params.urls).toBe('[{"url":"https://example.com"}]')
+ expect(params.format).toBe('csv')
+ })
+})
diff --git a/apps/sim/blocks/blocks/brightdata.ts b/apps/sim/blocks/blocks/brightdata.ts
index ea9ee0d21d9..60bc40eb46f 100644
--- a/apps/sim/blocks/blocks/brightdata.ts
+++ b/apps/sim/blocks/blocks/brightdata.ts
@@ -1,7 +1,7 @@
import { BrightDataIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const BrightDataBlock: BlockConfig = {
type: 'brightdata',
@@ -341,10 +341,10 @@ export const BrightDataBlock: BlockConfig = {
],
config: {
tool: (params) => `brightdata_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = { apiKey: params.apiKey }
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'scrape_url':
result.zone = params.zone
result.url = params.url
@@ -363,7 +363,7 @@ export const BrightDataBlock: BlockConfig = {
break
case 'discover':
- result.query = params.discoverQuery
+ result.query = params.discoverQuery ?? toolCallArg(context, params.query)
if (params.numResults) result.numResults = Number(params.numResults)
if (params.mode) result.mode = params.mode
if (params.intent) result.intent = params.intent
@@ -374,8 +374,8 @@ export const BrightDataBlock: BlockConfig = {
break
case 'sync_scrape':
- result.datasetId = params.syncDatasetId
- result.urls = params.syncUrls
+ result.datasetId = params.syncDatasetId ?? toolCallArg(context, params.datasetId)
+ result.urls = params.syncUrls ?? toolCallArg(context, params.urls)
if (params.syncFormat) result.format = params.syncFormat
if (params.syncIncludeErrors != null) result.includeErrors = params.syncIncludeErrors
break
diff --git a/apps/sim/blocks/blocks/buffer.test.ts b/apps/sim/blocks/blocks/buffer.test.ts
new file mode 100644
index 00000000000..0e371573abb
--- /dev/null
+++ b/apps/sim/blocks/blocks/buffer.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from 'vitest'
+import { BufferBlock } from '@/blocks/blocks/buffer'
+
+const mapper = BufferBlock.tools.config?.params
+if (!mapper) throw new Error('BufferBlock has no params mapper')
+const mapToolParams = mapper
+
+describe('BufferBlock tool calls', () => {
+ it('turns the default share mode into addToQueue when creating a post', () => {
+ const merged = { apiKey: 'key', channelId: 'ch_1', text: 'Hello', mode: 'default' }
+ const params: Record = {
+ ...merged,
+ ...mapToolParams(merged, { operation: 'create_post' }),
+ }
+
+ expect(params.mode).toBe('addToQueue')
+ expect(params.schedulingType).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/buffer.ts b/apps/sim/blocks/blocks/buffer.ts
index b1704172957..9a275f5a3be 100644
--- a/apps/sim/blocks/blocks/buffer.ts
+++ b/apps/sim/blocks/blocks/buffer.ts
@@ -1,7 +1,7 @@
import { BufferIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta, SubBlockConfig } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput, withSavedCredential } from '@/blocks/utils'
import { getToolMetadata } from '@/tools/metadata'
const POST_EDIT_OPS = ['create_post', 'edit_post']
@@ -658,7 +658,8 @@ export const BufferBlock: BlockConfig = {
],
config: {
tool: (params) => `buffer_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
for (const [key, value] of Object.entries(params)) {
if (
@@ -674,7 +675,7 @@ export const BufferBlock: BlockConfig = {
}
if ((key === 'mode' || key === 'schedulingType') && value === 'default') {
result[key] =
- params.operation === 'create_post'
+ operation === 'create_post'
? key === 'mode'
? 'addToQueue'
: 'automatic'
@@ -699,7 +700,7 @@ export const BufferBlock: BlockConfig = {
throw new Error('Choose one media input: uploaded/reference file or public URL')
if (params.assets && (normalizedMedia || mediaUrl))
throw new Error('Choose assets or a single media input')
- if (params.operation === 'edit_post' && params.clearText === true) result.text = null
+ if (operation === 'edit_post' && params.clearText === true) result.text = null
if (normalizedMedia) {
result.media = normalizedMedia
} else if (mediaUrl) {
diff --git a/apps/sim/blocks/blocks/calcom.test.ts b/apps/sim/blocks/blocks/calcom.test.ts
new file mode 100644
index 00000000000..1f8f272b866
--- /dev/null
+++ b/apps/sim/blocks/blocks/calcom.test.ts
@@ -0,0 +1,110 @@
+import { describe, expect, it } from 'vitest'
+import { CalComBlock } from '@/blocks/blocks/calcom'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = CalComBlock.tools.config?.params
+ if (!mapper) throw new Error('Cal.com block has no params mapper')
+ return mapper(params, context)
+}
+
+/** What the tool receives: the mapper output spread over the params it was given. */
+function sentParams(params: Record, context?: BlockToolParamsContext) {
+ return { ...params, ...mapParams(params, context) }
+}
+
+describe('Cal.com create booking on a tool call', () => {
+ it('lets pinned attendee fields win over the model attendee and keeps the rest', () => {
+ const sent = sentParams(
+ {
+ attendeeName: 'Pinned Name',
+ attendeeTimeZone: 'Europe/London',
+ attendee: { name: 'Model Name', email: 'model@x.com', timeZone: 'UTC' },
+ eventTypeId: 123,
+ start: '2026-01-15T10:00:00Z',
+ },
+ { operation: 'calcom_create_booking' }
+ )
+
+ expect(sent.attendee).toEqual({
+ name: 'Pinned Name',
+ email: 'model@x.com',
+ timeZone: 'Europe/London',
+ })
+ expect(sent.eventTypeId).toBe(123)
+ })
+
+ it('splits pinned comma-separated guests into an array', () => {
+ const sent = sentParams(
+ { guests: 'a@x.com, b@y.com', attendee: { name: 'A', timeZone: 'UTC' } },
+ { operation: 'calcom_create_booking' }
+ )
+ expect(sent.guests).toEqual(['a@x.com', 'b@y.com'])
+ })
+})
+
+describe('Cal.com create booking on the canvas', () => {
+ it('accepts guests that already resolved to an array', () => {
+ const sent = sentParams({
+ operation: 'calcom_create_booking',
+ attendeeName: 'A',
+ attendeeTimeZone: 'UTC',
+ guests: ['a@x.com'],
+ })
+ expect(sent.guests).toEqual(['a@x.com'])
+ })
+})
+
+describe('Cal.com list bookings', () => {
+ it('sends the pinned status instead of the model status on a tool call', () => {
+ const sent = sentParams(
+ { bookingStatus: 'past', status: 'upcoming' },
+ { operation: 'calcom_list_bookings' }
+ )
+ expect(sent.status).toBe('past')
+ })
+
+ it('keeps the model status and attendee filter when nothing is pinned', () => {
+ const sent = sentParams(
+ { status: 'upcoming', attendeeEmail: 'a@x.com', take: 5 },
+ { operation: 'calcom_list_bookings' }
+ )
+ expect(sent.status).toBe('upcoming')
+ expect(sent.attendeeEmail).toBe('a@x.com')
+ expect(sent.take).toBe(5)
+ })
+
+ it('does not filter by an attendee email left over from Create Booking on the canvas', () => {
+ const sent = sentParams({
+ operation: 'calcom_list_bookings',
+ attendeeEmail: 'stale@x.com',
+ take: '10',
+ })
+ expect(sent.attendeeEmail).toBeUndefined()
+ expect(sent.take).toBe(10)
+ })
+
+ it.each([null, ''])('drops blank advanced limit and offset (%j) on the canvas', (blank) => {
+ const sent = sentParams({ operation: 'calcom_list_bookings', take: blank, skip: blank })
+ expect(sent.take).toBeUndefined()
+ expect(sent.skip).toBeUndefined()
+ })
+})
+
+describe('Cal.com event type id on a tool call', () => {
+ it('uses the event type picked in the tool row', () => {
+ const sent = sentParams(
+ { eventTypeIdParam: '42', eventTypeId: 7 },
+ { operation: 'calcom_get_event_type' }
+ )
+ expect(sent.eventTypeId).toBe(42)
+ })
+
+ it('keeps the model event type id and fields on an update with nothing pinned', () => {
+ const sent = sentParams(
+ { eventTypeId: 7, lengthInMinutes: 45, scheduleId: 3 },
+ { operation: 'calcom_update_event_type' }
+ )
+ expect(sent).toMatchObject({ eventTypeId: 7, lengthInMinutes: 45, scheduleId: 3 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/calcom.ts b/apps/sim/blocks/blocks/calcom.ts
index 3f7d0b4f09d..41233d0a1de 100644
--- a/apps/sim/blocks/blocks/calcom.ts
+++ b/apps/sim/blocks/blocks/calcom.ts
@@ -1,6 +1,8 @@
+import { isPlainRecord } from '@sim/utils/object'
import { CalComIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const EVENT_TYPE_FIELD = ['eventTypeSelector', 'eventTypeId'] as const
@@ -350,6 +352,58 @@ Return ONLY the IANA timezone string - no explanations or quotes.`,
],
condition: { field: 'operation', value: 'calcom_list_bookings' },
},
+ {
+ id: 'filterAttendeeEmail',
+ title: 'Attendee Email',
+ type: 'short-input',
+ placeholder: 'Only bookings with this attendee',
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
+ {
+ id: 'afterStart',
+ title: 'Starts After',
+ type: 'short-input',
+ placeholder: 'ISO 8601 (e.g., 2024-01-15T00:00:00Z)',
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
+ {
+ id: 'beforeEnd',
+ title: 'Ends Before',
+ type: 'short-input',
+ placeholder: 'ISO 8601 (e.g., 2024-01-22T00:00:00Z)',
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
+ {
+ id: 'sortStart',
+ title: 'Sort by Start',
+ type: 'dropdown',
+ options: [
+ { label: 'None', id: '' },
+ { label: 'Ascending', id: 'asc' },
+ { label: 'Descending', id: 'desc' },
+ ],
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
+ {
+ id: 'take',
+ title: 'Limit',
+ type: 'short-input',
+ placeholder: 'Bookings to return (default 100)',
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
+ {
+ id: 'skip',
+ title: 'Offset',
+ type: 'short-input',
+ placeholder: 'Bookings to skip (default 0)',
+ condition: { field: 'operation', value: 'calcom_list_bookings' },
+ mode: 'advanced',
+ },
// Event Type fields
{
@@ -712,9 +766,9 @@ Return ONLY valid JSON - no explanations.`,
],
config: {
tool: (params) => params.operation || 'calcom_list_bookings',
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
oauthCredential,
attendeeName,
attendeeEmail,
@@ -745,6 +799,11 @@ Return ONLY valid JSON - no explanations.`,
duration,
metadata,
availability,
+ attendee,
+ status,
+ filterAttendeeEmail,
+ take,
+ skip,
...rest
} = params
@@ -759,12 +818,23 @@ Return ONLY valid JSON - no explanations.`,
}
switch (operation) {
- case 'calcom_create_booking':
- result.attendee = {
- name: attendeeName,
- ...(attendeeEmail && { email: attendeeEmail }),
- timeZone: attendeeTimeZone,
- ...(attendeePhone && { phoneNumber: attendeePhone }),
+ case 'calcom_create_booking': {
+ const modelAttendee = toolCallArg(context, attendee)
+ if (isPlainRecord(modelAttendee)) {
+ const pinned = Object.entries({
+ name: attendeeName,
+ email: attendeeEmail,
+ timeZone: attendeeTimeZone,
+ phoneNumber: attendeePhone,
+ }).filter(([, value]) => value !== undefined && value !== null && value !== '')
+ result.attendee = { ...modelAttendee, ...Object.fromEntries(pinned) }
+ } else if (modelAttendee === undefined || attendeeName || attendeeTimeZone) {
+ result.attendee = {
+ name: attendeeName,
+ ...(attendeeEmail && { email: attendeeEmail }),
+ timeZone: attendeeTimeZone,
+ ...(attendeePhone && { phoneNumber: attendeePhone }),
+ }
}
{
const eventTypeIdNum = toNumber(eventTypeId)
@@ -772,7 +842,13 @@ Return ONLY valid JSON - no explanations.`,
}
if (start) result.start = start
if (end) result.end = end
- if (guests) result.guests = guests.split(',').map((g: string) => g.trim())
+ if (guests) {
+ result.guests = Array.isArray(guests)
+ ? guests
+ : String(guests)
+ .split(',')
+ .map((g: string) => g.trim())
+ }
{
const lengthNum = toNumber(lengthInMinutes)
if (lengthNum !== undefined) result.lengthInMinutes = lengthNum
@@ -785,6 +861,7 @@ Return ONLY valid JSON - no explanations.`,
}
}
break
+ }
case 'calcom_cancel_booking':
if (bookingUid) result.bookingUid = bookingUid
@@ -797,20 +874,28 @@ Return ONLY valid JSON - no explanations.`,
if (reschedulingReason) result.reschedulingReason = reschedulingReason
break
- case 'calcom_list_bookings':
- if (bookingStatus) result.status = bookingStatus
+ case 'calcom_list_bookings': {
+ const statusFilter = bookingStatus || toolCallArg(context, status)
+ if (statusFilter) result.status = statusFilter
+ result.attendeeEmail = filterAttendeeEmail || toolCallArg(context, attendeeEmail)
+ result.take = toNumber(take)
+ result.skip = toNumber(skip)
break
+ }
case 'calcom_create_event_type':
case 'calcom_update_event_type':
{
if (operation === 'calcom_update_event_type') {
- const eventTypeIdNum = toNumber(eventTypeIdParam)
+ const eventTypeIdNum =
+ toNumber(eventTypeIdParam) ?? toolCallArg(context, toNumber(eventTypeId))
if (eventTypeIdNum !== undefined) result.eventTypeId = eventTypeIdNum
}
- const lengthNum = toNumber(eventLength)
+ const lengthNum =
+ toNumber(eventLength) ?? toolCallArg(context, toNumber(lengthInMinutes))
if (lengthNum !== undefined) result.lengthInMinutes = lengthNum
- const scheduleIdNum = toNumber(eventTypeScheduleId)
+ const scheduleIdNum =
+ toNumber(eventTypeScheduleId) ?? toolCallArg(context, toNumber(scheduleId))
if (scheduleIdNum !== undefined) result.scheduleId = scheduleIdNum
const slotIntervalNum = toNumber(slotInterval)
if (slotIntervalNum !== undefined) result.slotInterval = slotIntervalNum
@@ -829,7 +914,8 @@ Return ONLY valid JSON - no explanations.`,
case 'calcom_get_event_type':
case 'calcom_delete_event_type':
{
- const eventTypeIdNum = toNumber(eventTypeIdParam)
+ const eventTypeIdNum =
+ toNumber(eventTypeIdParam) ?? toolCallArg(context, toNumber(eventTypeId))
if (eventTypeIdNum !== undefined) result.eventTypeId = eventTypeIdNum
}
break
@@ -943,9 +1029,24 @@ Return ONLY valid JSON - no explanations.`,
eventTypeSlug: { type: 'string', description: 'Event type slug' },
username: { type: 'string', description: 'Cal.com username' },
duration: { type: 'number', description: 'Slot duration in minutes' },
+ filterAttendeeEmail: { type: 'string', description: 'List Bookings attendee email filter' },
+ afterStart: { type: 'string', description: 'List bookings starting after this time' },
+ beforeEnd: { type: 'string', description: 'List bookings ending before this time' },
+ sortStart: { type: 'string', description: 'Sort bookings by start time (asc or desc)' },
+ take: { type: 'number', description: 'Number of bookings to return' },
+ skip: { type: 'number', description: 'Number of bookings to skip' },
},
outputs: {
success: { type: 'boolean', description: 'Whether operation succeeded' },
+ data: {
+ type: 'json',
+ description:
+ 'Cal.com response data: a booking, event type, or schedule object, an array of them for list operations, or the slots map keyed by date (YYYY-MM-DD) for Get Available Slots',
+ },
+ pagination: {
+ type: 'json',
+ description: 'List Bookings pagination (totalItems, remainingItems, hasNextPage, ...)',
+ },
bookingUid: { type: 'string', description: 'Booking unique identifier' },
bookingId: { type: 'number', description: 'Booking ID' },
status: { type: 'string', description: 'Booking or event status' },
diff --git a/apps/sim/blocks/blocks/calendly.test.ts b/apps/sim/blocks/blocks/calendly.test.ts
new file mode 100644
index 00000000000..ae78571412d
--- /dev/null
+++ b/apps/sim/blocks/blocks/calendly.test.ts
@@ -0,0 +1,57 @@
+import { describe, expect, it } from 'vitest'
+import { CalendlyBlock } from '@/blocks/blocks/calendly'
+import type { BlockToolParamsContext } from '@/blocks/types'
+import { listEventTypesTool } from '@/tools/calendly/list_event_types'
+import type { ToolConfig } from '@/tools/types'
+
+/**
+ * Assertions run against `{ ...inputs, ...mapper(inputs, context) }`, the shape both the canvas
+ * handler and the tool-call transform forward: a key the mapper leaves out keeps its raw value.
+ */
+describe('CalendlyBlock params mapper', () => {
+ const mapper = CalendlyBlock.tools.config?.params
+ if (!mapper) throw new Error('CalendlyBlock is missing its params mapper')
+
+ const resolve = (inputs: Record, context?: BlockToolParamsContext) => ({
+ ...inputs,
+ ...mapper(inputs, context),
+ })
+
+ const eventTypesUrl = (params: Record) => {
+ const tool: ToolConfig = listEventTypesTool
+ const url = tool.request.url
+ if (typeof url !== 'function') throw new Error('Expected a url builder')
+ return url(params)
+ }
+
+ it('lists all event types on the canvas when the Active Only switch was turned off', () => {
+ const params = resolve({
+ operation: 'calendly_list_event_types',
+ apiKey: 'k',
+ user: 'user-1',
+ active: false,
+ })
+
+ expect(eventTypesUrl(params)).not.toContain('active=')
+ })
+
+ it('lists all event types on a tool call whose stored row has the switch off', () => {
+ const params = resolve(
+ { apiKey: 'k', user: 'user-1', active: false },
+ { operation: 'calendly_list_event_types' }
+ )
+
+ expect(eventTypesUrl(params)).not.toContain('active=')
+ })
+
+ it('still filters to active event types when the switch is on', () => {
+ const params = resolve({
+ operation: 'calendly_list_event_types',
+ apiKey: 'k',
+ user: 'user-1',
+ active: true,
+ })
+
+ expect(eventTypesUrl(params)).toContain('active=true')
+ })
+})
diff --git a/apps/sim/blocks/blocks/calendly.ts b/apps/sim/blocks/blocks/calendly.ts
index 2f4a57f06c4..8187514d98e 100644
--- a/apps/sim/blocks/blocks/calendly.ts
+++ b/apps/sim/blocks/blocks/calendly.ts
@@ -34,7 +34,7 @@ export const CalendlyBlock: BlockConfig = {
authMode: AuthMode.ApiKey,
triggerAllowed: true,
longDescription:
- 'Manage event types, scheduled events, invitees, and webhooks. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted). Requires Personal Access Token.',
+ 'Manage event types, scheduled events, invitees, bookings, availability, and routing forms. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted). Requires Personal Access Token.',
docsLink: 'https://docs.sim.ai/integrations/calendly',
category: 'tools',
integrationType: IntegrationType.Productivity,
@@ -445,9 +445,43 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
prompt:
'Generate a JSON array of guest email address strings, for example ["guest@example.com"]. Return ONLY the JSON array - no explanations, no extra text.',
placeholder: 'Describe the guests to copy on the invite...',
+ generationType: 'json-array',
+ },
+ },
+ {
+ id: 'location',
+ title: 'Location',
+ type: 'long-input',
+ placeholder: '{"kind": "outbound_call", "location": "+14155551234"}',
+ description:
+ 'Must match a location on the event type. Leave empty for round robin event types.',
+ mode: 'advanced',
+ condition: { field: 'operation', value: 'calendly_create_event_invitee' },
+ wandConfig: {
+ enabled: true,
+ prompt:
+ 'Generate a Calendly invitee location JSON object with a "kind" (physical, inbound_call, outbound_call, zoom_conference, google_conference, gotomeeting_conference, microsoft_teams_conference, webex_conference, ask_invitee, or custom) and, for physical, outbound_call, ask_invitee, and custom, a "location" string. Return ONLY the JSON object - no explanations, no extra text.',
+ placeholder: 'Describe where the meeting takes place...',
generationType: 'json-object',
},
},
+ {
+ id: 'questionsAndAnswers',
+ title: 'Questions and Answers',
+ type: 'long-input',
+ placeholder: '[{"question": "Company", "answer": "Acme", "position": 0}]',
+ description:
+ "Answers to the event type's booking questions. Questions must match exactly; required ones must be answered.",
+ mode: 'advanced',
+ condition: { field: 'operation', value: 'calendly_create_event_invitee' },
+ wandConfig: {
+ enabled: true,
+ prompt:
+ 'Generate a JSON array of Calendly booking answers, each an object with "question" (the exact question text), "answer", and "position" (the question\'s zero-based order). Return ONLY the JSON array - no explanations, no extra text.',
+ placeholder: 'Describe the answers to the booking questions...',
+ generationType: 'json-array',
+ },
+ },
{
id: 'inviteeUri',
title: 'Invitee URI',
@@ -583,8 +617,8 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
return {
...rest,
- // The switch cannot express "inactive only", so off means unfiltered, not `active=false`.
- ...(active === true && { active: true }),
+ // Off means unfiltered, not `active=false`; always written so it overrides the raw input.
+ active: active === true ? true : undefined,
...(events !== undefined && { events: parseJsonArray(events, 'events') }),
...(eventGuests !== undefined && {
eventGuests: parseJsonArray(eventGuests, 'eventGuests'),
@@ -621,6 +655,11 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
inviteeTimezone: { type: 'string', description: 'Timezone of the invitee' },
textReminderNumber: { type: 'string', description: 'Phone number for SMS reminders' },
eventGuests: { type: 'json', description: 'Array of additional guest email addresses' },
+ location: { type: 'json', description: 'Meeting location ({kind, location})' },
+ questionsAndAnswers: {
+ type: 'json',
+ description: 'Answers to booking questions ([{question, answer, position}])',
+ },
role: { type: 'string', description: 'Filter memberships by role' },
formUri: { type: 'string', description: 'Routing form UUID or URI' },
count: { type: 'number', description: 'Results per page' },
@@ -803,7 +842,7 @@ export const CalendlyV2Block: BlockConfig = {
hideFromToolbar: false,
sunset: undefined,
longDescription:
- 'Manage event types, scheduled events, invitees, and webhooks. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted).',
+ 'Manage event types, scheduled events, invitees, bookings, availability, and routing forms. Trigger workflows based on Calendly webhook events (invitee scheduled, invitee canceled, routing form submitted).',
...withSavedCredential(CalendlyBlock, {
id: 'credential',
type: 'oauth-input',
diff --git a/apps/sim/blocks/blocks/cbinsights.test.ts b/apps/sim/blocks/blocks/cbinsights.test.ts
index d581a6c0f34..2713ade0fcd 100644
--- a/apps/sim/blocks/blocks/cbinsights.test.ts
+++ b/apps/sim/blocks/blocks/cbinsights.test.ts
@@ -101,4 +101,12 @@ describe('CbInsightsBlock', () => {
expect(maturity.startDate).toBe('2025-01-01')
expect(maturity.endDate).toBe('2025-06-01')
})
+
+ it('keeps model filters on a firmographics tool call, which carries no operation in params', () => {
+ const merged = { clientId: 'id', clientSecret: 'secret', keyword: 'fintech', orgIds: [1, 2] }
+ const params = { ...merged, ...buildParams(merged, { operation: 'search_firmographics' }) }
+
+ expect(params.keyword).toBe('fintech')
+ expect(params.orgIds).toEqual([1, 2])
+ })
})
diff --git a/apps/sim/blocks/blocks/cbinsights.ts b/apps/sim/blocks/blocks/cbinsights.ts
index d7d73cbaaf1..1eaea4770b3 100644
--- a/apps/sim/blocks/blocks/cbinsights.ts
+++ b/apps/sim/blocks/blocks/cbinsights.ts
@@ -2,7 +2,7 @@ import { Building, ListChecks, Search, Sparkles, Sprout, Users } from '@sim/emcn
import { CbInsightsIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/** Operations that take a single organization ID on the path. */
const ORG_OPERATIONS = [
@@ -654,8 +654,8 @@ export const CbInsightsBlock: BlockConfig = {
* advanced field is serialized on non-emptiness alone, even while the UI
* hides it. `undefined` is what actually drops one.
*/
- params: (params) => {
- const operation = String(params.operation ?? '')
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const isOrg = (ORG_OPERATIONS as readonly string[]).includes(operation)
const isOrgList = (ORG_LIST_OPERATIONS as readonly string[]).includes(operation)
const isFirmographics = operation === 'search_firmographics'
@@ -670,11 +670,15 @@ export const CbInsightsBlock: BlockConfig = {
clientId: params.clientId,
clientSecret: params.clientSecret,
orgId: isOrg ? params.orgId : undefined,
- orgIds: isOrgList ? params.orgIds : firmographic(params.orgIdFilter),
+ orgIds: isOrgList
+ ? params.orgIds
+ : firmographic(params.orgIdFilter ?? toolCallArg(context, params.orgIds)),
message: isAi ? params.message : undefined,
chatId: isChat ? params.chatId : undefined,
names: isLookup ? params.names : undefined,
- urls: isLookup ? params.urls : firmographic(params.firmographicsUrls),
+ urls: isLookup
+ ? params.urls
+ : firmographic(params.firmographicsUrls ?? toolCallArg(context, params.urls)),
profileUrl: isLookup ? params.profileUrl : undefined,
keyword: firmographic(params.keyword),
orgNames: firmographic(params.orgNames),
diff --git a/apps/sim/blocks/blocks/checkr.test.ts b/apps/sim/blocks/blocks/checkr.test.ts
new file mode 100644
index 00000000000..4a7444ceb54
--- /dev/null
+++ b/apps/sim/blocks/blocks/checkr.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from 'vitest'
+import { CheckrBlock } from '@/blocks/blocks/checkr'
+
+const mapper = CheckrBlock.tools.config?.params
+if (!mapper) throw new Error('CheckrBlock has no params mapper')
+const mapToolParams = mapper
+
+/**
+ * Agent tool calls carry the operation only in `context` and key model args by the tool's
+ * param names; the result is spread over the merged params, as `buildBlockToolParamsTransform` does.
+ */
+const toolCall = (operation: string, merged: Record) => ({
+ ...merged,
+ ...mapToolParams(merged, { operation }),
+})
+
+describe('CheckrBlock tool calls', () => {
+ it('sends the stored report tags when ordering a report', () => {
+ const params = toolCall('create_report', {
+ apiKey: 'key',
+ candidateId: 'cand_1',
+ package: 'basic',
+ reportTags: 'urgent, onsite',
+ })
+
+ expect(params.tags).toEqual(['urgent', 'onsite'])
+ })
+
+ it('keeps the model node and work locations when updating a continuous check', () => {
+ const params = toolCall('update_continuous_check', {
+ apiKey: 'key',
+ continuousCheckId: 'cc_1',
+ node: 'node_1',
+ workLocations: [{ country: 'US', state: 'CA' }],
+ })
+
+ expect(params.node).toBe('node_1')
+ expect(params.workLocations).toEqual([{ country: 'US', state: 'CA' }])
+ })
+})
diff --git a/apps/sim/blocks/blocks/checkr.ts b/apps/sim/blocks/blocks/checkr.ts
index 5fad3954ed3..3c97794fa9a 100644
--- a/apps/sim/blocks/blocks/checkr.ts
+++ b/apps/sim/blocks/blocks/checkr.ts
@@ -1,6 +1,6 @@
import { CheckrIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const CANDIDATE_ID_REQUIRED_OPS = [
@@ -1271,7 +1271,8 @@ export const CheckrBlock: BlockConfig = {
],
config: {
tool: (params) => `checkr_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
candidateAdjudication,
reportAdjudication,
@@ -1293,18 +1294,21 @@ export const CheckrBlock: BlockConfig = {
} = params
const result: Record = { ...rest }
- if (params.operation === 'create_invitation' || params.operation === 'create_report') {
- result.tags = toStringList(reportTags)
+ if (operation === 'create_invitation' || operation === 'create_report') {
+ result.tags = toStringList(reportTags ?? toolCallArg(context, rest.tags))
} else {
result.tags = toStringList(rest.tags)
}
- if (params.operation === 'list_candidates') {
- result.geoId = filterGeoId || undefined
- result.programId = filterProgramId || undefined
+ if (operation === 'list_candidates') {
+ result.geoId = filterGeoId || toolCallArg(context, rest.geoId) || undefined
+ result.programId = filterProgramId || toolCallArg(context, rest.programId) || undefined
}
- if (params.operation === 'update_continuous_check') {
- result.node = continuousCheckNode || undefined
- result.workLocations = toJsonArray(continuousCheckWorkLocations, 'work locations')
+ if (operation === 'update_continuous_check') {
+ result.node = continuousCheckNode || toolCallArg(context, rest.node) || undefined
+ result.workLocations = toJsonArray(
+ continuousCheckWorkLocations ?? toolCallArg(context, rest.workLocations),
+ 'work locations'
+ )
} else {
result.workLocations = toJsonArray(rest.workLocations, 'work locations')
}
@@ -1314,10 +1318,9 @@ export const CheckrBlock: BlockConfig = {
result.selfDisclosures = toJsonArray(rest.selfDisclosures, 'self disclosures')
const adjudication =
- params.operation === 'update_report' ? reportAdjudication : candidateAdjudication
+ operation === 'update_report' ? reportAdjudication : candidateAdjudication
if (adjudication) result.adjudication = adjudication
- const status =
- params.operation === 'list_subscriptions' ? subscriptionStatus : invitationStatus
+ const status = operation === 'list_subscriptions' ? subscriptionStatus : invitationStatus
if (status) result.status = status
const noMiddle = toOptionalBoolean(noMiddleName)
diff --git a/apps/sim/blocks/blocks/circleback.test.ts b/apps/sim/blocks/blocks/circleback.test.ts
new file mode 100644
index 00000000000..69eb152b182
--- /dev/null
+++ b/apps/sim/blocks/blocks/circleback.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest'
+import { CirclebackBlock } from '@/blocks/blocks/circleback'
+
+/**
+ * A tool call merges the stored row with the model's args (keyed by tool param names) and spreads
+ * the mapper result over them; the operation arrives only in `context`.
+ */
+const toolCall = (args: Record, operation: string) => ({
+ ...args,
+ ...CirclebackBlock.tools.config?.params?.(args, { operation }),
+})
+
+describe('CirclebackBlock tool calls', () => {
+ it('sends the stored action-item filters under the tool param names', () => {
+ const params = toolCall(
+ { statusFilter: 'DONE', assigneeFilterProfileId: 'profile-1' },
+ 'list_action_items'
+ )
+ expect(params.status).toBe('DONE')
+ expect(params.assigneeProfileId).toBe('profile-1')
+ })
+})
diff --git a/apps/sim/blocks/blocks/circleback.ts b/apps/sim/blocks/blocks/circleback.ts
index 40a8007ddda..58c24542757 100644
--- a/apps/sim/blocks/blocks/circleback.ts
+++ b/apps/sim/blocks/blocks/circleback.ts
@@ -1,7 +1,7 @@
import { ClipboardList, Table } from '@sim/emcn/icons'
import { CirclebackIcon } 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 CirclebackBlock: BlockConfig = {
@@ -452,18 +452,19 @@ export const CirclebackBlock: BlockConfig = {
],
config: {
tool: (params) => `circleback_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
/* Filter variants live on their own subBlocks so an operation switch
cannot leak a mutation input into a list filter; remap them onto the
tool param names here. */
const result: Record = {}
- if (params.operation === 'list_action_items') {
+ if (operation === 'list_action_items') {
if (params.statusFilter) result.status = params.statusFilter
if (params.assigneeFilterProfileId) {
result.assigneeProfileId = params.assigneeFilterProfileId
}
}
- if (params.operation === 'search_meetings' && params.searchMeetingIds) {
+ if (operation === 'search_meetings' && params.searchMeetingIds) {
result.meetingIds = params.searchMeetingIds
}
return result
diff --git a/apps/sim/blocks/blocks/clerk.test.ts b/apps/sim/blocks/blocks/clerk.test.ts
new file mode 100644
index 00000000000..02cff4fc4d3
--- /dev/null
+++ b/apps/sim/blocks/blocks/clerk.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest'
+import { ClerkBlock } from '@/blocks/blocks/clerk'
+
+/**
+ * A tool call merges the stored row with the model's args (keyed by tool param names) and spreads
+ * the mapper result over them; the operation arrives only in `context`.
+ */
+const toolCall = (args: Record, operation: string) => ({
+ ...args,
+ ...ClerkBlock.tools.config?.params?.(args, { operation }),
+})
+
+describe('ClerkBlock tool calls', () => {
+ it('parses metadata the model sends as a JSON string', () => {
+ const params = toolCall(
+ { secretKey: 'sk', emailAddress: ['a@example.com'], publicMetadata: '{"plan":"pro"}' },
+ 'clerk_create_user'
+ )
+ expect(params.publicMetadata).toEqual({ plan: 'pro' })
+ expect(params.emailAddress).toEqual(['a@example.com'])
+ })
+})
diff --git a/apps/sim/blocks/blocks/clerk.ts b/apps/sim/blocks/blocks/clerk.ts
index f0cd40bec9b..be1ad8d9917 100644
--- a/apps/sim/blocks/blocks/clerk.ts
+++ b/apps/sim/blocks/blocks/clerk.ts
@@ -1,7 +1,7 @@
import { ClerkIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/**
@@ -820,9 +820,9 @@ export const ClerkBlock: BlockConfig = {
],
config: {
tool: (params) => params.operation as string,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
secretKey,
emailAddressFilter,
usernameFilter,
diff --git a/apps/sim/blocks/blocks/clickup.ts b/apps/sim/blocks/blocks/clickup.ts
index b958b465af4..5f2c73162b0 100644
--- a/apps/sim/blocks/blocks/clickup.ts
+++ b/apps/sim/blocks/blocks/clickup.ts
@@ -4,6 +4,7 @@ import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
isToolCall,
+ mapperOperation,
normalizeFileInput,
parseOptionalBooleanInput,
toolCallArg,
@@ -1479,7 +1480,7 @@ Return ONLY the value (plain string, number, or JSON) - no explanations, no extr
params: (params, context) => {
const { oauthCredential } = params
/** Agent tool calls carry the stored operation only on `context`, not in `params`. */
- const operation = params.operation ?? context?.operation
+ const operation = mapperOperation(params, context)
const baseParams = {
accessToken: oauthCredential?.accessToken,
diff --git a/apps/sim/blocks/blocks/cloudflare.test.ts b/apps/sim/blocks/blocks/cloudflare.test.ts
index 320d41cb2dc..ac1de8b7123 100644
--- a/apps/sim/blocks/blocks/cloudflare.test.ts
+++ b/apps/sim/blocks/blocks/cloudflare.test.ts
@@ -233,3 +233,40 @@ describe('Cloudflare migration convergence', () => {
expect(second.blocks['block-1'].subBlocks.recordProxied?.value).toBe('true')
})
})
+
+/**
+ * An agent tool call sends model args under the tool's param names (`type`, `files`) with the
+ * operation only on `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+describe('Cloudflare agent tool calls', () => {
+ const agentCall = (
+ operation: string,
+ args: Record
+ ): Record => ({
+ ...args,
+ ...CloudflareBlock.tools.config?.params?.(args, { operation }),
+ })
+
+ it('keeps the model record type that the canvas reads from an alias subBlock', () => {
+ expect(
+ agentCall('create_dns_record', {
+ ...CREDENTIALS,
+ zoneId: 'zone-1',
+ type: 'CNAME',
+ name: 'app.example.com',
+ content: 'origin.example.com',
+ })
+ ).toMatchObject({ type: 'CNAME' })
+ })
+
+ it('drops file targets when the model purges everything', () => {
+ expect(
+ agentCall('purge_cache', {
+ ...CREDENTIALS,
+ zoneId: 'zone-1',
+ purge_everything: true,
+ files: 'https://example.com/a.css',
+ }).files
+ ).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/cloudflare.ts b/apps/sim/blocks/blocks/cloudflare.ts
index b1b6ce473b2..fe3a894c7df 100644
--- a/apps/sim/blocks/blocks/cloudflare.ts
+++ b/apps/sim/blocks/blocks/cloudflare.ts
@@ -1,6 +1,6 @@
import { CloudflareIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { isToolCall, mapperOperation, withSavedCredential } from '@/blocks/utils'
/** Advanced inputs serialize before conditions; separate aliases prevent hidden values crossing operations. */
const SUBBLOCK_ALIASES: Record> = {
@@ -4521,11 +4521,16 @@ export const CloudflareBlock: BlockConfig = {
],
config: {
tool: (params) => `cloudflare_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result = { ...params }
- const operation = typeof result.operation === 'string' ? result.operation : ''
- for (const [toolParam, aliasId] of Object.entries(SUBBLOCK_ALIASES[operation] ?? {}))
- result[toolParam] = result[aliasId]
+ const operation = mapperOperation(params, context)
+ const toolCall = isToolCall(context)
+ for (const [toolParam, aliasId] of Object.entries(SUBBLOCK_ALIASES[operation] ?? {})) {
+ const aliasValue = result[aliasId]
+ const aliasBlank = aliasValue === undefined || aliasValue === null || aliasValue === ''
+ // A tool call carries the model's value under the tool's own param name.
+ if (!(toolCall && aliasBlank)) result[toolParam] = aliasValue
+ }
for (const aliasId of ALIASED_SUBBLOCK_IDS) result[aliasId] = void 0
if (result.proxied === 'true') result.proxied = !0
else if (result.proxied === 'false') result.proxied = !1
@@ -4545,7 +4550,7 @@ export const CloudflareBlock: BlockConfig = {
if (result.match === '') result.match = void 0
if (result.tag_match === '') result.tag_match = void 0
if (result.deploy === '') result.deploy = void 0
- if (result.operation === 'update_dns_record') {
+ if (operation === 'update_dns_record') {
if (result.content === '') result.content = void 0
if (result.name === '') result.name = void 0
if (result.comment === '') result.comment = void 0
diff --git a/apps/sim/blocks/blocks/cloudformation.test.ts b/apps/sim/blocks/blocks/cloudformation.test.ts
new file mode 100644
index 00000000000..5b6165f6f86
--- /dev/null
+++ b/apps/sim/blocks/blocks/cloudformation.test.ts
@@ -0,0 +1,32 @@
+import { describe, expect, it } from 'vitest'
+import { CloudFormationBlock } from '@/blocks/blocks/cloudformation'
+
+/**
+ * An agent tool call sends model args under the tool's param names (`description`, `tags`) with
+ * the operation only on `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+const agentCall = (operation: string, args: Record): Record => ({
+ ...args,
+ ...(CloudFormationBlock.tools.config?.params?.(args, { operation }) ?? {}),
+})
+
+describe('CloudFormationBlock agent tool calls', () => {
+ it('keeps the model change set description and tags', () => {
+ expect(
+ agentCall('create_change_set', {
+ awsRegion: 'us-east-1',
+ awsAccessKeyId: 'AKIA',
+ awsSecretAccessKey: 'secret',
+ stackName: 'app',
+ changeSetName: 'cs-1',
+ usePreviousTemplate: true,
+ description: 'Bump instance size',
+ tags: [{ Key: 'team', Value: 'infra' }],
+ })
+ ).toMatchObject({
+ usePreviousTemplate: true,
+ description: 'Bump instance size',
+ tags: [{ Key: 'team', Value: 'infra' }],
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/cloudformation.ts b/apps/sim/blocks/blocks/cloudformation.ts
index 75eb9753de0..443c84f62dc 100644
--- a/apps/sim/blocks/blocks/cloudformation.ts
+++ b/apps/sim/blocks/blocks/cloudformation.ts
@@ -2,7 +2,7 @@ import { getErrorMessage } from '@sim/utils/errors'
import { CloudFormationIcon } 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'
export const CloudFormationBlock: BlockConfig = {
type: 'cloudformation',
@@ -420,16 +420,9 @@ Return ONLY valid JSON - no explanations, no markdown code blocks.`,
throw new Error(`Invalid CloudFormation operation: ${params.operation}`)
}
},
- params: (params) => {
- const {
- operation,
- limit,
- usePreviousTemplate,
- parameters,
- tags,
- timeoutInMinutes,
- ...rest
- } = params
+ params: (params, context) => {
+ const { limit, usePreviousTemplate, parameters, tags, timeoutInMinutes, ...rest } = params
+ const operation = mapperOperation(params, context)
const awsRegion = rest.awsRegion
const awsAccessKeyId = rest.awsAccessKeyId
@@ -530,6 +523,7 @@ Return ONLY valid JSON - no explanations, no markdown code blocks.`,
}
case 'create_change_set': {
+ const description = rest.changeSetDescription || toolCallArg(context, rest.description)
if (!rest.stackName) throw new Error('Stack name is required')
if (!rest.changeSetName) throw new Error('Change set name is required')
if (!rest.templateBody && !parsedUsePreviousTemplate) {
@@ -548,8 +542,12 @@ Return ONLY valid JSON - no explanations, no markdown code blocks.`,
...(parameters && { parameters: parseJson(parameters, 'parameters') }),
...(rest.capabilities && { capabilities: rest.capabilities }),
...(rest.changeSetType && { changeSetType: rest.changeSetType }),
- ...(rest.changeSetDescription && { description: rest.changeSetDescription }),
- tags: rest.changeSetTags ? parseJson(rest.changeSetTags, 'tags') : undefined,
+ ...(description && { description }),
+ tags: rest.changeSetTags
+ ? parseJson(rest.changeSetTags, 'tags')
+ : isToolCall(context)
+ ? parseJson(tags, 'tags')
+ : undefined,
...(rest.roleArn && { roleArn: rest.roleArn }),
}
}
diff --git a/apps/sim/blocks/blocks/cloudtrail.test.ts b/apps/sim/blocks/blocks/cloudtrail.test.ts
index 71f7bd44062..bcc734a9ace 100644
--- a/apps/sim/blocks/blocks/cloudtrail.test.ts
+++ b/apps/sim/blocks/blocks/cloudtrail.test.ts
@@ -50,3 +50,22 @@ describe('CloudTrail block defaults', () => {
expect(() => CloudTrailBlock.tools.config?.params?.(params)).toThrow(/filter/i)
})
})
+
+/**
+ * An agent tool call sends model args under the tool's param names (`name` for a trail) with the
+ * operation only on `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+describe('CloudTrail agent tool calls', () => {
+ it('keeps the model trail name for get_trail', () => {
+ const args = {
+ awsRegion: 'us-east-1',
+ awsAccessKeyId: 'AKIA',
+ awsSecretAccessKey: 'secret',
+ name: 'org-trail',
+ }
+ expect({
+ ...args,
+ ...CloudTrailBlock.tools.config?.params?.(args, { operation: 'get_trail' }),
+ }).toMatchObject({ name: 'org-trail' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/cloudtrail.ts b/apps/sim/blocks/blocks/cloudtrail.ts
index 75d437d0530..03be182c6dd 100644
--- a/apps/sim/blocks/blocks/cloudtrail.ts
+++ b/apps/sim/blocks/blocks/cloudtrail.ts
@@ -1,7 +1,7 @@
import { CloudTrailIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/** Operations that accept an opaque AWS pagination token. */
const PAGINATED_OPERATIONS = [
@@ -427,155 +427,157 @@ Return ONLY the SQL query — no explanations, no markdown code blocks.`,
throw new Error(`Invalid CloudTrail operation: ${params.operation}`)
}
},
- params: (params) => {
- const { operation, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
- const awsRegion = rest.awsRegion
- const awsAccessKeyId = rest.awsAccessKeyId
- const awsSecretAccessKey = rest.awsSecretAccessKey
+ const awsRegion = params.awsRegion
+ const awsAccessKeyId = params.awsAccessKeyId
+ const awsSecretAccessKey = params.awsSecretAccessKey
const credentials = { awsRegion, awsAccessKeyId, awsSecretAccessKey }
switch (operation) {
case 'lookup_events': {
- const maxResults = parseBoundedInt(rest.lookupMaxResults)
- if (Boolean(rest.attributeKey) !== Boolean(rest.attributeValue)) {
+ const maxResults = parseBoundedInt(params.lookupMaxResults)
+ if (Boolean(params.attributeKey) !== Boolean(params.attributeValue)) {
throw new Error('Provide both a filter attribute and a filter value, or neither')
}
return {
...credentials,
- ...(rest.attributeKey && {
- attributeKey: rest.attributeKey,
- attributeValue: rest.attributeValue,
+ ...(params.attributeKey && {
+ attributeKey: params.attributeKey,
+ attributeValue: params.attributeValue,
}),
- ...(rest.startTime && { startTime: rest.startTime }),
- ...(rest.endTime && { endTime: rest.endTime }),
- ...(rest.eventCategory === 'insight' && { eventCategory: 'insight' }),
+ ...(params.startTime && { startTime: params.startTime }),
+ ...(params.endTime && { endTime: params.endTime }),
+ ...(params.eventCategory === 'insight' && { eventCategory: 'insight' }),
...(maxResults !== undefined && { maxResults }),
- ...(rest.nextToken && { nextToken: rest.nextToken }),
+ ...(params.nextToken && { nextToken: params.nextToken }),
}
}
case 'describe_trails':
return {
...credentials,
- ...(rest.trailNameList && { trailNameList: rest.trailNameList }),
- ...(rest.includeShadowTrails !== undefined &&
- rest.includeShadowTrails !== '' && {
- includeShadowTrails: String(rest.includeShadowTrails) !== 'false',
+ ...(params.trailNameList && { trailNameList: params.trailNameList }),
+ ...(params.includeShadowTrails !== undefined &&
+ params.includeShadowTrails !== '' && {
+ includeShadowTrails: String(params.includeShadowTrails) !== 'false',
}),
}
case 'get_trail':
- case 'get_trail_status':
- if (!rest.trailName) {
+ case 'get_trail_status': {
+ const name = params.trailName || toolCallArg(context, params.name)
+ if (!name) {
throw new Error('Trail name or ARN is required')
}
- return { ...credentials, name: rest.trailName }
+ return { ...credentials, name }
+ }
case 'list_trails':
return {
...credentials,
- ...(rest.nextToken && { nextToken: rest.nextToken }),
+ ...(params.nextToken && { nextToken: params.nextToken }),
}
case 'get_event_selectors':
- if (!rest.trailName) {
+ if (!params.trailName) {
throw new Error('Trail name or ARN is required')
}
- return { ...credentials, trailName: rest.trailName }
+ return { ...credentials, trailName: params.trailName }
case 'get_insight_selectors':
- if (Boolean(rest.trailName) === Boolean(rest.eventDataStore)) {
+ if (Boolean(params.trailName) === Boolean(params.eventDataStore)) {
throw new Error(
'Specify exactly one of trail name or event data store for Insights selectors'
)
}
return {
...credentials,
- ...(rest.trailName && { trailName: rest.trailName }),
- ...(rest.eventDataStore && { eventDataStore: rest.eventDataStore }),
+ ...(params.trailName && { trailName: params.trailName }),
+ ...(params.eventDataStore && { eventDataStore: params.eventDataStore }),
}
case 'start_query':
- if (Boolean(rest.queryStatement) === Boolean(rest.queryAlias)) {
+ if (Boolean(params.queryStatement) === Boolean(params.queryAlias)) {
throw new Error('Specify exactly one of Lake SQL query or query template alias')
}
return {
...credentials,
- ...(rest.queryStatement && { queryStatement: rest.queryStatement }),
- ...(rest.queryAlias && { queryAlias: rest.queryAlias }),
- ...(rest.queryParameters && { queryParameters: rest.queryParameters }),
- ...(rest.deliveryS3Uri && { deliveryS3Uri: rest.deliveryS3Uri }),
- ...(rest.eventDataStoreOwnerAccountId && {
- eventDataStoreOwnerAccountId: rest.eventDataStoreOwnerAccountId,
+ ...(params.queryStatement && { queryStatement: params.queryStatement }),
+ ...(params.queryAlias && { queryAlias: params.queryAlias }),
+ ...(params.queryParameters && { queryParameters: params.queryParameters }),
+ ...(params.deliveryS3Uri && { deliveryS3Uri: params.deliveryS3Uri }),
+ ...(params.eventDataStoreOwnerAccountId && {
+ eventDataStoreOwnerAccountId: params.eventDataStoreOwnerAccountId,
}),
}
case 'describe_query':
- if (Boolean(rest.queryId) === Boolean(rest.queryAlias)) {
+ if (Boolean(params.queryId) === Boolean(params.queryAlias)) {
throw new Error('Specify exactly one of query ID or query template alias')
}
return {
...credentials,
- ...(rest.queryId && { queryId: rest.queryId }),
- ...(rest.queryAlias && { queryAlias: rest.queryAlias }),
- ...(rest.refreshId && { refreshId: rest.refreshId }),
- ...(rest.eventDataStoreOwnerAccountId && {
- eventDataStoreOwnerAccountId: rest.eventDataStoreOwnerAccountId,
+ ...(params.queryId && { queryId: params.queryId }),
+ ...(params.queryAlias && { queryAlias: params.queryAlias }),
+ ...(params.refreshId && { refreshId: params.refreshId }),
+ ...(params.eventDataStoreOwnerAccountId && {
+ eventDataStoreOwnerAccountId: params.eventDataStoreOwnerAccountId,
}),
}
case 'get_query_results': {
- if (!rest.queryId) {
+ if (!params.queryId) {
throw new Error('Query ID is required')
}
- const maxQueryResults = parseBoundedInt(rest.maxQueryResults)
+ const maxQueryResults = parseBoundedInt(params.maxQueryResults)
return {
...credentials,
- queryId: rest.queryId,
+ queryId: params.queryId,
...(maxQueryResults !== undefined && { maxQueryResults }),
- ...(rest.nextToken && { nextToken: rest.nextToken }),
- ...(rest.eventDataStoreOwnerAccountId && {
- eventDataStoreOwnerAccountId: rest.eventDataStoreOwnerAccountId,
+ ...(params.nextToken && { nextToken: params.nextToken }),
+ ...(params.eventDataStoreOwnerAccountId && {
+ eventDataStoreOwnerAccountId: params.eventDataStoreOwnerAccountId,
}),
}
}
case 'cancel_query':
- if (!rest.queryId) {
+ if (!params.queryId) {
throw new Error('Query ID is required')
}
return {
...credentials,
- queryId: rest.queryId,
- ...(rest.eventDataStoreOwnerAccountId && {
- eventDataStoreOwnerAccountId: rest.eventDataStoreOwnerAccountId,
+ queryId: params.queryId,
+ ...(params.eventDataStoreOwnerAccountId && {
+ eventDataStoreOwnerAccountId: params.eventDataStoreOwnerAccountId,
}),
}
case 'list_event_data_stores': {
- const maxResults = parseBoundedInt(rest.eventDataStoreMaxResults)
+ const maxResults = parseBoundedInt(params.eventDataStoreMaxResults)
return {
...credentials,
...(maxResults !== undefined && { maxResults }),
- ...(rest.nextToken && { nextToken: rest.nextToken }),
+ ...(params.nextToken && { nextToken: params.nextToken }),
}
}
case 'get_event_data_store':
- if (!rest.eventDataStore) {
+ if (!params.eventDataStore) {
throw new Error('Event data store ARN or ID is required')
}
- return { ...credentials, eventDataStore: rest.eventDataStore }
+ return { ...credentials, eventDataStore: params.eventDataStore }
case 'list_tags':
- if (!rest.resourceIdList) {
+ if (!params.resourceIdList) {
throw new Error('At least one resource ARN is required')
}
return {
...credentials,
- resourceIdList: rest.resourceIdList,
- ...(rest.nextToken && { nextToken: rest.nextToken }),
+ resourceIdList: params.resourceIdList,
+ ...(params.nextToken && { nextToken: params.nextToken }),
}
default:
diff --git a/apps/sim/blocks/blocks/cloudwatch.test.ts b/apps/sim/blocks/blocks/cloudwatch.test.ts
new file mode 100644
index 00000000000..e174f1aa0f5
--- /dev/null
+++ b/apps/sim/blocks/blocks/cloudwatch.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it } from 'vitest'
+import { CloudWatchV2Block } from '@/blocks/blocks/cloudwatch'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+const configuredParams = CloudWatchV2Block.tools.config?.params
+if (!configuredParams) {
+ throw new Error('CloudWatch block must define tools.config.params')
+}
+const mapParams = configuredParams
+
+/** The tool-call merge: the mapped params land over the model's args (`{ ...args, ...mapped }`). */
+function merge(args: Record, context?: BlockToolParamsContext) {
+ return { ...args, ...mapParams(args, context) }
+}
+
+describe('CloudWatch block params', () => {
+ it('publishes a metric from model args named by the tool when the operation is only in the context', () => {
+ const merged = merge(
+ { namespace: 'Custom/App', metricName: 'Hits', value: 3 },
+ { operation: 'put_metric_data' }
+ )
+
+ expect(merged.namespace).toBe('Custom/App')
+ expect(merged.metricName).toBe('Hits')
+ expect(merged.value).toBe(3)
+ })
+ it('splits a comma-separated extendedStatistics the model sent without statistics', () => {
+ const merged = merge(
+ {
+ namespace: 'AWS/EC2',
+ metricName: 'CPUUtilization',
+ startTime: 1700000000,
+ endTime: 1700003600,
+ period: 300,
+ extendedStatistics: 'p99, p95',
+ },
+ { operation: 'get_metric_statistics' }
+ )
+
+ expect(merged.extendedStatistics).toEqual(['p99', 'p95'])
+ expect(merged.statistics).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/cloudwatch.ts b/apps/sim/blocks/blocks/cloudwatch.ts
index 83445492d2e..31e439ff7de 100644
--- a/apps/sim/blocks/blocks/cloudwatch.ts
+++ b/apps/sim/blocks/blocks/cloudwatch.ts
@@ -1,7 +1,7 @@
import { CloudWatchIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/*
* Canonical basic/advanced pairs, shared by the card sentences below. Listing
@@ -761,8 +761,9 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
throw new Error(`Invalid CloudWatch operation: ${params.operation}`)
}
},
- params: (params) => {
- const { operation, startTime, endTime, limit, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { startTime, endTime, limit, ...rest } = params
const awsRegion = rest.awsRegion
const awsAccessKeyId = rest.awsAccessKeyId
@@ -903,7 +904,8 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
}
case 'get_metric_statistics': {
- if (!rest.metricNamespace) {
+ const namespace = rest.metricNamespace || toolCallArg(context, rest.namespace)
+ if (!namespace) {
throw new Error('Namespace is required')
}
if (!rest.metricName) {
@@ -915,12 +917,15 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
if (!endTime) {
throw new Error('End time is required')
}
- if (!rest.metricPeriod) {
+ const period = rest.metricPeriod || toolCallArg(context, rest.period)
+ if (!period) {
throw new Error('Period is required')
}
- const stat = rest.metricStatistics
- if (!stat) {
+ const stat = rest.metricStatistics || toolCallArg(context, rest.statistics)
+ const extendedStat =
+ rest.metricExtendedStatistics || toolCallArg(context, rest.extendedStatistics)
+ if (!stat && !extendedStat) {
throw new Error('Statistics is required')
}
@@ -928,16 +933,16 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
awsRegion,
awsAccessKeyId,
awsSecretAccessKey,
- namespace: rest.metricNamespace,
+ namespace,
metricName: rest.metricName,
startTime: Number(startTime),
endTime: Number(endTime),
- period: Number(rest.metricPeriod),
- statistics: Array.isArray(stat) ? stat : [stat],
- ...(rest.metricExtendedStatistics && {
- extendedStatistics: Array.isArray(rest.metricExtendedStatistics)
- ? rest.metricExtendedStatistics
- : String(rest.metricExtendedStatistics)
+ period: Number(period),
+ ...(stat && { statistics: Array.isArray(stat) ? stat : [stat] }),
+ ...(extendedStat && {
+ extendedStatistics: Array.isArray(extendedStat)
+ ? extendedStat
+ : String(extendedStat)
.split(',')
.map((s: string) => s.trim())
.filter(Boolean),
@@ -963,16 +968,21 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
}
case 'put_metric_data': {
- if (!rest.metricNamespace) {
+ const namespace = rest.metricNamespace || toolCallArg(context, rest.namespace)
+ if (!namespace) {
throw new Error('Namespace is required')
}
if (!rest.metricName) {
throw new Error('Metric name is required')
}
- if (rest.metricValue === undefined || rest.metricValue === '') {
+ const metricValue =
+ rest.metricValue === undefined || rest.metricValue === ''
+ ? toolCallArg(context, rest.value)
+ : rest.metricValue
+ if (metricValue === undefined || metricValue === '') {
throw new Error('Metric value is required')
}
- const numericValue = Number(rest.metricValue)
+ const numericValue = Number(metricValue)
if (!Number.isFinite(numericValue)) {
throw new Error('Metric value must be a finite number')
}
@@ -981,7 +991,7 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
awsRegion,
awsAccessKeyId,
awsSecretAccessKey,
- namespace: rest.metricNamespace,
+ namespace,
metricName: rest.metricName,
value: numericValue,
...(rest.metricUnit && rest.metricUnit !== 'None' && { unit: rest.metricUnit }),
diff --git a/apps/sim/blocks/blocks/coda.test.ts b/apps/sim/blocks/blocks/coda.test.ts
new file mode 100644
index 00000000000..1e9773cee31
--- /dev/null
+++ b/apps/sim/blocks/blocks/coda.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from 'vitest'
+import { CodaBlock } from '@/blocks/blocks/coda'
+
+const mapParams = CodaBlock.tools.config?.params
+
+/**
+ * A tool call merges the stored row with the model's args (keyed by tool param names) and spreads
+ * the mapper result over them; the operation arrives only in `context`.
+ */
+const toolCall = (args: Record, operation: string) => ({
+ ...args,
+ ...mapParams?.(args, { operation }),
+})
+
+describe('CodaBlock', () => {
+ it('keeps the model args a tool call sends under the tool param names', () => {
+ const params = toolCall(
+ { docId: 'doc-1', tableId: 'grid-1', query: 'Status:"Done"', sortBy: 'natural', limit: 5 },
+ 'list_rows'
+ )
+ expect(params.query).toBe('Status:"Done"')
+ expect(params.sortBy).toBe('natural')
+ expect(params.limit).toBe(5)
+ })
+
+ it('does not restore a sentinel or off switch the coercion dropped on a tool call', () => {
+ const params = toolCall(
+ { docId: 'd', tableTypes: 'all', isPublished: false, visibleOnly: 'false' },
+ 'list_tables'
+ )
+ expect(params.tableTypes).toBeUndefined()
+ expect(params.isPublished).toBeUndefined()
+ expect(params.visibleOnly).toBeUndefined()
+ })
+
+ it('keeps the array form of table types a tool call sends', () => {
+ const params = toolCall({ docId: 'd', tableTypes: ['table'] }, 'list_tables')
+ expect(params.tableTypes).toEqual(['table'])
+ })
+
+ it('still drops a stale raw input on the canvas', () => {
+ const inputs = { operation: 'list_docs', query: 'stale', docSearch: 'roadmap', title: 'old' }
+ const params = { ...inputs, ...mapParams?.(inputs) }
+ expect(params.query).toBe('roadmap')
+ expect(params.title).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/coda.ts b/apps/sim/blocks/blocks/coda.ts
index 25137f72fee..7f5334e64fc 100644
--- a/apps/sim/blocks/blocks/coda.ts
+++ b/apps/sim/blocks/blocks/coda.ts
@@ -1,5 +1,6 @@
import { CodaIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
const DOC_FIELD = ['docSelector', 'manualDocId']
const PAGE_FIELD = ['pageSelector', 'manualPageId']
@@ -110,6 +111,30 @@ const PAGE_TOKEN_OPERATIONS = [...LIMIT_OPERATIONS, 'list_workspace_members']
const LIST_SORT_OPERATIONS = ['list_tables', 'list_formulas', 'list_controls']
+/**
+ * Tool params the mapper reads from the same-named field, so a tool call's own value was
+ * already coerced; the tool-call fallback must not restore a value the coercion rejected
+ * (the `'all'` table-type sentinel, an off switch).
+ */
+const SELF_MAPPED_PARAMS = new Set([
+ 'tableTypes',
+ 'limit',
+ 'discoverable',
+ 'allowEditorsToChangePermissions',
+ 'allowCopying',
+ 'allowViewersToRequestEditing',
+ 'includeSubpages',
+ 'isOwner',
+ 'isPublished',
+ 'inGallery',
+ 'useColumnNames',
+ 'useUpdatedTableLayouts',
+ 'visibleOnly',
+ 'disableParsing',
+ 'suppressEmail',
+ 'degradeGracefully',
+])
+
/** Switches only send `true`; an off switch leaves the Coda filter unset. */
function trueOrUndefined(value: unknown): true | undefined {
return value === true || value === 'true' ? true : undefined
@@ -1534,11 +1559,11 @@ Return ONLY the JSON object.`,
],
config: {
tool: (params) => `coda_${params.operation || 'list_rows'}`,
- params: (params) => {
- const operation = params.operation
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const isFolderWrite = operation === 'create_folder' || operation === 'update_folder'
const pageVisibility = params.pageVisibility
- return {
+ const mapped: Record = {
query:
operation === 'list_rows'
? params.rowFilter
@@ -1571,7 +1596,9 @@ Return ONLY the JSON object.`,
: params.listSortBy === 'name'
? 'name'
: undefined,
- tableTypes: unlessDefault(params.tableTypes, 'all'),
+ tableTypes: Array.isArray(params.tableTypes)
+ ? params.tableTypes
+ : unlessDefault(params.tableTypes, 'all'),
mode: unlessDefault(params.publishMode, 'unchanged'),
discoverable: triState(params.discoverable),
allowEditorsToChangePermissions: triState(params.allowEditorsToChangePermissions),
@@ -1593,6 +1620,14 @@ Return ONLY the JSON object.`,
suppressEmail: trueOrUndefined(params.suppressEmail),
degradeGracefully: trueOrUndefined(params.degradeGracefully),
}
+ /* A tool call keeps each model arg this mapping leaves unset instead of wiping it;
+ {@link SELF_MAPPED_PARAMS} lists the keys whose drop must stand. */
+ for (const [key, value] of Object.entries(mapped)) {
+ if (value === undefined && !SELF_MAPPED_PARAMS.has(key)) {
+ mapped[key] = toolCallArg(context, params[key])
+ }
+ }
+ return mapped
},
},
},
diff --git a/apps/sim/blocks/blocks/codepipeline.test.ts b/apps/sim/blocks/blocks/codepipeline.test.ts
new file mode 100644
index 00000000000..d3c5ff370c1
--- /dev/null
+++ b/apps/sim/blocks/blocks/codepipeline.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+import { CodePipelineV2Block } from '@/blocks/blocks/codepipeline'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+const configuredParams = CodePipelineV2Block.tools.config?.params
+if (!configuredParams) {
+ throw new Error('CodePipeline block must define tools.config.params')
+}
+const mapParams = configuredParams
+
+/** The tool-call merge: the mapped params land over the model's args (`{ ...args, ...mapped }`). */
+function merge(args: Record, context?: BlockToolParamsContext) {
+ return { ...args, ...mapParams(args, context) }
+}
+
+describe('CodePipeline block params', () => {
+ it('keeps the model approval decision on a tool call, where the operation is only in the context', () => {
+ const merged = merge(
+ {
+ pipelineName: 'deploy',
+ stageName: 'Prod',
+ actionName: 'ManualApproval',
+ token: 'tok-1',
+ status: 'Rejected',
+ summary: 'Failing canary',
+ },
+ { operation: 'put_approval_result' }
+ )
+
+ expect(merged.token).toBe('tok-1')
+ expect(merged.status).toBe('Rejected')
+ expect(merged.summary).toBe('Failing canary')
+ })
+})
diff --git a/apps/sim/blocks/blocks/codepipeline.ts b/apps/sim/blocks/blocks/codepipeline.ts
index 1a67d1dcced..53774759002 100644
--- a/apps/sim/blocks/blocks/codepipeline.ts
+++ b/apps/sim/blocks/blocks/codepipeline.ts
@@ -2,9 +2,11 @@ import { CodePipelineIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
+ mapperOperation,
parseOptionalBooleanInput,
parseOptionalJsonInput,
parseOptionalNumberInput,
+ toolCallArg,
withSavedCredential,
} from '@/blocks/utils'
@@ -397,8 +399,14 @@ export const CodePipelineBlock: BlockConfig = {
throw new Error(`Invalid CodePipeline operation: ${params.operation}`)
}
},
- params: (params) => {
- const { operation, maxResults, getPipelineVersion, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { maxResults, getPipelineVersion, ...rest } = params
+ /** A blank block-only field yields, on a tool call, the model's arg under the tool's name. */
+ const orToolArg = (blockValue: unknown, toolValue: unknown) =>
+ blockValue === undefined || blockValue === ''
+ ? (toolCallArg(context, toolValue) ?? blockValue)
+ : blockValue
const awsRegion = rest.awsRegion
const awsAccessKeyId = rest.awsAccessKeyId
@@ -530,9 +538,9 @@ export const CodePipelineBlock: BlockConfig = {
pipelineName: rest.pipelineName,
stageName: rest.stageName,
actionName: rest.actionName,
- token: rest.approvalToken,
- status: rest.approvalStatus,
- summary: rest.approvalSummary,
+ token: orToolArg(rest.approvalToken, rest.token),
+ status: orToolArg(rest.approvalStatus, rest.status),
+ summary: orToolArg(rest.approvalSummary, rest.summary),
}
case 'disable_stage_transition':
@@ -543,7 +551,7 @@ export const CodePipelineBlock: BlockConfig = {
pipelineName: rest.pipelineName,
stageName: rest.stageName,
transitionType: rest.transitionType,
- reason: rest.transitionReason,
+ reason: orToolArg(rest.transitionReason, rest.reason),
}
case 'enable_stage_transition':
diff --git a/apps/sim/blocks/blocks/confluence.test.ts b/apps/sim/blocks/blocks/confluence.test.ts
index 90a188d3b67..817445f8a34 100644
--- a/apps/sim/blocks/blocks/confluence.test.ts
+++ b/apps/sim/blocks/blocks/confluence.test.ts
@@ -67,3 +67,31 @@ describe('Confluence search-in-space values saved before the selector split', ()
expect(params.spaceId).toBeUndefined()
})
})
+
+/**
+ * On a tool call the model supplies args under the tool's param names and the operation arrives
+ * only in `context`; the handler forwards `{ ...args, ...mapped }`.
+ */
+describe('ConfluenceV2Block tool calls', () => {
+ const toolCall = (operation: string, args: Record): Record => ({
+ ...args,
+ ...ConfluenceV2Block.tools.config?.params?.(args, { operation }),
+ })
+
+ it('normalizes the model file on upload_attachment', () => {
+ const file = { name: 'a.txt', key: 'k', size: 1, type: 'text/plain' }
+ expect(toolCall('upload_attachment', { pageId: '1', file: [file] }).file).toEqual(file)
+ })
+
+ it('keeps the model args the operation branches rename', () => {
+ expect(toolCall('search_in_space', { spaceKey: 'ENG', cursor: 'c' })).toMatchObject({
+ spaceKey: 'ENG',
+ cursor: 'c',
+ })
+ expect(toolCall('search', { query: 'q', cursor: 'c' }).cursor).toBe('c')
+ expect(toolCall('delete_space_property', { spaceId: 's', propertyId: 'p' }).propertyId).toBe(
+ 'p'
+ )
+ expect(toolCall('create_page_property', { pageId: '1', key: 'k', value: 1 }).key).toBe('k')
+ })
+})
diff --git a/apps/sim/blocks/blocks/confluence.ts b/apps/sim/blocks/blocks/confluence.ts
index 4e1d31a0c05..536cf35fb45 100644
--- a/apps/sim/blocks/blocks/confluence.ts
+++ b/apps/sim/blocks/blocks/confluence.ts
@@ -3,7 +3,7 @@ import { ConfluenceIcon, PagerDutyIcon } 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 { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/** Canonical basic/advanced pair for the page target, shared by both versions. */
@@ -341,11 +341,10 @@ export const ConfluenceBlock: BlockConfig = {
return 'confluence_retrieve'
}
},
- params: (params) => {
+ params: (params, context) => {
const {
oauthCredential,
pageId,
- operation,
attachmentFile,
attachmentFileName,
attachmentComment,
@@ -354,11 +353,10 @@ export const ConfluenceBlock: BlockConfig = {
const effectivePageId = pageId ? String(pageId).trim() : ''
- if (operation === 'upload_attachment') {
+ if (mapperOperation(params, context) === 'upload_attachment') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
file: attachmentFile,
fileName: attachmentFileName,
comment: attachmentComment,
@@ -369,7 +367,6 @@ export const ConfluenceBlock: BlockConfig = {
return {
credential: oauthCredential,
pageId: effectivePageId || undefined,
- operation,
...rest,
}
},
@@ -1472,11 +1469,10 @@ export const ConfluenceV2Block: BlockConfig = {
return 'confluence_retrieve'
}
},
- params: (params) => {
+ params: (params, context) => {
const {
oauthCredential,
pageId,
- operation,
attachmentFile,
attachmentFileName,
attachmentComment,
@@ -1507,50 +1503,48 @@ export const ConfluenceV2Block: BlockConfig = {
parentCommentId,
cql,
searchCursor,
+ file: modelFile,
...rest
} = params
+ const op = mapperOperation(params, context)
const effectivePageId = pageId ? String(pageId).trim() : ''
const scopedBodyFormat =
- ['get_blogpost', 'list_pages_in_space', 'list_blogposts_in_space'].includes(operation) &&
+ ['get_blogpost', 'list_pages_in_space', 'list_blogposts_in_space'].includes(op) &&
contentBodyFormat
? { bodyFormat: contentBodyFormat }
: {}
- if (operation === 'add_label') {
+ if (op === 'add_label') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
prefix: labelPrefix || 'global',
...rest,
}
}
- if (operation === 'create_blogpost') {
+ if (op === 'create_blogpost') {
return {
credential: oauthCredential,
- operation,
status: blogPostStatus || 'current',
...rest,
}
}
- if (operation === 'delete') {
+ if (op === 'delete') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
purge: purge || false,
...rest,
}
}
- if (operation === 'list_comments') {
+ if (op === 'list_comments') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
bodyFormat: bodyFormat || 'storage',
cursor: cursor || undefined,
commentType: commentType || undefined,
@@ -1558,22 +1552,20 @@ export const ConfluenceV2Block: BlockConfig = {
}
}
- if (operation === 'create_comment') {
+ if (op === 'create_comment') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
parentCommentId: parentCommentId ? String(parentCommentId).trim() : undefined,
...rest,
}
}
- if (operation === 'search') {
+ if (op === 'search') {
return {
credential: oauthCredential,
- operation,
cql: cql || undefined,
- cursor: searchCursor || undefined,
+ cursor: searchCursor || toolCallArg(context, cursor) || undefined,
...rest,
}
}
@@ -1596,69 +1588,66 @@ export const ConfluenceV2Block: BlockConfig = {
'list_space_properties',
]
- if (supportsCursor.includes(operation) && cursor) {
+ if (supportsCursor.includes(op) && cursor) {
return {
credential: oauthCredential,
pageId: effectivePageId || undefined,
- operation,
cursor,
...scopedBodyFormat,
...rest,
}
}
- if (operation === 'create_page_property') {
- if (!propertyKey) {
+ if (op === 'create_page_property') {
+ if (!propertyKey && !toolCallArg(context, rest.key)) {
throw new Error('Property key is required for this operation.')
}
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
key: propertyKey,
value: propertyValue,
...rest,
}
}
- if (operation === 'delete_page_property') {
+ if (op === 'delete_page_property') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
propertyId,
...rest,
}
}
- if (operation === 'get_pages_by_label') {
+ if (op === 'get_pages_by_label') {
return {
credential: oauthCredential,
- operation,
labelId,
cursor: cursor || undefined,
...rest,
}
}
- if (operation === 'list_space_labels') {
+ if (op === 'list_space_labels') {
return {
credential: oauthCredential,
- operation,
cursor: cursor || undefined,
...rest,
}
}
- if (operation === 'upload_attachment') {
- const normalizedFile = normalizeFileInput(attachmentFile, { single: true })
+ if (op === 'upload_attachment') {
+ const normalizedFile = normalizeFileInput(
+ attachmentFile ?? toolCallArg(context, modelFile),
+ { single: true }
+ )
if (!normalizedFile) {
throw new Error('File is required for upload attachment operation.')
}
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
file: normalizedFile,
fileName: attachmentFileName,
comment: attachmentComment,
@@ -1666,28 +1655,25 @@ export const ConfluenceV2Block: BlockConfig = {
}
}
- if (operation === 'get_user') {
+ if (op === 'get_user') {
return {
credential: oauthCredential,
- operation,
accountId: accountId ? String(accountId).trim() : undefined,
...rest,
}
}
- if (operation === 'update_blogpost' || operation === 'delete_blogpost') {
+ if (op === 'update_blogpost' || op === 'delete_blogpost') {
return {
credential: oauthCredential,
- operation,
blogPostId: blogPostId || undefined,
...rest,
}
}
- if (operation === 'create_space') {
+ if (op === 'create_space') {
return {
credential: oauthCredential,
- operation,
name: spaceName,
key: spaceKey,
description: spaceDescription,
@@ -1695,95 +1681,85 @@ export const ConfluenceV2Block: BlockConfig = {
}
}
- if (operation === 'search_in_space') {
+ if (op === 'search_in_space') {
return {
credential: oauthCredential,
- operation,
- spaceKey: selectedSpaceKey,
- cursor: searchCursor || undefined,
+ spaceKey: selectedSpaceKey || toolCallArg(context, spaceKey),
+ cursor: searchCursor || toolCallArg(context, cursor) || undefined,
...rest,
}
}
- if (operation === 'update_space') {
+ if (op === 'update_space') {
return {
credential: oauthCredential,
- operation,
name: spaceName || rest.title,
description: spaceDescription,
...rest,
}
}
- if (operation === 'delete_space') {
+ if (op === 'delete_space') {
return {
credential: oauthCredential,
- operation,
...rest,
}
}
- if (operation === 'create_space_property') {
+ if (op === 'create_space_property') {
return {
credential: oauthCredential,
- operation,
key: spacePropertyKey,
value: spacePropertyValue,
...rest,
}
}
- if (operation === 'delete_space_property') {
+ if (op === 'delete_space_property') {
return {
credential: oauthCredential,
- operation,
- propertyId: spacePropertyId,
+ propertyId: spacePropertyId || toolCallArg(context, propertyId),
...rest,
}
}
- if (operation === 'list_space_permissions' || operation === 'list_space_properties') {
+ if (op === 'list_space_permissions' || op === 'list_space_properties') {
return {
credential: oauthCredential,
- operation,
cursor: cursor || undefined,
...rest,
}
}
- if (operation === 'get_page_descendants') {
+ if (op === 'get_page_descendants') {
return {
credential: oauthCredential,
pageId: effectivePageId,
- operation,
cursor: cursor || undefined,
...rest,
}
}
- if (operation === 'get_task') {
+ if (op === 'get_task') {
return {
credential: oauthCredential,
- operation,
taskId,
...rest,
}
}
- if (operation === 'update_task') {
+ if (op === 'update_task') {
return {
credential: oauthCredential,
- operation,
taskId,
status: taskStatus,
...rest,
}
}
- if (operation === 'list_tasks') {
+ if (op === 'list_tasks') {
return {
credential: oauthCredential,
- operation,
pageId: effectivePageId || undefined,
assignedTo: taskAssignedTo || undefined,
status: taskStatus || undefined,
@@ -1797,7 +1773,6 @@ export const ConfluenceV2Block: BlockConfig = {
pageId: effectivePageId || undefined,
blogPostId: blogPostId || undefined,
versionNumber: versionNumber ? Number.parseInt(String(versionNumber), 10) : undefined,
- operation,
...scopedBodyFormat,
...rest,
}
diff --git a/apps/sim/blocks/blocks/context_dev.test.ts b/apps/sim/blocks/blocks/context_dev.test.ts
new file mode 100644
index 00000000000..62e6bcd215d
--- /dev/null
+++ b/apps/sim/blocks/blocks/context_dev.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest'
+import { ContextDevBlock } from '@/blocks/blocks/context_dev'
+
+/**
+ * A tool call merges the stored row with the model's args (keyed by tool param names) and spreads
+ * the mapper result over them; the operation arrives only in `context`.
+ */
+const toolCall = (args: Record, operation: string) => ({
+ ...args,
+ ...ContextDevBlock.tools.config?.params?.(args, { operation }),
+})
+
+describe('ContextDevBlock tool calls', () => {
+ it('parses an extraction schema the model sends as a JSON string', () => {
+ const params = toolCall(
+ { apiKey: 'key', url: 'https://example.com', schema: '{"type":"object"}', maxPages: 3 },
+ 'extract'
+ )
+ expect(params.schema).toEqual({ type: 'object' })
+ expect(params.maxPages).toBe(3)
+ })
+})
diff --git a/apps/sim/blocks/blocks/context_dev.ts b/apps/sim/blocks/blocks/context_dev.ts
index cc8eaadfb7e..98ff5574718 100644
--- a/apps/sim/blocks/blocks/context_dev.ts
+++ b/apps/sim/blocks/blocks/context_dev.ts
@@ -1,6 +1,7 @@
import { ContextDevIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
/** Operations whose primary input is a full page URL. */
const URL_OPS = [
@@ -628,9 +629,9 @@ Do not include any explanations, markdown formatting, or other text outside the
config: {
tool: (params) =>
params.operation ? `context_dev_${params.operation}` : 'context_dev_scrape_markdown',
- params: (params) => {
- const { operation, apiKey } = params
- const result: Record = { apiKey }
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const result: Record = { apiKey: params.apiKey }
const setBool = (key: string) => {
if (params[key] != null) result[key] = params[key]
diff --git a/apps/sim/blocks/blocks/crowdstrike.test.ts b/apps/sim/blocks/blocks/crowdstrike.test.ts
index 646c499a851..488a41da81c 100644
--- a/apps/sim/blocks/blocks/crowdstrike.test.ts
+++ b/apps/sim/blocks/blocks/crowdstrike.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import { CrowdStrikeBlock } from '@/blocks/blocks/crowdstrike'
+import type { BlockToolParamsContext } from '@/blocks/types'
const mapParams = CrowdStrikeBlock.tools.config?.params
if (!mapParams) {
@@ -18,8 +19,8 @@ const credentials = {
* subBlock value. Every assertion here runs against the merged result, because a
* mapper-only assertion passes even when the raw value survives onto the wire.
*/
-function merge(inputs: Record) {
- return { ...inputs, ...mapParams(inputs) }
+function merge(inputs: Record, context?: BlockToolParamsContext) {
+ return { ...inputs, ...mapParams(inputs, context) }
}
describe('CrowdStrike block params', () => {
@@ -146,4 +147,14 @@ describe('CrowdStrike block params', () => {
expect(merged.includeHidden).toBe(false)
})
+
+ it('keeps the model host action and hosts on a tool call, where the operation is only in the context', () => {
+ const merged = merge(
+ { ...credentials, actionName: 'lift_containment', deviceIds: ['aid-1'] },
+ { operation: 'crowdstrike_perform_host_action' }
+ )
+
+ expect(merged.actionName).toBe('lift_containment')
+ expect(merged.deviceIds).toEqual(['aid-1'])
+ })
})
diff --git a/apps/sim/blocks/blocks/crowdstrike.ts b/apps/sim/blocks/blocks/crowdstrike.ts
index 0e713d6bec7..a9e7d5a1415 100644
--- a/apps/sim/blocks/blocks/crowdstrike.ts
+++ b/apps/sim/blocks/blocks/crowdstrike.ts
@@ -2,9 +2,11 @@ import { CrowdStrikeIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
+ mapperOperation,
parseOptionalBooleanInput,
parseOptionalJsonInput,
parseOptionalNumberInput,
+ toolCallArg,
withSavedCredential,
} from '@/blocks/utils'
@@ -840,8 +842,8 @@ export const CrowdStrikeBlock: BlockConfig = {
config: {
tool: (params) =>
typeof params.operation === 'string' ? params.operation : 'crowdstrike_query_alerts',
- params: (params) => {
- const operation = typeof params.operation === 'string' ? params.operation : ''
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
/**
* The executor merges this result over the raw block inputs, so a key this
@@ -928,14 +930,20 @@ export const CrowdStrikeBlock: BlockConfig = {
setJson('actionParameters', params.actionParameters, 'action parameters')
break
case 'crowdstrike_perform_host_action':
- setString('actionName', params.hostActionName)
+ setString(
+ 'actionName',
+ params.hostActionName || toolCallArg(context, params.actionName)
+ )
setJson('deviceIds', params.deviceIds, 'host agent IDs')
break
case 'crowdstrike_get_host_group_details':
setJson('hostGroupIds', params.hostGroupIds, 'host group IDs')
break
case 'crowdstrike_perform_host_group_action':
- setString('actionName', params.hostGroupActionName)
+ setString(
+ 'actionName',
+ params.hostGroupActionName || toolCallArg(context, params.actionName)
+ )
setString('hostGroupId', params.hostGroupId)
setJson('deviceIds', params.deviceIds, 'host agent IDs')
break
@@ -951,7 +959,7 @@ export const CrowdStrikeBlock: BlockConfig = {
break
case 'crowdstrike_delete_indicators':
setJson('indicatorIds', params.indicatorIds, 'indicator IDs')
- setString('filter', params.deleteFilter)
+ setString('filter', params.deleteFilter || toolCallArg(context, params.filter))
setString('comment', params.comment)
break
case 'crowdstrike_get_vulnerability_details':
diff --git a/apps/sim/blocks/blocks/crunchbase.test.ts b/apps/sim/blocks/blocks/crunchbase.test.ts
index 45f6c67c5ff..ed4c8805d6f 100644
--- a/apps/sim/blocks/blocks/crunchbase.test.ts
+++ b/apps/sim/blocks/blocks/crunchbase.test.ts
@@ -87,4 +87,23 @@ describe('CrunchbaseBlock', () => {
expect(deleted.collection).toBe('people')
expect(deleted.deletedCollection).toBeUndefined()
})
+
+ /*
+ * A tool call merges the stored row with the model's args, keyed by the tool's
+ * param names, and carries the operation only in `context`.
+ */
+ it('keeps the model args a tool call sends under the tool param names', () => {
+ const args = {
+ apiKey: 'key',
+ collection: 'organizations',
+ query: [{ type: 'predicate', field_id: 'num_employees_enum' }],
+ fieldIds: ['identifier'],
+ limit: 10,
+ }
+ const params = { ...args, ...buildParams(args, { operation: 'search_entities' }) }
+ expect(params.collection).toBe('organizations')
+ expect(params.query).toEqual(args.query)
+ expect(params.fieldIds).toEqual(['identifier'])
+ expect(params.limit).toBe(10)
+ })
})
diff --git a/apps/sim/blocks/blocks/crunchbase.ts b/apps/sim/blocks/blocks/crunchbase.ts
index 0ed7810ed62..8d78ff352b9 100644
--- a/apps/sim/blocks/blocks/crunchbase.ts
+++ b/apps/sim/blocks/blocks/crunchbase.ts
@@ -2,7 +2,7 @@ import { Building, ListChecks, Search, Sprout, Trash, Users } from '@sim/emcn/ic
import { CrunchbaseIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import {
CRUNCHBASE_CARD_COLLECTIONS,
CRUNCHBASE_COLLECTIONS,
@@ -394,8 +394,8 @@ export const CrunchbaseBlock: BlockConfig = {
* advanced field is serialized on non-emptiness alone, even while the UI
* hides it. `undefined` is what actually drops one.
*/
- params: (params) => {
- const operation = String(params.operation ?? '')
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const isSearch = (SEARCH_OPERATIONS as readonly string[]).includes(operation)
const isLookup = (LOOKUP_OPERATIONS as readonly string[]).includes(operation)
const isCollectionScoped = (COLLECTION_OPERATIONS as readonly string[]).includes(operation)
@@ -406,13 +406,16 @@ export const CrunchbaseBlock: BlockConfig = {
const paginates = isSearch || isCard || isDeleted
let query: unknown
- if (isSearch) query = params.searchQuery
- else if (isAutocomplete) query = params.autocompleteQuery
+ if (isSearch) query = params.searchQuery ?? toolCallArg(context, params.query)
+ else if (isAutocomplete)
+ query = params.autocompleteQuery ?? toolCallArg(context, params.query)
let collection: unknown
if (isCollectionScoped) collection = params.collection
- else if (isCard) collection = params.cardCollection
- else if (isDeleted) collection = params.deletedCollection
+ else if (isCard)
+ collection = params.cardCollection ?? toolCallArg(context, params.collection)
+ else if (isDeleted)
+ collection = params.deletedCollection ?? toolCallArg(context, params.collection)
return {
apiKey: params.apiKey,
@@ -422,7 +425,7 @@ export const CrunchbaseBlock: BlockConfig = {
cardId: isCard ? params.cardId : undefined,
fieldIds:
operation === 'search_entities'
- ? params.searchFieldIds
+ ? (params.searchFieldIds ?? toolCallArg(context, params.fieldIds))
: isSearch || isLookup
? params.fieldIds
: undefined,
diff --git a/apps/sim/blocks/blocks/dagster.test.ts b/apps/sim/blocks/blocks/dagster.test.ts
new file mode 100644
index 00000000000..de353d98bed
--- /dev/null
+++ b/apps/sim/blocks/blocks/dagster.test.ts
@@ -0,0 +1,60 @@
+/**
+ * An Agent tool call runs the block mapper over `{ ...storedRowParams, ...modelArgs }` with the
+ * operation only in `context`; the tool then receives `{ ...merged, ...mapped }`.
+ */
+import { describe, expect, it } from 'vitest'
+import { DagsterBlock } from '@/blocks/blocks/dagster'
+import { materializeAssetsTool } from '@/tools/dagster/materialize_assets'
+import { reportAssetMaterializationTool } from '@/tools/dagster/report_asset_materialization'
+
+function materializeVariables(args: Record) {
+ const mapped =
+ DagsterBlock.tools.config?.params?.(args, { operation: 'materialize_assets' }) ?? {}
+ const body = materializeAssetsTool.request.body
+ if (typeof body !== 'function') throw new Error('materialize_assets has no body builder')
+ return (body({ ...args, ...mapped } as never) as { variables: Record }).variables
+}
+
+const BASE_ARGS = {
+ host: 'https://dagster.example.com',
+ repositoryLocationName: 'loc',
+ repositoryName: 'repo',
+ assetSelection: 'orders',
+}
+
+describe('Dagster materialize assets on an Agent tool call', () => {
+ it('sends the job name stored on the tool row', () => {
+ expect(materializeVariables({ ...BASE_ARGS, assetJobName: 'stored_job' }).jobName).toBe(
+ 'stored_job'
+ )
+ })
+
+ it('keeps the job name the model supplied', () => {
+ expect(materializeVariables({ ...BASE_ARGS, jobName: 'model_job' }).jobName).toBe('model_job')
+ })
+})
+
+function reportedEventType(args: Record) {
+ const mapped =
+ DagsterBlock.tools.config?.params?.(args, { operation: 'report_asset_materialization' }) ?? {}
+ const body = reportAssetMaterializationTool.request.body
+ if (typeof body !== 'function')
+ throw new Error('report_asset_materialization has no body builder')
+ const { variables } = body({ ...args, ...mapped } as never) as {
+ variables: { eventParams: { eventType: unknown } }
+ }
+ return variables.eventParams.eventType
+}
+
+describe('Dagster report asset event on an Agent tool call', () => {
+ it('keeps the event type the model supplied over the seeded dropdown default', () => {
+ expect(
+ reportedEventType({
+ host: 'https://dagster.example.com',
+ assetKey: 'orders',
+ reportEventType: 'ASSET_MATERIALIZATION',
+ eventType: 'ASSET_OBSERVATION',
+ })
+ ).toBe('ASSET_OBSERVATION')
+ })
+})
diff --git a/apps/sim/blocks/blocks/dagster.ts b/apps/sim/blocks/blocks/dagster.ts
index deb79ba2013..a445401dcce 100644
--- a/apps/sim/blocks/blocks/dagster.ts
+++ b/apps/sim/blocks/blocks/dagster.ts
@@ -1,6 +1,7 @@
import { DagsterIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
/** Coerces a subBlock value to a finite number, returning undefined for empty or non-numeric input. */
function toFiniteNumber(value: unknown): number | undefined {
@@ -548,46 +549,56 @@ Return ONLY the comma-separated asset keys - no explanations, no extra text.`,
],
config: {
tool: (params) => `dagster_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
- if (params.operation === 'list_runs') {
+ if (operation === 'list_runs') {
result.limit = toFiniteNumber(params.limit)
- result.jobName = params.listRunsJobName || undefined
+ result.jobName =
+ params.listRunsJobName || toolCallArg(context, params.jobName) || undefined
result.createdAfter = toFiniteNumber(params.createdAfter)
result.createdBefore = toFiniteNumber(params.createdBefore)
- result.cursor = params.runsCursor || undefined
+ result.cursor = params.runsCursor || toolCallArg(context, params.cursor) || undefined
}
- if (params.operation === 'get_run_logs') {
- result.limit = toFiniteNumber(params.logsLimit)
+ if (operation === 'get_run_logs') {
+ result.limit =
+ toFiniteNumber(params.logsLimit) ?? toolCallArg(context, toFiniteNumber(params.limit))
}
- if (params.operation === 'reexecute_run') {
+ if (operation === 'reexecute_run') {
if (params.runId) result.parentRunId = params.runId
}
- if (params.operation === 'list_schedules' && !params.scheduleStatus) {
+ if (operation === 'list_schedules' && !params.scheduleStatus) {
result.scheduleStatus = undefined
}
- if (params.operation === 'list_sensors' && !params.sensorStatus) {
+ if (operation === 'list_sensors' && !params.sensorStatus) {
result.sensorStatus = undefined
}
- if (params.operation === 'list_assets') {
- result.prefix = params.assetPrefix || undefined
- result.limit = toFiniteNumber(params.assetsLimit)
- result.cursor = params.assetsCursor || undefined
+ if (operation === 'list_assets') {
+ result.prefix = params.assetPrefix || toolCallArg(context, params.prefix) || undefined
+ result.limit =
+ toFiniteNumber(params.assetsLimit) ?? toolCallArg(context, toFiniteNumber(params.limit))
+ result.cursor = params.assetsCursor || toolCallArg(context, params.cursor) || undefined
}
- if (params.operation === 'materialize_assets') {
- result.jobName = params.assetJobName
+ if (operation === 'materialize_assets') {
+ result.jobName =
+ params.assetJobName || toolCallArg(context, params.jobName) || params.assetJobName
}
- if (params.operation === 'report_asset_materialization') {
- result.eventType = params.reportEventType || 'ASSET_MATERIALIZATION'
- result.partitionKeys = params.reportPartitionKeys || undefined
- result.description = params.reportDescription || undefined
+ if (operation === 'report_asset_materialization') {
+ result.eventType =
+ toolCallArg(context, params.eventType) ||
+ params.reportEventType ||
+ 'ASSET_MATERIALIZATION'
+ result.partitionKeys =
+ params.reportPartitionKeys || toolCallArg(context, params.partitionKeys) || undefined
+ result.description =
+ params.reportDescription || toolCallArg(context, params.description) || undefined
}
return result
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..29b78e12fa6 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 { 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'
/**
@@ -1961,14 +1961,31 @@ 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) {
+ /**
+ * 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) =>
+ 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]))
+ /** 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 +2012,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 +2025,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 +2049,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 +2070,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 +2097,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 +2251,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 +2270,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 +2315,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 +2519,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 +2535,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/daytona.test.ts b/apps/sim/blocks/blocks/daytona.test.ts
new file mode 100644
index 00000000000..8529767cac1
--- /dev/null
+++ b/apps/sim/blocks/blocks/daytona.test.ts
@@ -0,0 +1,38 @@
+/**
+ * An Agent tool call runs the block mapper over `{ ...storedRowParams, ...modelArgs }` with the
+ * operation only in `context`; the tool then receives `{ ...merged, ...mapped }`.
+ */
+import { describe, expect, it } from 'vitest'
+import { DaytonaBlock } from '@/blocks/blocks/daytona'
+import { daytonaGitCloneTool } from '@/tools/daytona/git_clone'
+
+function gitCloneBody(args: Record) {
+ const mapped = DaytonaBlock.tools.config?.params?.(args, { operation: 'git_clone' }) ?? {}
+ const body = daytonaGitCloneTool.request.body
+ if (typeof body !== 'function') throw new Error('git_clone has no body builder')
+ return body({ ...args, ...mapped } as never)
+}
+
+describe('Daytona git clone on an Agent tool call', () => {
+ it('sends the repository and path stored on the tool row', () => {
+ expect(
+ gitCloneBody({
+ apiKey: 'key',
+ sandboxId: 'sb-1',
+ repoUrl: 'https://github.com/acme/app.git',
+ clonePath: '/home/daytona/app',
+ })
+ ).toMatchObject({ url: 'https://github.com/acme/app.git', path: '/home/daytona/app' })
+ })
+
+ it('keeps the repository and path the model supplied', () => {
+ expect(
+ gitCloneBody({
+ apiKey: 'key',
+ sandboxId: 'sb-1',
+ url: 'https://github.com/acme/model.git',
+ path: '/home/daytona/model',
+ })
+ ).toMatchObject({ url: 'https://github.com/acme/model.git', path: '/home/daytona/model' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/daytona.ts b/apps/sim/blocks/blocks/daytona.ts
index 46ca0fc2eed..b75d0c6dca3 100644
--- a/apps/sim/blocks/blocks/daytona.ts
+++ b/apps/sim/blocks/blocks/daytona.ts
@@ -1,7 +1,12 @@
import { DaytonaIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
const SANDBOX_SCOPED_OPERATIONS = [
'execute_command',
@@ -452,8 +457,9 @@ export const DaytonaBlock: BlockConfig = {
],
config: {
tool: (params) => `daytona_${params.operation}`,
- params: (params) => {
- const { operation, apiKey, ...rest } = params
+ params: (params, context) => {
+ const { apiKey, ...rest } = params
+ const operation = mapperOperation(params, context)
const baseParams: Record = { apiKey }
@@ -515,8 +521,8 @@ export const DaytonaBlock: BlockConfig = {
if (rest.directoryPath) baseParams.path = rest.directoryPath
break
case 'git_clone':
- baseParams.url = rest.repoUrl
- baseParams.path = rest.clonePath
+ baseParams.url = rest.repoUrl || toolCallArg(context, rest.url) || rest.repoUrl
+ baseParams.path = rest.clonePath || toolCallArg(context, rest.path) || rest.clonePath
if (rest.gitBranch) baseParams.branch = rest.gitBranch
if (rest.gitCommitId) baseParams.commitId = rest.gitCommitId
if (rest.gitUsername) baseParams.username = rest.gitUsername
diff --git a/apps/sim/blocks/blocks/deployments.test.ts b/apps/sim/blocks/blocks/deployments.test.ts
new file mode 100644
index 00000000000..6c6c2330a21
--- /dev/null
+++ b/apps/sim/blocks/blocks/deployments.test.ts
@@ -0,0 +1,13 @@
+import { describe, expect, it } from 'vitest'
+import { DeploymentsBlock } from '@/blocks/blocks/deployments'
+
+describe('DeploymentsBlock params on a tool call', () => {
+ it('keeps the model version label and description for deploy', () => {
+ expect(
+ DeploymentsBlock.tools.config?.params?.(
+ { workflowId: 'wf-1', name: 'Release 4', description: 'Adds retries' },
+ { operation: 'deployments_deploy' }
+ )
+ ).toEqual({ workflowId: 'wf-1', name: 'Release 4', description: 'Adds retries' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/deployments.ts b/apps/sim/blocks/blocks/deployments.ts
index b9e419a7ea6..187db8b7b37 100644
--- a/apps/sim/blocks/blocks/deployments.ts
+++ b/apps/sim/blocks/blocks/deployments.ts
@@ -1,5 +1,6 @@
import { Rocket } from '@sim/emcn/icons'
import type { BlockConfig } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
const WORKFLOW_FIELD = ['workflowSelector', 'manualWorkflowId'] as const
@@ -117,8 +118,8 @@ export const DeploymentsBlock: BlockConfig = {
],
config: {
tool: (params: Record) => params.operation || 'deployments_deploy',
- params: (params: Record) => {
- const operation = params.operation || 'deployments_deploy'
+ params: (params: Record, context) => {
+ const operation = mapperOperation(params, context) || 'deployments_deploy'
const workflowId = typeof params.workflowId === 'string' ? params.workflowId.trim() : ''
if (!workflowId) {
throw new Error('Deployments Block Error: Workflow is required')
@@ -127,8 +128,11 @@ export const DeploymentsBlock: BlockConfig = {
if (operation === 'deployments_deploy') {
return {
workflowId,
- name: params.versionName?.trim() || undefined,
- description: params.versionDescription?.trim() || undefined,
+ name: params.versionName?.trim() || toolCallArg(context, params.name) || undefined,
+ description:
+ params.versionDescription?.trim() ||
+ toolCallArg(context, params.description) ||
+ undefined,
}
}
diff --git a/apps/sim/blocks/blocks/discord.test.ts b/apps/sim/blocks/blocks/discord.test.ts
new file mode 100644
index 00000000000..b5e04077270
--- /dev/null
+++ b/apps/sim/blocks/blocks/discord.test.ts
@@ -0,0 +1,189 @@
+/**
+ * Agent tool calls pass the operation only in context and supply arguments under the tool's param
+ * names, so the Discord mapping must run there; canvas "No change" flags must stay unsent.
+ */
+import { describe, expect, it } from 'vitest'
+import { DiscordV2Block } from '@/blocks/blocks/discord'
+import { discordAddReactionTool } from '@/tools/discord/add_reaction'
+import { discordArchiveThreadTool } from '@/tools/discord/archive_thread'
+import { discordBanMemberTool } from '@/tools/discord/ban_member'
+import { discordBulkDeleteMessagesTool } from '@/tools/discord/bulk_delete_messages'
+import { discordCreateChannelTool } from '@/tools/discord/create_channel'
+import { discordGetMessagesTool } from '@/tools/discord/get_messages'
+import { discordSendMessageTool } from '@/tools/discord/send_message'
+import { discordUpdateMemberTool } from '@/tools/discord/update_member'
+import { discordUpdateRoleTool } from '@/tools/discord/update_role'
+import type { ToolConfig } from '@/tools/types'
+
+function sentParams(
+ inputs: Record,
+ context?: { operation: string }
+): Record {
+ const mapper = DiscordV2Block.tools.config?.params
+ if (!mapper) throw new Error('Discord block has no params mapper')
+ return { ...inputs, ...mapper(inputs, context) }
+}
+
+function requestUrl(tool: ToolConfig, params: Record): string {
+ const url = tool.request.url
+ return typeof url === 'function' ? url(params) : url
+}
+
+function requestBody(tool: ToolConfig, params: Record): unknown {
+ const build = tool.request.body
+ if (typeof build !== 'function') throw new Error(`${tool.id} has no request body`)
+ return build(params)
+}
+
+describe('Discord agent tool calls', () => {
+ it.each([
+ ['a comma list from the tool row', '111, 222'],
+ ['an array from the model', ['111', '222']],
+ ])('bulk deletes the message IDs given as %s', (_label, messageIds) => {
+ const params = sentParams(
+ { botToken: 'bot', serverId: '1', channelId: '9', messageIds },
+ { operation: 'discord_bulk_delete_messages' }
+ )
+ expect(requestBody(discordBulkDeleteMessagesTool, params)).toEqual({
+ messages: ['111', '222'],
+ })
+ })
+
+ it.each([
+ [true, true],
+ ['false', false],
+ ])('sends archived %j to Discord as the boolean %j', (archived, expected) => {
+ const params = sentParams(
+ { botToken: 'bot', serverId: '1', threadId: '7', archived },
+ { operation: 'discord_archive_thread' }
+ )
+ expect(requestBody(discordArchiveThreadTool, params)).toEqual({ archived: expected })
+ })
+
+ it('runs a channel operation without a server ID, but not a guild operation', () => {
+ const params = sentParams(
+ { botToken: 'bot', channelId: '9', messageId: '8', emoji: '👍' },
+ { operation: 'discord_add_reaction' }
+ )
+ expect(requestUrl(discordAddReactionTool, params)).toBe(
+ 'https://discord.com/api/v10/channels/9/messages/8/reactions/%F0%9F%91%8D/@me'
+ )
+ expect(() =>
+ sentParams({ botToken: 'bot', userId: '5' }, { operation: 'discord_get_member' })
+ ).toThrow('Server ID is required')
+ })
+
+ it("pages messages from the model's cursor, never from a stale pinned-messages timestamp", () => {
+ const agent = sentParams(
+ { botToken: 'bot', serverId: '1', channelId: '9', before: '123' },
+ { operation: 'discord_get_messages' }
+ )
+ expect(requestUrl(discordGetMessagesTool, agent)).toBe(
+ 'https://discord.com/api/v10/channels/9/messages?limit=10&before=123'
+ )
+
+ const canvas = sentParams({
+ operation: 'discord_get_messages',
+ botToken: 'bot',
+ serverId: '1',
+ channelId: '9',
+ before: '2026-01-01T00:00:00Z',
+ })
+ expect(requestUrl(discordGetMessagesTool, canvas)).toBe(
+ 'https://discord.com/api/v10/channels/9/messages?limit=10'
+ )
+ })
+
+ it("creates the model's channel type over the tool row's seeded text-channel option", () => {
+ const agent = sentParams(
+ { botToken: 'bot', serverId: '1', name: 'vc', channelType: '0', type: 2 },
+ { operation: 'discord_create_channel' }
+ )
+ expect(requestBody(discordCreateChannelTool, agent)).toEqual({ name: 'vc', type: 2 })
+
+ const canvas = sentParams({
+ operation: 'discord_create_channel',
+ botToken: 'bot',
+ serverId: '1',
+ name: 'vc',
+ channelType: '2',
+ })
+ expect(requestBody(discordCreateChannelTool, canvas)).toEqual({ name: 'vc', type: 2 })
+ })
+
+ it("bans with the model's message purge window over the tool row's seeded zero days", () => {
+ const agent = sentParams(
+ {
+ botToken: 'bot',
+ serverId: '1',
+ userId: '5',
+ deleteMessageDays: '0',
+ deleteMessageSeconds: 604800,
+ },
+ { operation: 'discord_ban_member' }
+ )
+ expect(requestBody(discordBanMemberTool, agent)).toEqual({ delete_message_seconds: 604800 })
+
+ const canvas = sentParams({
+ operation: 'discord_ban_member',
+ botToken: 'bot',
+ serverId: '1',
+ userId: '5',
+ deleteMessageDays: '7',
+ })
+ expect(requestBody(discordBanMemberTool, canvas)).toEqual({ delete_message_seconds: 604800 })
+ })
+})
+
+describe('Discord canvas "No change" flags', () => {
+ it('renames a member without touching their voice mute or deafen state', () => {
+ const params = sentParams({
+ operation: 'discord_update_member',
+ botToken: 'bot',
+ serverId: '1',
+ userId: '5',
+ nick: 'Ada',
+ mute: '',
+ deaf: '',
+ })
+ expect(requestBody(discordUpdateMemberTool, params)).toEqual({ nick: 'Ada' })
+ })
+
+ it('renames a role without changing whether it is hoisted or mentionable', () => {
+ const params = sentParams({
+ operation: 'discord_update_role',
+ botToken: 'bot',
+ serverId: '1',
+ roleId: '3',
+ name: 'Mods',
+ hoist: '',
+ mentionable: '',
+ })
+ expect(requestBody(discordUpdateRoleTool, params)).toEqual({ name: 'Mods' })
+ })
+})
+
+describe('Discord request paths', () => {
+ it('rejects an ID that would steer the bot request to another endpoint', () => {
+ expect(() =>
+ requestUrl(discordAddReactionTool, {
+ botToken: 'bot',
+ channelId: '9/../../guilds/1',
+ messageId: '8',
+ emoji: 'x',
+ })
+ ).toThrow('channelId cannot contain a path separator')
+ })
+})
+
+describe('Discord send message', () => {
+ it('posts a file-only message without placeholder text', () => {
+ const input = discordSendMessageTool.operation.input({
+ botToken: 'bot',
+ serverId: '1',
+ channelId: '9',
+ files: [{ id: 'f', name: 'a.png', url: 'u', size: 1, type: 'image/png', key: 'k' }],
+ } as never) as { content?: string }
+ expect(input.content).toBeUndefined()
+ })
+})
diff --git a/apps/sim/blocks/blocks/discord.ts b/apps/sim/blocks/blocks/discord.ts
index 13042e581a0..7675061cd43 100644
--- a/apps/sim/blocks/blocks/discord.ts
+++ b/apps/sim/blocks/blocks/discord.ts
@@ -1,7 +1,19 @@
import { DiscordIcon } from '@/components/icons'
-import type { BlockConfig, BlockMeta, BlockToolParams } from '@/blocks/types'
+import type {
+ BlockConfig,
+ BlockMeta,
+ BlockToolParams,
+ BlockToolParamsContext,
+} from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ parseOptionalBooleanInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
+import { parseMessageIds } from '@/tools/discord/bulk_delete_messages'
/**
* Canonical basic/advanced pair, shared by the card sentences below. Listing
@@ -10,16 +22,51 @@ import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
*/
const ATTACHMENTS_FIELD = ['attachmentFiles', 'files'] as const
-function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
- const commonParams: Record = {
+/** Operations whose endpoint is addressed by the guild, so they cannot run without a server ID. */
+const GUILD_SCOPED_OPERATIONS = [
+ 'discord_get_server',
+ 'discord_list_channels',
+ 'discord_create_channel',
+ 'discord_create_role',
+ 'discord_update_role',
+ 'discord_delete_role',
+ 'discord_assign_role',
+ 'discord_remove_role',
+ 'discord_list_roles',
+ 'discord_kick_member',
+ 'discord_ban_member',
+ 'discord_unban_member',
+ 'discord_get_member',
+ 'discord_update_member',
+]
+
+/**
+ * Leaves a voice or role flag as it is on an update. Listed first so an update, and an Agent tool
+ * row (which seeds the first option), never overwrite the flag unless one is chosen.
+ */
+const NO_CHANGE_OPTION = { label: 'No change', id: '' }
+const HOIST_YES = { label: 'Yes - Display role members separately', id: 'true' }
+const HOIST_NO = { label: "No - Don't display separately", id: 'false' }
+const MENTIONABLE_YES = { label: 'Yes - Role can be mentioned', id: 'true' }
+const MENTIONABLE_NO = { label: 'No - Role cannot be mentioned', id: 'false' }
+
+function discordToolParams(
+ params: BlockToolParams,
+ requireBotToken: boolean,
+ context?: BlockToolParamsContext
+) {
+ const operation = mapperOperation(params, context)
+ const commonParams: Record = {
botToken: params.botToken,
serverId: params.serverId,
}
if (requireBotToken && !params.botToken) throw new Error('Bot token is required')
- if (!params.serverId) throw new Error('Server ID is required')
+ if (GUILD_SCOPED_OPERATIONS.includes(operation) && !params.serverId) {
+ throw new Error('Server ID is required')
+ }
- switch (params.operation) {
+ switch (operation) {
case 'discord_send_message': {
return {
...commonParams,
@@ -33,6 +80,7 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
...commonParams,
channelId: params.channelId,
limit: params.limit ? Math.min(Math.max(1, Number(params.limit)), 100) : 10,
+ before: toolCallArg(context, params.before),
}
case 'discord_get_server':
return commonParams
@@ -55,10 +103,7 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
return {
...commonParams,
channelId: params.channelId,
- messageIds: String(params.messageIds || '')
- .split(',')
- .map((id: string) => id.trim())
- .filter(Boolean),
+ messageIds: parseMessageIds(params.messageIds),
}
case 'discord_get_pinned_messages':
return {
@@ -83,7 +128,10 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
channelId: params.channelId,
messageId: params.messageId,
}
- case 'discord_create_thread':
+ case 'discord_create_thread': {
+ const isPublic =
+ toolCallArg(context, parseOptionalBooleanInput(params.isPublic)) ??
+ (params.threadVisibility !== undefined ? params.threadVisibility !== 'private' : undefined)
return {
...commonParams,
channelId: params.channelId,
@@ -92,10 +140,9 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
...(params.autoArchiveDuration && {
autoArchiveDuration: Number(params.autoArchiveDuration),
}),
- ...(params.threadVisibility !== undefined && {
- isPublic: params.threadVisibility !== 'private',
- }),
+ ...(isPublic !== undefined && { isPublic }),
}
+ }
case 'discord_join_thread':
case 'discord_leave_thread':
return { ...commonParams, threadId: params.threadId }
@@ -103,16 +150,20 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
return {
...commonParams,
threadId: params.threadId,
- archived: params.archived === 'true',
+ archived: parseOptionalBooleanInput(params.archived) ?? false,
}
- case 'discord_create_channel':
+ case 'discord_create_channel': {
+ const type =
+ toolCallArg(context, params.type) ??
+ (params.channelType ? Number(params.channelType) : undefined)
return {
...commonParams,
name: params.name,
...(params.topic && { topic: params.topic }),
- ...(params.channelType && { type: Number(params.channelType) }),
+ ...(type !== undefined && { type }),
...(params.parentId && { parentId: params.parentId }),
}
+ }
case 'discord_update_channel':
return {
...commonParams,
@@ -126,26 +177,19 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
case 'discord_list_channels':
return commonParams
case 'discord_create_role':
+ case 'discord_update_role': {
+ const hoist = parseOptionalBooleanInput(params.hoist)
+ const mentionable = parseOptionalBooleanInput(params.mentionable)
return {
...commonParams,
- name: params.name,
+ ...(operation === 'discord_create_role'
+ ? { name: params.name }
+ : { roleId: params.roleId, ...(params.name && { name: params.name }) }),
...(params.color && { color: Number(params.color) }),
- ...(params.hoist !== undefined && { hoist: params.hoist === 'true' }),
- ...(params.mentionable !== undefined && {
- mentionable: params.mentionable === 'true',
- }),
- }
- case 'discord_update_role':
- return {
- ...commonParams,
- roleId: params.roleId,
- ...(params.name && { name: params.name }),
- ...(params.color && { color: Number(params.color) }),
- ...(params.hoist !== undefined && { hoist: params.hoist === 'true' }),
- ...(params.mentionable !== undefined && {
- mentionable: params.mentionable === 'true',
- }),
+ ...(hoist !== undefined && { hoist }),
+ ...(mentionable !== undefined && { mentionable }),
}
+ }
case 'discord_delete_role':
return { ...commonParams, roleId: params.roleId }
case 'discord_assign_role':
@@ -164,33 +208,40 @@ function discordToolParams(params: BlockToolParams, requireBotToken: boolean) {
userId: params.userId,
...(params.reason && { reason: params.reason }),
}
- case 'discord_ban_member':
+ case 'discord_ban_member': {
+ const deleteMessageSeconds =
+ toolCallArg(context, params.deleteMessageSeconds) ??
+ (params.deleteMessageDays ? Number(params.deleteMessageDays) * 86400 : undefined)
return {
...commonParams,
userId: params.userId,
...(params.reason && { reason: params.reason }),
- ...(params.deleteMessageDays && {
- deleteMessageSeconds: Number(params.deleteMessageDays) * 86400,
- }),
+ ...(deleteMessageSeconds !== undefined && { deleteMessageSeconds }),
}
+ }
case 'discord_get_member':
return { ...commonParams, userId: params.userId }
- case 'discord_update_member':
+ case 'discord_update_member': {
+ const mute = parseOptionalBooleanInput(params.mute)
+ const deaf = parseOptionalBooleanInput(params.deaf)
return {
...commonParams,
userId: params.userId,
...(params.nick !== undefined && { nick: params.nick }),
- ...(params.mute !== undefined && { mute: params.mute === 'true' }),
- ...(params.deaf !== undefined && { deaf: params.deaf === 'true' }),
+ ...(mute !== undefined && { mute }),
+ ...(deaf !== undefined && { deaf }),
}
- case 'discord_create_invite':
+ }
+ case 'discord_create_invite': {
+ const temporary = parseOptionalBooleanInput(params.temporary)
return {
...commonParams,
channelId: params.channelId,
...(params.maxAge !== undefined && { maxAge: Number(params.maxAge) }),
...(params.maxUses !== undefined && { maxUses: Number(params.maxUses) }),
- ...(params.temporary !== undefined && { temporary: params.temporary === 'true' }),
+ ...(temporary !== undefined && { temporary }),
}
+ }
case 'discord_get_invite':
case 'discord_delete_invite':
return { ...commonParams, inviteCode: params.inviteCode }
@@ -434,7 +485,7 @@ export const DiscordBlock: BlockConfig = {
title: 'Server ID',
type: 'short-input',
placeholder: 'Enter Discord server ID',
- required: true,
+ required: { field: 'operation', value: GUILD_SCOPED_OPERATIONS },
serviceId: 'discord',
},
// Channel ID - for operations that need it
@@ -827,11 +878,17 @@ export const DiscordBlock: BlockConfig = {
id: 'hoist',
title: 'Display Separately',
type: 'dropdown',
- options: [
- { label: 'Yes - Display role members separately', id: 'true' },
- { label: "No - Don't display separately", id: 'false' },
- ],
- value: () => 'false',
+ options: ({ values } = { values: {} }) =>
+ values?.operation === 'discord_create_role'
+ ? [HOIST_NO, HOIST_YES]
+ : [NO_CHANGE_OPTION, HOIST_YES, HOIST_NO],
+ value: (p) =>
+ p?.operation === 'discord_create_role'
+ ? 'false'
+ : p?.operation === 'discord_update_role'
+ ? ''
+ : undefined,
+ dependsOn: ['operation'],
condition: {
field: 'operation',
value: ['discord_create_role', 'discord_update_role'],
@@ -842,11 +899,17 @@ export const DiscordBlock: BlockConfig = {
id: 'mentionable',
title: 'Mentionable',
type: 'dropdown',
- options: [
- { label: 'Yes - Role can be mentioned', id: 'true' },
- { label: 'No - Role cannot be mentioned', id: 'false' },
- ],
- value: () => 'true',
+ options: ({ values } = { values: {} }) =>
+ values?.operation === 'discord_create_role'
+ ? [MENTIONABLE_YES, MENTIONABLE_NO]
+ : [NO_CHANGE_OPTION, MENTIONABLE_YES, MENTIONABLE_NO],
+ value: (p) =>
+ p?.operation === 'discord_create_role'
+ ? 'true'
+ : p?.operation === 'discord_update_role'
+ ? ''
+ : undefined,
+ dependsOn: ['operation'],
condition: {
field: 'operation',
value: ['discord_create_role', 'discord_update_role'],
@@ -874,9 +937,11 @@ export const DiscordBlock: BlockConfig = {
title: 'Server Mute',
type: 'dropdown',
options: [
+ NO_CHANGE_OPTION,
{ label: 'Mute member', id: 'true' },
{ label: 'Unmute member', id: 'false' },
],
+ value: () => '',
condition: {
field: 'operation',
value: ['discord_update_member'],
@@ -888,9 +953,11 @@ export const DiscordBlock: BlockConfig = {
title: 'Server Deafen',
type: 'dropdown',
options: [
+ NO_CHANGE_OPTION,
{ label: 'Deafen member', id: 'true' },
{ label: 'Undeafen member', id: 'false' },
],
+ value: () => '',
condition: {
field: 'operation',
value: ['discord_update_member'],
@@ -1022,7 +1089,7 @@ export const DiscordBlock: BlockConfig = {
tool: (params) => {
return params.operation || 'discord_send_message'
},
- params: (params) => discordToolParams(params, true),
+ params: (params, context) => discordToolParams(params, true, context),
},
},
inputs: {
@@ -1190,7 +1257,7 @@ export const DiscordV2Block: BlockConfig = {
DiscordBlock,
{ id: 'credential', type: 'oauth-input', serviceId: 'discord', title: 'Discord Credential' },
{
- params: (params) => discordToolParams(params, false),
+ params: (params, context) => discordToolParams(params, false, context),
condition: { field: 'operation', value: 'discord_execute_webhook', not: true },
}
),
diff --git a/apps/sim/blocks/blocks/docusign.test.ts b/apps/sim/blocks/blocks/docusign.test.ts
index 75a3f62e05c..7176cd0b835 100644
--- a/apps/sim/blocks/blocks/docusign.test.ts
+++ b/apps/sim/blocks/blocks/docusign.test.ts
@@ -28,3 +28,17 @@ describe('DocuSign List Envelopes status filter', () => {
expect(merged.envelopeStatus).toBe('completed')
})
})
+
+describe('DocuSign agent tool calls', () => {
+ it('sends the tool row Status setting for Send Envelope', () => {
+ const mapper = DocuSignBlock.tools.config?.params
+ if (!mapper) throw new Error('DocuSign block has no params mapper')
+
+ const result = mapper(
+ { envelopeStatus: 'created', emailSubject: 'Sign', signerEmail: 'a@b.co', signerName: 'A' },
+ { operation: 'send_envelope' }
+ )
+
+ expect(result.status).toBe('created')
+ })
+})
diff --git a/apps/sim/blocks/blocks/docusign.ts b/apps/sim/blocks/blocks/docusign.ts
index 9efc2329b38..2f854966e70 100644
--- a/apps/sim/blocks/blocks/docusign.ts
+++ b/apps/sim/blocks/blocks/docusign.ts
@@ -2,7 +2,7 @@ import { DocuSignIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, toolCallArg } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
const DOCUMENT_FIELD = ['uploadDocument', 'documentRef'] as const
@@ -315,7 +315,8 @@ export const DocuSignBlock: BlockConfig = {
config: {
tool: (params) => `docusign_${params.operation}`,
params: (params, context) => {
- const { oauthCredential, operation, documentFile, listEnvelopeStatus, ...rest } = params
+ const { oauthCredential, documentFile, listEnvelopeStatus, ...rest } = params
+ const operation = mapperOperation(params, context)
const cleanParams: Record = {
oauthCredential,
@@ -331,14 +332,13 @@ export const DocuSignBlock: BlockConfig = {
* merges raw inputs under this result, so the list filter is always assigned explicitly:
* otherwise that stored `sent` reached List Envelopes and "All" listed only sent envelopes.
*/
- if ((operation ?? context?.operation) === 'list_envelopes') {
+ if (operation === 'list_envelopes') {
cleanParams.envelopeStatus =
listEnvelopeStatus || toolCallArg(context, rest.envelopeStatus) || undefined
}
- if (operation === 'create_from_template') {
- cleanParams.status = rest.envelopeStatus
- } else if (operation === 'send_envelope') {
+ // A model-supplied `status` is copied over this by the loop below.
+ if (operation === 'create_from_template' || operation === 'send_envelope') {
cleanParams.status = rest.envelopeStatus
}
diff --git a/apps/sim/blocks/blocks/downdetector.test.ts b/apps/sim/blocks/blocks/downdetector.test.ts
new file mode 100644
index 00000000000..eac35c6b617
--- /dev/null
+++ b/apps/sim/blocks/blocks/downdetector.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest'
+import { DowndetectorBlock } from '@/blocks/blocks/downdetector'
+
+describe('Downdetector agent tool calls', () => {
+ it('forwards the model page token for Get Site Companies', () => {
+ const mapper = DowndetectorBlock.tools.config?.params
+ if (!mapper) throw new Error('Downdetector block has no params mapper')
+
+ const result = mapper(
+ { siteId: '12', page: 'opaque-token' },
+ { operation: 'downdetector_get_site_companies' }
+ )
+
+ expect(result.page).toBe('opaque-token')
+ })
+})
diff --git a/apps/sim/blocks/blocks/downdetector.ts b/apps/sim/blocks/blocks/downdetector.ts
index 68a9f570ec1..7d0e8411eb4 100644
--- a/apps/sim/blocks/blocks/downdetector.ts
+++ b/apps/sim/blocks/blocks/downdetector.ts
@@ -1,6 +1,7 @@
import { DowndetectorIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
const COMPANY_ID_OPERATIONS = [
'downdetector_get_company',
@@ -348,7 +349,7 @@ export const DowndetectorBlock: BlockConfig = {
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
if (params.categoryId) result.categoryId = Number(params.categoryId)
if (params.pageSize) result.pageSize = Number(params.pageSize)
@@ -359,8 +360,8 @@ export const DowndetectorBlock: BlockConfig = {
// operation uses an integer page number. Always overwrite `page` (with the
// token, a number, or undefined) so a stale value from a now-hidden field
// can never leak into the wrong endpoint via the merged inputs.
- if (params.operation === 'downdetector_get_site_companies') {
- result.page = params.pageToken || undefined
+ if (mapperOperation(params, context) === 'downdetector_get_site_companies') {
+ result.page = params.pageToken || toolCallArg(context, params.page) || undefined
} else {
result.page = params.page ? Number(params.page) : undefined
}
diff --git a/apps/sim/blocks/blocks/dropbox.ts b/apps/sim/blocks/blocks/dropbox.ts
index 5ef0717c153..7ab43aae8ae 100644
--- a/apps/sim/blocks/blocks/dropbox.ts
+++ b/apps/sim/blocks/blocks/dropbox.ts
@@ -3,7 +3,7 @@ import { DropboxIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, toolCallArg } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
/*
* Canonical basic/advanced pair for the upload source, shared by the card
@@ -483,7 +483,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
},
params: (params, context) => {
const result: Record = {}
- const operation = params.operation ?? context?.operation
+ const operation = mapperOperation(params, context)
// `cursor` is List Shared Links' field; List Folder and Search page with their own
if (operation === 'dropbox_list_folder') {
result.cursor = params.listFolderCursor || toolCallArg(context, params.cursor)
diff --git a/apps/sim/blocks/blocks/dub.test.ts b/apps/sim/blocks/blocks/dub.test.ts
new file mode 100644
index 00000000000..f67b3f5fa3f
--- /dev/null
+++ b/apps/sim/blocks/blocks/dub.test.ts
@@ -0,0 +1,64 @@
+/**
+ * Workflow runs hand a tool `{ ...rawInputs, ...mappedParams }`, so the mapper must clear values
+ * another operation left in a shared subBlock. Agent tool calls pass the operation in context and
+ * supply arguments under the tool's param names, which the mapper must keep.
+ */
+import { describe, expect, it } from 'vitest'
+import { DubBlock } from '@/blocks/blocks/dub'
+import { createLinkTool } from '@/tools/dub/create_link'
+import { getAnalyticsTool } from '@/tools/dub/get_analytics'
+import type { ToolConfig } from '@/tools/types'
+
+function workflowParams(inputs: Record): Record {
+ return { ...inputs, ...(DubBlock.tools.config.params?.(inputs) ?? {}) }
+}
+
+function agentParams(operation: string, args: Record): Record {
+ return { ...args, ...(DubBlock.tools.config.params?.(args, { operation }) ?? {}) }
+}
+
+function requestUrl(tool: ToolConfig, params: Record): URL {
+ const url = tool.request.url
+ return new URL(typeof url === 'function' ? url(params) : url)
+}
+
+function requestBody(tool: ToolConfig, params: Record) {
+ const body = tool.request.body
+ if (typeof body !== 'function') throw new Error(`${tool.id} has no request body`)
+ return body(params)
+}
+
+describe('Dub block parameter mapping', () => {
+ it('keeps the destination, slug, and conversion flag an agent passes to Create Link', () => {
+ const params = agentParams('create_link', {
+ apiKey: 'dub_test',
+ url: 'https://sim.ai',
+ domain: 'go.sim.ai',
+ key: 'launch',
+ trackConversion: true,
+ })
+ expect(requestBody(createLinkTool, params)).toEqual({
+ url: 'https://sim.ai',
+ domain: 'go.sim.ai',
+ key: 'launch',
+ trackConversion: true,
+ })
+ })
+
+ it('keeps the link and domain filters an agent passes to Get Analytics', () => {
+ const url = requestUrl(
+ getAnalyticsTool,
+ agentParams('get_analytics', { apiKey: 'dub_test', linkId: 'link_1', domain: 'go.sim.ai' })
+ )
+ expect(url.searchParams.get('linkId')).toBe('link_1')
+ expect(url.searchParams.get('domain')).toBe('go.sim.ai')
+ })
+
+ it('drops a create-link domain left behind when a workflow switches to Get Analytics', () => {
+ const url = requestUrl(
+ getAnalyticsTool,
+ workflowParams({ operation: 'get_analytics', apiKey: 'dub_test', domain: 'stale.sh' })
+ )
+ expect(url.searchParams.get('domain')).toBeNull()
+ })
+})
diff --git a/apps/sim/blocks/blocks/dub.ts b/apps/sim/blocks/blocks/dub.ts
index 21fa25a17fb..4393a76784c 100644
--- a/apps/sim/blocks/blocks/dub.ts
+++ b/apps/sim/blocks/blocks/dub.ts
@@ -1,8 +1,8 @@
import { omit } from '@sim/utils/object'
import { DubIcon } 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 { isToolCall, mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
const GET_LINK_FIELD = ['linkId', 'getLinkExternalId', 'getLinkKey'] as const
const BULK_UPDATE_TARGET_FIELD = ['bulkUpdateLinkIds', 'bulkUpdateExternalIds'] as const
@@ -1032,44 +1032,46 @@ export const DubBlock = {
],
config: {
tool: (params) => `dub_${params.operation}`,
- params: (params) => {
+ params: (params, context?: BlockToolParamsContext) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
const isLinkMutation =
- params.operation === 'create_link' ||
- params.operation === 'upsert_link' ||
- params.operation === 'update_link'
+ operation === 'create_link' || operation === 'upsert_link' || operation === 'update_link'
- // The executor merges { ...inputs, ...transformedParams }, so a raw subBlock
- // id that shares its name with a tool param (e.g. 'domain', 'linkId') passes
- // through untouched unless explicitly cleared here. These fields are only
- // shown for the operations below; every other operation must null them out
- // so a value left over from a previous operation selection can't leak in.
- if (!isLinkMutation) {
- result.domain = undefined
- result.key = undefined
- result.title = undefined
- result.description = undefined
- result.externalId = undefined
- result.tagIds = undefined
- result.tenantId = undefined
- result.folderId = undefined
- result.trackConversion = undefined
- }
- if (params.operation !== 'create_link' && params.operation !== 'upsert_link') {
- result.url = undefined
- }
- if (
- params.operation !== 'get_link' &&
- params.operation !== 'update_link' &&
- params.operation !== 'delete_link'
- ) {
- result.linkId = undefined
- }
- if (params.operation !== 'list_links') {
- result.search = undefined
- result.showArchived = undefined
- result.page = undefined
- result.pageSize = undefined
+ /**
+ * The canvas merges `{ ...inputs, ...mapped }`, so a raw subBlock id that shares its name
+ * with a tool param (e.g. `domain`, `linkId`) passes through unless cleared here, and a
+ * value left by another operation would leak in. A tool call carries the model's args
+ * under those same names for the selected tool, so nothing is cleared there.
+ */
+ if (!isToolCall(context)) {
+ if (!isLinkMutation) {
+ result.domain = undefined
+ result.key = undefined
+ result.title = undefined
+ result.description = undefined
+ result.externalId = undefined
+ result.tagIds = undefined
+ result.tenantId = undefined
+ result.folderId = undefined
+ result.trackConversion = undefined
+ }
+ if (operation !== 'create_link' && operation !== 'upsert_link') {
+ result.url = undefined
+ }
+ if (
+ operation !== 'get_link' &&
+ operation !== 'update_link' &&
+ operation !== 'delete_link'
+ ) {
+ result.linkId = undefined
+ }
+ if (operation !== 'list_links') {
+ result.search = undefined
+ result.showArchived = undefined
+ result.page = undefined
+ result.pageSize = undefined
+ }
}
if (isLinkMutation) {
@@ -1077,20 +1079,26 @@ export const DubBlock = {
if (params.linkArchived === 'true') result.archived = true
if (params.tenantId) result.tenantId = params.tenantId
if (params.folderId) result.folderId = params.folderId
- // Only ever send `true` or omit — an explicit `false` on update_link would
- // silently disable conversion tracking on links that already had it enabled,
- // since Dub's update is a partial PATCH (matches linkRewrite/linkArchived).
- result.trackConversion = params.trackConversion === 'true' ? true : undefined
+ // The dropdown only ever sends `true` or omits: a stored `false` on update_link would
+ // disable tracking on links that had it, since Dub's update is a partial PATCH. A tool
+ // call keeps the model's own boolean.
+ result.trackConversion =
+ params.trackConversion === 'true'
+ ? true
+ : toolCallArg(
+ context,
+ typeof params.trackConversion === 'boolean' ? params.trackConversion : undefined
+ )
}
- if (params.operation === 'get_link') {
+ if (operation === 'get_link') {
if (params.getLinkExternalId) result.externalId = params.getLinkExternalId
if (params.getLinkDomain) result.domain = params.getLinkDomain
if (params.getLinkKey) result.key = params.getLinkKey
}
- if (params.operation === 'update_link' && params.updateUrl) {
+ if (operation === 'update_link' && params.updateUrl) {
result.url = params.updateUrl
}
- if (params.operation === 'list_links') {
+ if (operation === 'list_links') {
if (params.listDomain) result.domain = params.listDomain
if (params.listTagIds) result.tagIds = params.listTagIds
if (params.listTenantId) result.tenantId = params.listTenantId
@@ -1101,7 +1109,7 @@ export const DubBlock = {
if (params.startingAfter) result.startingAfter = params.startingAfter
if (params.endingBefore) result.endingBefore = params.endingBefore
}
- if (params.operation === 'get_analytics') {
+ if (operation === 'get_analytics') {
if (params.analyticsEvent) result.event = params.analyticsEvent
if (params.analyticsGroupBy) result.groupBy = params.analyticsGroupBy
if (params.analyticsLinkId) result.linkId = params.analyticsLinkId
@@ -1113,7 +1121,7 @@ export const DubBlock = {
if (params.analyticsCountry) result.country = params.analyticsCountry
if (params.analyticsTimezone) result.timezone = params.analyticsTimezone
}
- if (params.operation === 'get_links_count') {
+ if (operation === 'get_links_count') {
if (params.countSearch) result.search = params.countSearch
if (params.countDomain) result.domain = params.countDomain
if (params.countTagIds) result.tagIds = params.countTagIds
@@ -1122,18 +1130,18 @@ export const DubBlock = {
if (params.countShowArchived === 'true') result.showArchived = true
if (params.countGroupBy) result.groupBy = params.countGroupBy
}
- if (params.operation === 'bulk_create_links') {
+ if (operation === 'bulk_create_links') {
if (params.bulkLinks) result.links = params.bulkLinks
}
- if (params.operation === 'bulk_update_links') {
+ if (operation === 'bulk_update_links') {
if (params.bulkUpdateLinkIds) result.linkIds = params.bulkUpdateLinkIds
if (params.bulkUpdateExternalIds) result.externalIds = params.bulkUpdateExternalIds
if (params.bulkUpdateData) result.data = params.bulkUpdateData
}
- if (params.operation === 'bulk_delete_links') {
+ if (operation === 'bulk_delete_links') {
if (params.bulkDeleteLinkIds) result.linkIds = params.bulkDeleteLinkIds
}
- if (params.operation === 'get_events') {
+ if (operation === 'get_events') {
if (params.eventsEvent) result.event = params.eventsEvent
if (params.eventsLinkId) result.linkId = params.eventsLinkId
if (params.eventsExternalId) result.externalId = params.eventsExternalId
@@ -1147,7 +1155,7 @@ export const DubBlock = {
if (params.eventsPage) result.page = Number(params.eventsPage)
if (params.eventsLimit) result.limit = Number(params.eventsLimit)
}
- if (params.operation === 'get_qr_code') {
+ if (operation === 'get_qr_code') {
if (params.qrUrl) result.url = params.qrUrl
if (params.qrLogo) result.logo = params.qrLogo
if (params.qrSize) result.size = Number(params.qrSize)
@@ -1157,24 +1165,24 @@ export const DubBlock = {
if (params.qrHideLogo === 'true') result.hideLogo = true
if (params.qrMargin) result.margin = Number(params.qrMargin)
}
- if (params.operation === 'list_domains') {
+ if (operation === 'list_domains') {
if (params.domainsSearch) result.search = params.domainsSearch
if (params.domainsArchived === 'true') result.archived = true
if (params.domainsPage) result.page = Number(params.domainsPage)
if (params.domainsPageSize) result.pageSize = Number(params.domainsPageSize)
}
- if (params.operation === 'list_tags') {
+ if (operation === 'list_tags') {
if (params.tagsSearch) result.search = params.tagsSearch
if (params.tagsSortBy) result.sortBy = params.tagsSortBy
if (params.tagsSortOrder) result.sortOrder = params.tagsSortOrder
if (params.tagsPage) result.page = Number(params.tagsPage)
if (params.tagsPageSize) result.pageSize = Number(params.tagsPageSize)
}
- if (params.operation === 'create_tag') {
+ if (operation === 'create_tag') {
if (params.tagName) result.name = params.tagName
if (params.tagColor) result.color = params.tagColor
}
- if (params.operation === 'list_folders') {
+ if (operation === 'list_folders') {
if (params.foldersSearch) result.search = params.foldersSearch
if (params.foldersPage) result.page = Number(params.foldersPage)
if (params.foldersPageSize) result.pageSize = Number(params.foldersPageSize)
diff --git a/apps/sim/blocks/blocks/dynamodb.test.ts b/apps/sim/blocks/blocks/dynamodb.test.ts
new file mode 100644
index 00000000000..0c12275b26a
--- /dev/null
+++ b/apps/sim/blocks/blocks/dynamodb.test.ts
@@ -0,0 +1,50 @@
+/**
+ * An Agent tool call runs the block mapper over `{ ...storedRowParams, ...modelArgs }` with the
+ * operation only in `context`; the internal tool then receives `{ ...merged, ...mapped }`.
+ */
+import { describe, expect, it } from 'vitest'
+import { DynamoDBBlock } from '@/blocks/blocks/dynamodb'
+
+function toolParams(operation: string, args: Record) {
+ return { ...args, ...DynamoDBBlock.tools.config?.params?.(args, { operation }) }
+}
+
+const AWS_ARGS = {
+ region: 'us-east-1',
+ accessKeyId: 'AKIA',
+ secretAccessKey: 'secret',
+ tableName: 'orders',
+}
+
+describe('DynamoDB on an Agent tool call', () => {
+ it('get sends the primary key stored on the tool row', () => {
+ expect(toolParams('get', { ...AWS_ARGS, getKey: '{"id":"1"}' }).key).toEqual({ id: '1' })
+ })
+
+ it('scan keeps the index, projection, and consistent read the model supplied', () => {
+ expect(
+ toolParams('scan', {
+ ...AWS_ARGS,
+ indexName: 'by-status',
+ projectionExpression: 'id, status',
+ consistentRead: true,
+ })
+ ).toMatchObject({
+ indexName: 'by-status',
+ projectionExpression: 'id, status',
+ consistentRead: true,
+ })
+ })
+
+ it('update keeps the return values the model supplied over the seeded dropdown default', () => {
+ expect(
+ toolParams('update', {
+ ...AWS_ARGS,
+ updateKey: '{"id":"1"}',
+ updateExpression: 'SET #s = :s',
+ updateReturnValues: 'ALL_NEW',
+ returnValues: 'UPDATED_OLD',
+ }).returnValues
+ ).toBe('UPDATED_OLD')
+ })
+})
diff --git a/apps/sim/blocks/blocks/dynamodb.ts b/apps/sim/blocks/blocks/dynamodb.ts
index 1a67c12ad29..a819a1b7486 100644
--- a/apps/sim/blocks/blocks/dynamodb.ts
+++ b/apps/sim/blocks/blocks/dynamodb.ts
@@ -2,7 +2,7 @@ import { toError } from '@sim/utils/errors'
import { DynamoDBIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const DynamoDBBlock: BlockConfig = {
type: 'dynamodb',
@@ -731,7 +731,7 @@ Return ONLY the expression - no explanations.`,
throw new Error(`Invalid DynamoDB operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
const parseJson = (value: unknown, fieldName: string) => {
if (!value) return undefined
if (typeof value === 'object') return value
@@ -745,7 +745,7 @@ Return ONLY the expression - no explanations.`,
return undefined
}
- const op = params.operation as string
+ const op = mapperOperation(params, context)
const result: Record = {
region: params.region,
accessKeyId: params.accessKeyId,
@@ -772,7 +772,10 @@ Return ONLY the expression - no explanations.`,
if (params.consistentRead === 'true' || params.consistentRead === true) {
result.consistentRead = true
}
- result.projectionExpression = params.getProjectionExpression || undefined
+ result.projectionExpression =
+ params.getProjectionExpression ||
+ toolCallArg(context, params.projectionExpression) ||
+ undefined
const getNames = parseJson(params.getExpressionAttributeNames, 'expressionAttributeNames')
if (getNames !== undefined) result.expressionAttributeNames = getNames
}
@@ -817,11 +820,14 @@ Return ONLY the expression - no explanations.`,
params.scanIndexForward === 'false' || params.scanIndexForward === false
? false
: undefined
- result.projectionExpression = params.queryProjectionExpression || undefined
+ result.projectionExpression =
+ params.queryProjectionExpression ||
+ toolCallArg(context, params.projectionExpression) ||
+ undefined
result.consistentRead =
params.queryConsistentRead === 'true' || params.queryConsistentRead === true
? true
- : undefined
+ : toolCallArg(context, params.consistentRead)
}
if (op === 'scan') {
@@ -846,11 +852,12 @@ Return ONLY the expression - no explanations.`,
if (lim) result.limit = Number.parseInt(String(lim), 10)
const esk = parseJson(params.scanExclusiveStartKey, 'exclusiveStartKey')
if (esk !== undefined) result.exclusiveStartKey = esk
- result.indexName = params.scanIndexName || undefined
+ result.indexName =
+ params.scanIndexName || toolCallArg(context, params.indexName) || undefined
result.consistentRead =
params.scanConsistentRead === 'true' || params.scanConsistentRead === true
? true
- : undefined
+ : toolCallArg(context, params.consistentRead)
if (
params.scanSegment !== undefined &&
params.scanSegment !== null &&
@@ -882,7 +889,9 @@ Return ONLY the expression - no explanations.`,
if (values !== undefined) result.expressionAttributeValues = values
if (params.updateConditionExpression)
result.conditionExpression = params.updateConditionExpression
- if (params.updateReturnValues) result.returnValues = params.updateReturnValues
+ const returnValues =
+ toolCallArg(context, params.returnValues) || params.updateReturnValues
+ if (returnValues) result.returnValues = returnValues
}
if (op === 'delete') {
diff --git a/apps/sim/blocks/blocks/dynatrace.test.ts b/apps/sim/blocks/blocks/dynatrace.test.ts
new file mode 100644
index 00000000000..d641f71917b
--- /dev/null
+++ b/apps/sim/blocks/blocks/dynatrace.test.ts
@@ -0,0 +1,44 @@
+import { describe, expect, it } from 'vitest'
+import { DynatraceBlock } from '@/blocks/blocks/dynatrace'
+
+/**
+ * An agent tool call: the stored row's values and the model's args (keyed by the tool's param
+ * names) arrive merged, the operation only on `context`, and the executor forwards
+ * `{ ...params, ...mapped }`.
+ */
+const agentCall = (
+ operation: string,
+ params: Record
+): Record => ({
+ ...params,
+ ...(DynatraceBlock.tools.config?.params?.(params, { operation }) ?? {}),
+})
+
+describe('DynatraceBlock agent tool calls', () => {
+ it('forwards the tag key and value set on the tool row to delete_tag', () => {
+ const mapped = agentCall('dynatrace_delete_tag', {
+ entitySelector: 'type(HOST)',
+ tagKey: 'env',
+ tagValue: 'prod',
+ })
+ expect(mapped).toMatchObject({ key: 'env', value: 'prod' })
+ })
+
+ it('keeps model args named after the tool params when the row fields are blank', () => {
+ const mapped = agentCall('dynatrace_delete_tag', {
+ entitySelector: 'type(HOST)',
+ tagKey: '',
+ tagValue: '',
+ key: 'team',
+ value: 'payments',
+ })
+ expect(mapped).toMatchObject({ key: 'team', value: 'payments' })
+
+ const monitors = agentCall('dynatrace_list_synthetic_monitors', {
+ monitorEnabled: '',
+ enabled: false,
+ managementZone: 42,
+ })
+ expect(monitors).toMatchObject({ enabled: false, managementZone: 42 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/dynatrace.ts b/apps/sim/blocks/blocks/dynatrace.ts
index 7d22d6a2153..9cf4edf147f 100644
--- a/apps/sim/blocks/blocks/dynatrace.ts
+++ b/apps/sim/blocks/blocks/dynatrace.ts
@@ -1,7 +1,7 @@
import { DynatraceIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/** Operations that accept the shared `from` timeframe parameter. */
const FROM_OPERATIONS = [
@@ -1560,7 +1560,8 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const baseParams: Record = {
environmentUrl: params.environmentUrl,
apiToken: params.apiToken,
@@ -1581,6 +1582,22 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
return undefined
}
+ /**
+ * A dedicated block field, else on a tool call the model's arg under the
+ * tool's own param name. Blank strings fall through to `undefined`.
+ */
+ const pick = (dedicated: unknown, toolParam: string) =>
+ dedicated || toolCallArg(context, params[toolParam]) || undefined
+
+ /**
+ * A required tool param fed by a differently named block field: the field's
+ * value, else on a tool call the model's arg when the field is blank.
+ */
+ const orModelArg = (dedicated: unknown, toolParam: string) =>
+ dedicated === undefined || dedicated === null || dedicated === ''
+ ? (toolCallArg(context, params[toolParam]) ?? dedicated)
+ : dedicated
+
const pagination = {
pageSize: toNumber(params.pageSize),
nextPageKey: params.nextPageKey || undefined,
@@ -1588,21 +1605,21 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
// Create and update SLO take the identical definition.
const sloWriteParams = {
- name: params.sloName,
- target: toNumber(params.sloTarget),
- warning: toNumber(params.sloWarning),
- timeframe: params.sloTimeframe,
- evaluationType: params.sloEvaluationType || 'AGGREGATE',
- description: params.sloDescription || undefined,
- enabled: params.sloEnabled,
- filter: params.sloFilter || undefined,
- metricExpression: params.sloMetricExpression || undefined,
- metricName: params.sloMetricName || undefined,
+ name: orModelArg(params.sloName, 'name'),
+ target: toNumber(orModelArg(params.sloTarget, 'target')),
+ warning: toNumber(orModelArg(params.sloWarning, 'warning')),
+ timeframe: orModelArg(params.sloTimeframe, 'timeframe'),
+ evaluationType: pick(params.sloEvaluationType, 'evaluationType') || 'AGGREGATE',
+ description: pick(params.sloDescription, 'description'),
+ enabled: orModelArg(params.sloEnabled, 'enabled'),
+ filter: pick(params.sloFilter, 'filter'),
+ metricExpression: pick(params.sloMetricExpression, 'metricExpression'),
+ metricName: pick(params.sloMetricName, 'metricName'),
burnRateVisualizationEnabled: params.burnRateVisualizationEnabled,
fastBurnThreshold: toNumber(params.fastBurnThreshold),
}
- switch (params.operation) {
+ switch (operation) {
case 'dynatrace_list_problems':
return {
...baseParams,
@@ -1611,15 +1628,15 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
to: params.to || undefined,
problemSelector: params.problemSelector || undefined,
entitySelector: params.entitySelector || undefined,
- sort: params.problemSort || undefined,
- fields: params.problemFields || undefined,
+ sort: pick(params.problemSort, 'sort'),
+ fields: pick(params.problemFields, 'fields'),
}
case 'dynatrace_get_problem':
return {
...baseParams,
problemId: params.problemId,
- fields: params.problemFields || undefined,
+ fields: pick(params.problemFields, 'fields'),
}
case 'dynatrace_close_problem':
@@ -1633,7 +1650,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
...baseParams,
problemId: params.problemId,
message: params.message,
- context: params.commentContext || undefined,
+ context: pick(params.commentContext, 'context'),
}
case 'dynatrace_query_metrics':
@@ -1653,7 +1670,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
...pagination,
metricSelector: params.metricSelector || undefined,
text: params.text || undefined,
- fields: params.metricFields || undefined,
+ fields: pick(params.metricFields, 'fields'),
writtenSince: params.writtenSince || undefined,
writtenSinceMode: params.writtenSinceMode || undefined,
metadataSelector: params.metadataSelector || undefined,
@@ -1663,7 +1680,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
return { ...baseParams, metricKey: params.metricKey }
case 'dynatrace_ingest_metrics':
- return { ...baseParams, payload: params.metricPayload }
+ return { ...baseParams, payload: orModelArg(params.metricPayload, 'payload') }
case 'dynatrace_list_entities':
return {
@@ -1672,8 +1689,8 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
entitySelector: params.entitySelector,
from: params.from || undefined,
to: params.to || undefined,
- fields: params.entityFields || undefined,
- sort: params.entitySort || undefined,
+ fields: pick(params.entityFields, 'fields'),
+ sort: pick(params.entitySort, 'sort'),
}
case 'dynatrace_get_entity':
@@ -1682,7 +1699,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
entityId: params.entityId,
from: params.from || undefined,
to: params.to || undefined,
- fields: params.entityFields || undefined,
+ fields: pick(params.entityFields, 'fields'),
}
case 'dynatrace_list_entity_types':
@@ -1710,16 +1727,16 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
startTime: toNumber(params.startTime),
endTime: toNumber(params.endTime),
eventTimeout: toNumber(params.eventTimeout),
- properties: params.eventProperties || undefined,
+ properties: pick(params.eventProperties, 'properties'),
}
case 'dynatrace_search_logs':
return {
...baseParams,
- query: params.logQuery || undefined,
+ query: pick(params.logQuery, 'query'),
from: params.from || undefined,
to: params.to || undefined,
- sort: params.logSort || undefined,
+ sort: pick(params.logSort, 'sort'),
limit: toNumber(params.limit),
nextSliceKey: params.nextSliceKey || undefined,
}
@@ -1735,7 +1752,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
from: params.from || undefined,
to: params.to || undefined,
timeFrame: params.timeFrame || undefined,
- sort: params.sloSort || undefined,
+ sort: pick(params.sloSort, 'sort'),
enabledSlos: params.enabledSlos || undefined,
evaluate: params.evaluate,
showGlobalSlos: params.showGlobalSlos,
@@ -1757,15 +1774,15 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
securityProblemSelector: params.securityProblemSelector || undefined,
from: params.from || undefined,
to: params.to || undefined,
- fields: params.securityFields || undefined,
- sort: params.securitySort || undefined,
+ fields: pick(params.securityFields, 'fields'),
+ sort: pick(params.securitySort, 'sort'),
}
case 'dynatrace_get_security_problem':
return {
...baseParams,
securityProblemId: params.securityProblemId,
- fields: params.securityFields || undefined,
+ fields: pick(params.securityFields, 'fields'),
managementZoneFilter: params.managementZoneFilter || undefined,
from: params.from || undefined,
}
@@ -1774,18 +1791,18 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
return {
...baseParams,
...pagination,
- filter: params.auditFilter || undefined,
+ filter: pick(params.auditFilter, 'filter'),
from: params.from || undefined,
to: params.to || undefined,
- sort: params.auditSort || undefined,
+ sort: pick(params.auditSort, 'sort'),
}
case 'dynatrace_mute_security_problem':
return {
...baseParams,
securityProblemId: params.securityProblemId,
- reason: params.muteReason,
- comment: params.muteComment || undefined,
+ reason: orModelArg(params.muteReason, 'reason'),
+ comment: pick(params.muteComment, 'comment'),
}
case 'dynatrace_unmute_security_problem':
@@ -1793,15 +1810,15 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
...baseParams,
securityProblemId: params.securityProblemId,
reason: UNMUTE_REASON,
- comment: params.muteComment || undefined,
+ comment: pick(params.muteComment, 'comment'),
}
case 'dynatrace_mute_security_problems':
return {
...baseParams,
securityProblemIds: params.securityProblemIds,
- reason: params.muteReason,
- comment: params.muteComment || undefined,
+ reason: orModelArg(params.muteReason, 'reason'),
+ comment: pick(params.muteComment, 'comment'),
}
case 'dynatrace_unmute_security_problems':
@@ -1809,7 +1826,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
...baseParams,
securityProblemIds: params.securityProblemIds,
reason: UNMUTE_REASON,
- comment: params.muteComment || undefined,
+ comment: pick(params.muteComment, 'comment'),
}
case 'dynatrace_list_remediation_items':
@@ -1826,15 +1843,15 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
attackSelector: params.attackSelector || undefined,
from: params.from || undefined,
to: params.to || undefined,
- fields: params.attackFields || undefined,
- sort: params.attackSort || undefined,
+ fields: pick(params.attackFields, 'fields'),
+ sort: pick(params.attackSort, 'sort'),
}
case 'dynatrace_get_attack':
return {
...baseParams,
attackId: params.attackId,
- fields: params.attackFields || undefined,
+ fields: pick(params.attackFields, 'fields'),
}
case 'dynatrace_list_tags':
@@ -1858,15 +1875,15 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
return {
...baseParams,
entitySelector: params.entitySelector,
- key: params.tagKey,
- value: params.tagValue || undefined,
+ key: orModelArg(params.tagKey, 'key'),
+ value: pick(params.tagValue, 'value'),
deleteAllWithKey: params.deleteAllWithKey,
from: params.from || undefined,
to: params.to || undefined,
}
case 'dynatrace_list_settings_schemas':
- return { ...baseParams, fields: params.schemaFields || undefined }
+ return { ...baseParams, fields: pick(params.schemaFields, 'fields') }
case 'dynatrace_list_settings_objects':
return {
@@ -1875,9 +1892,9 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
schemaIds: params.schemaIds || undefined,
scopes: params.scopes || undefined,
externalIds: params.externalIds || undefined,
- fields: params.settingsFields || undefined,
- filter: params.settingsFilter || undefined,
- sort: params.settingsSort || undefined,
+ fields: pick(params.settingsFields, 'fields'),
+ filter: pick(params.settingsFilter, 'filter'),
+ sort: pick(params.settingsSort, 'sort'),
}
case 'dynatrace_get_settings_object':
@@ -1888,9 +1905,9 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
...baseParams,
schemaId: params.schemaId,
scope: params.scope,
- value: params.settingsValue,
+ value: orModelArg(params.settingsValue, 'value'),
schemaVersion: params.schemaVersion || undefined,
- externalId: params.settingsExternalId || undefined,
+ externalId: pick(params.settingsExternalId, 'externalId'),
validateOnly: params.validateOnly,
}
@@ -1898,7 +1915,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
return {
...baseParams,
objectId: params.objectId,
- value: params.settingsValue,
+ value: orModelArg(params.settingsValue, 'value'),
schemaVersion: params.schemaVersion || undefined,
updateToken: params.updateToken || undefined,
validateOnly: params.validateOnly,
@@ -1914,13 +1931,17 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
case 'dynatrace_list_synthetic_monitors':
return {
...baseParams,
- type: params.monitorType || undefined,
+ type: pick(params.monitorType, 'type'),
// "Any" must send no filter — enabled=false would return only the
// disabled monitors, the opposite of what was asked for.
- enabled: toOptionalBoolean(params.monitorEnabled),
- location: params.monitorLocation || undefined,
- tag: params.monitorTag || undefined,
- managementZone: toNumber(params.monitorManagementZone),
+ enabled:
+ toOptionalBoolean(params.monitorEnabled) ??
+ toOptionalBoolean(toolCallArg(context, params.enabled)),
+ location: pick(params.monitorLocation, 'location'),
+ tag: pick(params.monitorTag, 'tag'),
+ managementZone:
+ toNumber(params.monitorManagementZone) ??
+ toNumber(toolCallArg(context, params.managementZone)),
}
case 'dynatrace_execute_synthetic_monitors':
@@ -1931,7 +1952,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
failOnPerformanceIssue: params.failOnPerformanceIssue,
stopOnProblem: params.stopOnProblem,
takeScreenshotsOnSuccess: params.takeScreenshotsOnSuccess,
- metadata: params.batchMetadata || undefined,
+ metadata: pick(params.batchMetadata, 'metadata'),
}
case 'dynatrace_get_synthetic_batch':
@@ -1951,7 +1972,7 @@ Return ONLY the selector string - no explanations, no surrounding quotes.`,
problemId: params.problemId,
commentId: params.commentId,
message: params.message,
- context: params.commentContext || undefined,
+ context: pick(params.commentContext, 'context'),
}
case 'dynatrace_create_slo':
diff --git a/apps/sim/blocks/blocks/elevenlabs.test.ts b/apps/sim/blocks/blocks/elevenlabs.test.ts
new file mode 100644
index 00000000000..c228cb5f503
--- /dev/null
+++ b/apps/sim/blocks/blocks/elevenlabs.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest'
+import { ElevenLabsBlock } from '@/blocks/blocks/elevenlabs'
+
+describe('ElevenLabs agent tool calls', () => {
+ it('keeps the model voice settings for Edit Voice Settings', () => {
+ const mapper = ElevenLabsBlock.tools.config?.params
+ if (!mapper) throw new Error('ElevenLabs block has no params mapper')
+
+ const result = mapper(
+ { apiKey: 'key', voiceId: 'voice-1', stability: 0.4, style: 0.2, speed: 1.1 },
+ { operation: 'edit_voice_settings' }
+ )
+
+ expect(result).toMatchObject({ stability: 0.4, style: 0.2, speed: 1.1 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/elevenlabs.ts b/apps/sim/blocks/blocks/elevenlabs.ts
index 070fc7bc67f..577f3aff755 100644
--- a/apps/sim/blocks/blocks/elevenlabs.ts
+++ b/apps/sim/blocks/blocks/elevenlabs.ts
@@ -1,6 +1,11 @@
import { ElevenLabsIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
const VOICE_OPERATIONS = [
'tts',
@@ -331,8 +336,9 @@ export const ElevenLabsBlock: BlockConfig = {
],
config: {
tool: (params) => `elevenlabs_${params.operation || 'tts'}`,
- params: (params) => {
+ params: (params, context) => {
const audioFile = normalizeFileInput(params.audioFile, { single: true })
+ const isEditVoiceSettings = mapperOperation(params, context) === 'edit_voice_settings'
return {
apiKey: params.apiKey,
text: params.text,
@@ -343,17 +349,18 @@ export const ElevenLabsBlock: BlockConfig = {
category: params.category || undefined,
nextPageToken: params.nextPageToken || undefined,
pageSize: toNumber(params.pageSize),
- stability: toNumber(
- params.operation === 'edit_voice_settings' ? params.editStability : params.stability
- ),
- similarityBoost: toNumber(
- params.operation === 'edit_voice_settings'
- ? params.editSimilarityBoost
- : params.similarityBoost
- ),
- style: toNumber(params.editStyle),
- speed: toNumber(params.editSpeed),
- useSpeakerBoost: toBoolean(params.editUseSpeakerBoost),
+ stability: isEditVoiceSettings
+ ? (toNumber(params.editStability) ?? toNumber(toolCallArg(context, params.stability)))
+ : toNumber(params.stability),
+ similarityBoost: isEditVoiceSettings
+ ? (toNumber(params.editSimilarityBoost) ??
+ toNumber(toolCallArg(context, params.similarityBoost)))
+ : toNumber(params.similarityBoost),
+ style: toNumber(params.editStyle) ?? toNumber(toolCallArg(context, params.style)),
+ speed: toNumber(params.editSpeed) ?? toNumber(toolCallArg(context, params.speed)),
+ useSpeakerBoost:
+ toBoolean(params.editUseSpeakerBoost) ??
+ toBoolean(toolCallArg(context, params.useSpeakerBoost)),
durationSeconds: toNumber(params.durationSeconds),
promptInfluence: toNumber(params.promptInfluence),
loop: toBoolean(params.loop),
diff --git a/apps/sim/blocks/blocks/emailbison.test.ts b/apps/sim/blocks/blocks/emailbison.test.ts
new file mode 100644
index 00000000000..b55dd5d991a
--- /dev/null
+++ b/apps/sim/blocks/blocks/emailbison.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from 'vitest'
+import { EmailBisonBlock } from '@/blocks/blocks/emailbison'
+
+describe('Email Bison agent tool calls', () => {
+ it('keeps the model reply filters for List Replies', () => {
+ const mapper = EmailBisonBlock.tools.config?.params
+ if (!mapper) throw new Error('Email Bison block has no params mapper')
+
+ const result = mapper(
+ { apiKey: 'key', status: 'interested', leadId: 7, tagIds: [3, 4] },
+ { operation: 'list_replies' }
+ )
+
+ expect(result).toMatchObject({ status: 'interested', leadId: 7, tagIds: [3, 4] })
+ })
+
+ it('keeps the model tag name for Create Tag', () => {
+ const mapper = EmailBisonBlock.tools.config?.params
+ if (!mapper) throw new Error('Email Bison block has no params mapper')
+
+ const result = mapper({ apiKey: 'key', name: 'VIP' }, { operation: 'create_tag' })
+
+ expect(result.name).toBe('VIP')
+ })
+})
diff --git a/apps/sim/blocks/blocks/emailbison.ts b/apps/sim/blocks/blocks/emailbison.ts
index 906fe981a87..2deaaf76726 100644
--- a/apps/sim/blocks/blocks/emailbison.ts
+++ b/apps/sim/blocks/blocks/emailbison.ts
@@ -1,7 +1,7 @@
import { EmailBisonIcon } 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'
const LEAD_MUTATION_OPERATIONS = ['create_lead', 'update_lead'] as const
@@ -524,42 +524,58 @@ export const EmailBisonBlock: BlockConfig = {
],
config: {
tool: (params) => `emailbison_${params.operation}`,
- params: (params) => ({
- apiBaseUrl: params.apiBaseUrl,
- leadId:
- params.operation === 'list_replies' ? toNumberParam(params.replyLeadId) : params.leadId,
- leadIds: parseNumberList(params.leadIds),
- tagIds: parseNumberList(
- params.operation === 'attach_tags_to_leads' ? params.tagIds : params.filterTagIds
- ),
- excludedTagIds: parseNumberList(params.excludedTagIds),
- customVariables: parseJsonArray(params.customVariables),
- campaignId: toNumberParam(params.campaignId),
- campaignType: emptyToUndefined(params.campaignType),
- name:
- params.operation === 'create_tag' || params.operation === 'create_campaign'
- ? params.operation === 'create_tag'
- ? params.tagName
- : params.campaignName
- : emptyToUndefined(params.campaignName),
- action: params.action,
- maxEmailsPerDay: toNumberParam(params.maxEmailsPerDay),
- maxNewLeadsPerDay: toNumberParam(params.maxNewLeadsPerDay),
- sequencePrioritization: emptyToUndefined(params.sequencePrioritization),
- plainText: toBooleanParam(params.plainText),
- openTracking: toBooleanParam(params.openTracking),
- reputationBuilding: toBooleanParam(params.reputationBuilding),
- canUnsubscribe: toBooleanParam(params.canUnsubscribe),
- includeAutoRepliesInStats: toBooleanParam(params.includeAutoRepliesInStats),
- allowParallelSending: toBooleanParam(params.allowParallelSending),
- skipWebhooks: toBooleanParam(params.skipWebhooks),
- withoutTags: toBooleanParam(params.withoutTags),
- read: toBooleanParam(params.read),
- senderEmailId: toNumberParam(params.senderEmailId),
- campaignStatus: emptyToUndefined(params.campaignStatus),
- status:
- params.operation === 'list_replies' ? emptyToUndefined(params.replyStatus) : undefined,
- }),
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const toolCall = isToolCall(context)
+ /** A block-only field; on a tool call a blank one yields to the model's arg under the tool's param name. */
+ const blockFieldOr = (blockValue: unknown, modelArg: unknown) =>
+ toolCall ? (emptyToUndefined(blockValue) ?? modelArg) : blockValue
+ return {
+ apiBaseUrl: params.apiBaseUrl,
+ leadId:
+ operation === 'list_replies'
+ ? (toNumberParam(params.replyLeadId) ??
+ toNumberParam(toolCallArg(context, params.leadId)))
+ : params.leadId,
+ leadIds: parseNumberList(params.leadIds),
+ tagIds:
+ operation === 'attach_tags_to_leads'
+ ? parseNumberList(params.tagIds)
+ : (parseNumberList(params.filterTagIds) ??
+ parseNumberList(toolCallArg(context, params.tagIds))),
+ excludedTagIds: parseNumberList(params.excludedTagIds),
+ customVariables: parseJsonArray(params.customVariables),
+ campaignId: toNumberParam(params.campaignId),
+ campaignType: emptyToUndefined(params.campaignType),
+ name:
+ operation === 'create_tag'
+ ? blockFieldOr(params.tagName, params.name)
+ : operation === 'create_campaign'
+ ? blockFieldOr(params.campaignName, params.name)
+ : (emptyToUndefined(params.campaignName) ??
+ emptyToUndefined(toolCallArg(context, params.name))),
+ action: params.action,
+ maxEmailsPerDay: toNumberParam(params.maxEmailsPerDay),
+ maxNewLeadsPerDay: toNumberParam(params.maxNewLeadsPerDay),
+ sequencePrioritization: emptyToUndefined(params.sequencePrioritization),
+ plainText: toBooleanParam(params.plainText),
+ openTracking: toBooleanParam(params.openTracking),
+ reputationBuilding: toBooleanParam(params.reputationBuilding),
+ canUnsubscribe: toBooleanParam(params.canUnsubscribe),
+ includeAutoRepliesInStats: toBooleanParam(params.includeAutoRepliesInStats),
+ allowParallelSending: toBooleanParam(params.allowParallelSending),
+ skipWebhooks: toBooleanParam(params.skipWebhooks),
+ withoutTags: toBooleanParam(params.withoutTags),
+ read: toBooleanParam(params.read),
+ senderEmailId: toNumberParam(params.senderEmailId),
+ campaignStatus: emptyToUndefined(params.campaignStatus),
+ status:
+ operation === 'list_replies'
+ ? (emptyToUndefined(params.replyStatus) ??
+ emptyToUndefined(toolCallArg(context, params.status)))
+ : undefined,
+ }
+ },
},
},
inputs: {
diff --git a/apps/sim/blocks/blocks/enrich.test.ts b/apps/sim/blocks/blocks/enrich.test.ts
new file mode 100644
index 00000000000..7a50b724e4f
--- /dev/null
+++ b/apps/sim/blocks/blocks/enrich.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest'
+import { EnrichBlock } from '@/blocks/blocks/enrich'
+
+describe('Enrich agent tool calls', () => {
+ it('forwards the model company ID list and location for Search Jobs', () => {
+ const mapper = EnrichBlock.tools.config?.params
+ if (!mapper) throw new Error('Enrich block has no params mapper')
+
+ const result = mapper(
+ { apiKey: 'key', keywords: 'engineer', companyIds: '2048, 3050', location: 'London' },
+ { operation: 'search_jobs' }
+ )
+
+ expect(result).toMatchObject({ companyIds: '2048, 3050', location: 'London' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/enrich.ts b/apps/sim/blocks/blocks/enrich.ts
index bc241787cb9..afa0a9a9c80 100644
--- a/apps/sim/blocks/blocks/enrich.ts
+++ b/apps/sim/blocks/blocks/enrich.ts
@@ -1,7 +1,7 @@
import { EnrichSoIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { isToolCall, mapperOperation, withSavedCredential } from '@/blocks/utils'
/**
* City and country are independent filters rather than a canonical pair, so the
@@ -755,41 +755,51 @@ export const EnrichBlock: BlockConfig = {
],
config: {
tool: (params) => `enrich_${params.operation}`,
- params: (params) => {
- const { operation, ...rest } = params
- const parsedParams: Record = { ...rest }
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const toolCall = isToolCall(context)
+ /** A block-only field; on a tool call a blank one yields to the model's arg under the tool's param name. */
+ const blockFieldOr = (blockValue: unknown, modelArg: unknown) =>
+ toolCall && (blockValue === undefined || blockValue === null || blockValue === '')
+ ? modelArg
+ : blockValue
+ const parsedParams: Record = { ...params }
try {
- if (rest.currentJobTitles && typeof rest.currentJobTitles === 'string') {
- parsedParams.currentJobTitles = JSON.parse(rest.currentJobTitles)
+ if (params.currentJobTitles && typeof params.currentJobTitles === 'string') {
+ parsedParams.currentJobTitles = JSON.parse(params.currentJobTitles)
}
- if (rest.skills && typeof rest.skills === 'string') {
- parsedParams.skills = JSON.parse(rest.skills)
+ if (params.skills && typeof params.skills === 'string') {
+ parsedParams.skills = JSON.parse(params.skills)
}
- if (rest.industries && typeof rest.industries === 'string') {
- parsedParams.industries = JSON.parse(rest.industries)
+ if (params.industries && typeof params.industries === 'string') {
+ parsedParams.industries = JSON.parse(params.industries)
}
- if (rest.companyIds && typeof rest.companyIds === 'string') {
- parsedParams.companyIds = JSON.parse(rest.companyIds)
+ if (
+ operation !== 'search_jobs' &&
+ params.companyIds &&
+ typeof params.companyIds === 'string'
+ ) {
+ parsedParams.companyIds = JSON.parse(params.companyIds)
}
- if (rest.jobTitles && typeof rest.jobTitles === 'string') {
- parsedParams.jobTitles = JSON.parse(rest.jobTitles)
+ if (params.jobTitles && typeof params.jobTitles === 'string') {
+ parsedParams.jobTitles = JSON.parse(params.jobTitles)
}
- if (rest.accountLocation && typeof rest.accountLocation === 'string') {
- parsedParams.accountLocation = JSON.parse(rest.accountLocation)
+ if (params.accountLocation && typeof params.accountLocation === 'string') {
+ parsedParams.accountLocation = JSON.parse(params.accountLocation)
}
- if (rest.employeeSizeRange && typeof rest.employeeSizeRange === 'string') {
- parsedParams.employeeSizeRange = JSON.parse(rest.employeeSizeRange)
+ if (params.employeeSizeRange && typeof params.employeeSizeRange === 'string') {
+ parsedParams.employeeSizeRange = JSON.parse(params.employeeSizeRange)
}
- if (rest.filters && typeof rest.filters === 'string') {
- parsedParams.filters = JSON.parse(rest.filters)
+ if (params.filters && typeof params.filters === 'string') {
+ parsedParams.filters = JSON.parse(params.filters)
}
} catch (error: any) {
throw new Error(`Invalid JSON input: ${error.message}`)
}
if (operation === 'linkedin_profile') {
- parsedParams.url = rest.linkedinUrl
+ parsedParams.url = blockFieldOr(params.linkedinUrl, params.url)
parsedParams.linkedinUrl = undefined
}
if (
@@ -797,32 +807,32 @@ export const EnrichBlock: BlockConfig = {
operation === 'linkedin_to_personal_email' ||
operation === 'phone_finder'
) {
- parsedParams.linkedinProfile = rest.linkedinUrl
+ parsedParams.linkedinProfile = blockFieldOr(params.linkedinUrl, params.linkedinProfile)
parsedParams.linkedinUrl = undefined
}
if (operation === 'company_lookup') {
- parsedParams.name = rest.companyName
+ parsedParams.name = blockFieldOr(params.companyName, params.name)
parsedParams.companyName = undefined
}
if (operation === 'search_company') {
- parsedParams.name = rest.searchCompanyName
+ parsedParams.name = blockFieldOr(params.searchCompanyName, params.name)
parsedParams.searchCompanyName = undefined
}
if (operation === 'search_similar_companies') {
- parsedParams.url = rest.linkedinCompanyUrl
+ parsedParams.url = blockFieldOr(params.linkedinCompanyUrl, params.url)
parsedParams.linkedinCompanyUrl = undefined
}
if (operation === 'get_post_details') {
- parsedParams.url = rest.postUrl
+ parsedParams.url = blockFieldOr(params.postUrl, params.url)
parsedParams.postUrl = undefined
}
if (operation === 'search_logo') {
- parsedParams.url = rest.domain
+ parsedParams.url = blockFieldOr(params.domain, params.url)
}
if (operation === 'search_jobs') {
- parsedParams.location = rest.jobLocation
+ parsedParams.location = blockFieldOr(params.jobLocation, params.location)
parsedParams.jobLocation = undefined
- parsedParams.companyIds = rest.jobCompanyIds
+ parsedParams.companyIds = blockFieldOr(params.jobCompanyIds, params.companyIds)
parsedParams.jobCompanyIds = undefined
}
diff --git a/apps/sim/blocks/blocks/enrichment.test.ts b/apps/sim/blocks/blocks/enrichment.test.ts
new file mode 100644
index 00000000000..c2e0c52ebe5
--- /dev/null
+++ b/apps/sim/blocks/blocks/enrichment.test.ts
@@ -0,0 +1,32 @@
+import { describe, expect, it } from 'vitest'
+import { EnrichmentBlock } from '@/blocks/blocks/enrichment'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = EnrichmentBlock.tools.config?.params
+ if (!mapper) throw new Error('Enrichment block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Enrichment tool calls', () => {
+ it('runs the row enrichment with the model inputs when the operation arrives only in the context', () => {
+ expect(mapParams({ inputs: { domain: 'acme.com' } }, { operation: 'company-info' })).toEqual({
+ enrichmentId: 'company-info',
+ inputs: { domain: 'acme.com' },
+ })
+ })
+
+ it('lets a value filled on the tool row override the model input', () => {
+ const mapped = mapParams(
+ { 'company-info__domain': 'stored.com', inputs: '{"domain":"model.com"}' },
+ { operation: 'company-info' }
+ )
+ expect(mapped.inputs).toEqual({ domain: 'stored.com' })
+ })
+
+ it('keeps the model enrichment id when the tool row carries no operation', () => {
+ expect(mapParams({ enrichmentId: 'company-info' }, { operation: undefined }).enrichmentId).toBe(
+ 'company-info'
+ )
+ })
+})
diff --git a/apps/sim/blocks/blocks/enrichment.ts b/apps/sim/blocks/blocks/enrichment.ts
index 14e6f4f207d..b24c68a75f5 100644
--- a/apps/sim/blocks/blocks/enrichment.ts
+++ b/apps/sim/blocks/blocks/enrichment.ts
@@ -1,6 +1,8 @@
+import { isPlainRecord } from '@sim/utils/object'
import { EnrichmentIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta, OutputFieldDefinition, ParamType } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { ALL_ENRICHMENTS, getEnrichment } from '@/enrichments'
import { mapFieldType } from '@/enrichments/providers'
import type { EnrichmentOutputField } from '@/enrichments/types'
@@ -8,6 +10,22 @@ import type { EnrichmentOutputField } from '@/enrichments/types'
/** Stable subBlock id for an enrichment input (unique across enrichments). */
const inputFieldId = (enrichmentId: string, inputId: string) => `${enrichmentId}__${inputId}`
+/**
+ * The `inputs` map a model passed on a tool call, as an object or its JSON text. Fields filled on
+ * the tool row override its entries.
+ */
+function parseModelInputs(value: unknown): Record {
+ if (typeof value === 'string') {
+ try {
+ const parsed: unknown = JSON.parse(value)
+ return isPlainRecord(parsed) ? parsed : {}
+ } catch {
+ return {}
+ }
+ }
+ return isPlainRecord(value) ? value : {}
+}
+
// One input field per (enrichment, input), shown only for its enrichment.
const inputSubBlocks = ALL_ENRICHMENTS.flatMap((enrichment) =>
enrichment.inputs.map((input) => ({
@@ -141,16 +159,19 @@ export const EnrichmentBlock: BlockConfig = {
access: ['enrichment_run'],
config: {
tool: () => 'enrichment_run',
- params: (params) => {
- const enrichment = getEnrichment(params.operation)
- const inputs: Record = {}
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const enrichment = getEnrichment(operation)
+ const inputs: Record = {
+ ...parseModelInputs(toolCallArg(context, params.inputs)),
+ }
if (enrichment) {
for (const input of enrichment.inputs) {
const value = params[inputFieldId(enrichment.id, input.id)]
if (value !== undefined && value !== '') inputs[input.id] = value
}
}
- return { enrichmentId: params.operation, inputs }
+ return { enrichmentId: operation || params.enrichmentId, inputs }
},
},
},
diff --git a/apps/sim/blocks/blocks/exa.test.ts b/apps/sim/blocks/blocks/exa.test.ts
new file mode 100644
index 00000000000..a828ea1ba38
--- /dev/null
+++ b/apps/sim/blocks/blocks/exa.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from 'vitest'
+import { ExaBlock } from '@/blocks/blocks/exa'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = ExaBlock.tools.config?.params
+ if (!mapper) throw new Error('Exa block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Exa legacy Research tool rows', () => {
+ it('maps the stored research model to an Agent effort when the operation arrives only in the context', () => {
+ expect(
+ mapParams({ query: 'q', model: 'exa-research-pro' }, { operation: 'exa_research' }).effort
+ ).toBe('high')
+ })
+})
diff --git a/apps/sim/blocks/blocks/exa.ts b/apps/sim/blocks/blocks/exa.ts
index 91909da489d..f650d0b5c1a 100644
--- a/apps/sim/blocks/blocks/exa.ts
+++ b/apps/sim/blocks/blocks/exa.ts
@@ -1,6 +1,7 @@
import { ExaAIIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
/** Categories Exa currently supports. Shared by Search and Find Similar Links. */
const CATEGORY_OPTIONS = [
@@ -588,7 +589,7 @@ export const ExaBlock: BlockConfig = {
return 'exa_search'
}
},
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
if (params.numResults) {
result.numResults = Number(params.numResults)
@@ -614,7 +615,7 @@ export const ExaBlock: BlockConfig = {
* unset value maps to the same depth rather than falling through to
* the Agent default of `auto`.
*/
- if (params.operation === LEGACY_RESEARCH_OPERATION) {
+ if (mapperOperation(params, context) === LEGACY_RESEARCH_OPERATION) {
result.effort = RESEARCH_MODEL_TO_EFFORT[params.model as string] ?? 'medium'
}
return result
diff --git a/apps/sim/blocks/blocks/file.test.ts b/apps/sim/blocks/blocks/file.test.ts
index 4355c17297e..1dfa1a1cc32 100644
--- a/apps/sim/blocks/blocks/file.test.ts
+++ b/apps/sim/blocks/blocks/file.test.ts
@@ -186,4 +186,89 @@ describe('FileV5Block', () => {
})
).toThrow('Manage Sharing accepts a single file at a time')
})
+
+ describe('on a tool call, where the operation arrives only in context', () => {
+ it('sends the file picked on a Get Content row', () => {
+ expect(
+ FileV5Block.tools.config?.params?.(
+ { getContentInput: 'file-1', offset: 5 },
+ { operation: 'file_get_content' }
+ )
+ ).toEqual({ fileId: ['file-1'], workspaceId: undefined })
+ })
+
+ it('keeps the model folder the canonical pass republished as folderRef on write', () => {
+ expect(
+ FileV5Block.tools.config?.params?.(
+ { fileName: 'notes.md', content: 'hi', folderRef: '/Reports' },
+ { operation: 'file_write' }
+ )
+ ).toMatchObject({ fileName: 'notes.md', folderPath: '/Reports', content: 'hi' })
+ })
+
+ it('moves the model-named folder under the destination parent the row pins', () => {
+ expect(
+ FileV5Block.tools.config?.params?.(
+ { destinationParentRef: '/Archive', path: '/Reports/Q1', destinationPath: '/Other/Q1' },
+ { operation: 'file_update_folder' }
+ )
+ ).toMatchObject({ path: '/Reports/Q1', destinationPath: '/Archive/Q1' })
+ })
+
+ it('creates the model-named folder under the parent the row pins', () => {
+ expect(
+ FileV5Block.tools.config?.params?.(
+ { createParentRef: '/Reports', path: '/Other/New' },
+ { operation: 'file_create_folder' }
+ )
+ ).toMatchObject({ path: '/Reports/New' })
+ })
+
+ it('keeps the model path for Create Folder when the row pins no parent', () => {
+ expect(
+ FileV5Block.tools.config?.params?.(
+ { path: '/Other/New' },
+ { operation: 'file_create_folder' }
+ )
+ ).toMatchObject({ path: '/Other/New' })
+ })
+
+ /** The tool-call executor spreads the mapper result over the merged row and model params. */
+ const toolCallRequest = (params: Record, operation: string) => ({
+ ...params,
+ ...FileV5Block.tools.config?.params?.(params, { operation }),
+ })
+
+ it('sends only the row folder on Append when the model also names folderPaths', () => {
+ const request = toolCallRequest(
+ {
+ folderScopeRef: '/Reports',
+ fileName: 'notes.md',
+ content: 'x',
+ folderPaths: ['/Reports'],
+ },
+ 'file_append'
+ )
+ expect(request).toMatchObject({ fileName: 'notes.md', folderPath: '/Reports', content: 'x' })
+ expect(request.folderPaths).toBeUndefined()
+ })
+
+ it('sends only the model folderPath on Edit when the model names both folder args', () => {
+ const request = toolCallRequest(
+ { fileName: 'notes.md', content: 'x', folderRef: '/Reports', folderPaths: ['/Other'] },
+ 'file_edit'
+ )
+ expect(request).toMatchObject({ fileName: 'notes.md', folderPath: '/Reports' })
+ expect(request.folderPaths).toBeUndefined()
+ })
+
+ it('keeps the model folderPaths on Append when the row pins no folder', () => {
+ const request = toolCallRequest(
+ { fileName: 'notes.md', content: 'x', folderPaths: ['/Reports', '/Archive'] },
+ 'file_append'
+ )
+ expect(request.folderPaths).toEqual(['/Reports', '/Archive'])
+ expect(request.folderPath).toBeUndefined()
+ })
+ })
})
diff --git a/apps/sim/blocks/blocks/file.ts b/apps/sim/blocks/blocks/file.ts
index 628f34a5170..4f54fcd88f3 100644
--- a/apps/sim/blocks/blocks/file.ts
+++ b/apps/sim/blocks/blocks/file.ts
@@ -8,12 +8,15 @@ import {
} from '@/lib/folders/paths'
import { readFolderPaths } from '@/lib/folders/selection'
import { inferContextFromKey } from '@/lib/uploads/utils/file'
-import type { BlockConfig, SubBlockType } from '@/blocks/types'
+import type { BlockConfig, BlockToolParamsContext, SubBlockType } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
import {
createVersionedToolSelector,
+ isToolCall,
+ mapperOperation,
normalizeFileInput,
parseOptionalNumberInput,
+ toolCallArg,
} from '@/blocks/utils'
const logger = createLogger('FileBlock')
@@ -184,7 +187,8 @@ interface FileFamilyParams {
function fileFamilyInput(
params: FileFamilyParams,
label: string,
- pickerValue: unknown
+ pickerValue: unknown,
+ context?: BlockToolParamsContext
): Record {
const workspaceId = params._context?.workspaceId
const fileIds = pickerValue ? parseReadFileIds(pickerValue) : null
@@ -195,6 +199,9 @@ function fileFamilyInput(
const folderPaths = folderScopePaths(params.folderScopeRef)
if (!folderPaths) {
+ /* A tool call names its target in the tool's own `fileId` / `folderPaths` args,
+ which the merged params already carry. */
+ if (isToolCall(context)) return { workspaceId }
throw new Error(`File or folder is required for ${label}`)
}
return {
@@ -275,6 +282,34 @@ function namedFileTarget(
}
}
+/**
+ * {@link namedFileTarget} for a mapper that also runs on tool calls, where the stored picker may
+ * be empty and the model names the file with the tool's own `fileName` and `folderPath` args. The
+ * model's folder applies only to the model's name, and never beside a scope the row already pins.
+ *
+ * The result is spread over the merged row and model params, so a folder arg the model sent stays
+ * in the request unless it is cleared here; the tool refuses `folderPath` and `folderPaths` together.
+ */
+function namedFileTargetWithModelFolder(
+ params: FileFamilyParams & { fileName?: unknown },
+ pickerValue: unknown,
+ label: string,
+ context: BlockToolParamsContext | undefined,
+ modelFolderPath: string | undefined
+): ReturnType {
+ const target = namedFileTarget(
+ params,
+ pickerValue || toolCallArg(context, params.fileName),
+ label
+ )
+ if (!isToolCall(context)) return target
+ if (pickerValue || target.folderPath || target.folderPaths) {
+ return { folderPath: undefined, folderPaths: undefined, ...target }
+ }
+ if (!modelFolderPath) return target
+ return { ...target, folderPath: modelFolderPath, folderPaths: undefined }
+}
+
/**
* A whole number above zero, or nothing.
*
@@ -663,8 +698,8 @@ export const FileV3Block: BlockConfig = {
access: ['file_parser_v3', 'file_get', 'file_write', 'file_append'],
config: {
tool: (params) => params.operation || 'file_parser_v3',
- params: (params) => {
- const operation = params.operation || 'file_parser_v3'
+ params: (params, context) => {
+ const operation = mapperOperation(params, context) || 'file_parser_v3'
if (operation === 'file_write') {
return {
@@ -676,7 +711,7 @@ export const FileV3Block: BlockConfig = {
}
if (operation === 'file_append') {
- const appendInput = params.appendFileInput
+ const appendInput = params.appendFileInput || toolCallArg(context, params.fileName)
if (!appendInput) {
throw new Error('File is required for append')
}
@@ -696,13 +731,13 @@ export const FileV3Block: BlockConfig = {
return {
fileName,
- content: params.appendContent,
+ content: params.appendContent ?? toolCallArg(context, params.content),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_get') {
- const getInput = params.getFileInput
+ const getInput = params.getFileInput || toolCallArg(context, params.fileId)
if (!getInput) {
throw new Error('File is required for get')
}
@@ -974,8 +1009,8 @@ export const FileV4Block: BlockConfig = {
if (operation === 'file_fetch') return 'file_fetch'
return operation
},
- params: (params) => {
- const operation = params.operation || 'file_read'
+ params: (params, context) => {
+ const operation = mapperOperation(params, context) || 'file_read'
if (operation === 'file_write') {
return {
@@ -987,7 +1022,7 @@ export const FileV4Block: BlockConfig = {
}
if (operation === 'file_append') {
- const appendInput = params.appendFileInput
+ const appendInput = params.appendFileInput || toolCallArg(context, params.fileName)
if (!appendInput) {
throw new Error('File is required for append')
}
@@ -1007,13 +1042,13 @@ export const FileV4Block: BlockConfig = {
return {
fileName,
- content: params.appendContent,
+ content: params.appendContent ?? toolCallArg(context, params.content),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_read') {
- const readInput = params.readFileInput
+ const readInput = params.readFileInput || toolCallArg(context, params.fileId)
if (!readInput) {
throw new Error('File is required for read')
}
@@ -1930,8 +1965,13 @@ export const FileV5Block: BlockConfig = {
],
config: {
tool: (params) => params.operation || 'file_read',
- params: (params) => {
- const operation = params.operation || 'file_read'
+ params: (params, context) => {
+ const operation = mapperOperation(params, context) || 'file_read'
+ /**
+ * A tool call's `folderPath` arg shares its name with the basic half of the `folderRef`
+ * pair, so the canonical pass republishes it as `folderRef`. Read on tool calls only.
+ */
+ const modelFolderPath = toolCallArg(context, optionalText(params.folderRef))
if (operation === 'file_search') {
const maxResultsInput =
@@ -1968,7 +2008,7 @@ export const FileV5Block: BlockConfig = {
Boolean(fileInput) && (params.content == null || params.content === '')
return {
fileName: params.fileName,
- folderPath: optionalText(params.writeFolderRef),
+ folderPath: optionalText(params.writeFolderRef) ?? modelFolderPath,
content: omitContent ? undefined : params.content,
...(fileInput ? { fileInput } : {}),
contentType: params.contentType ?? undefined,
@@ -1979,21 +2019,26 @@ export const FileV5Block: BlockConfig = {
if (operation === 'file_list') {
return {
- path: optionalText(params.folderRef),
- recursive: switchValue(params.folderRecursive),
+ path: optionalText(params.folderRef) ?? toolCallArg(context, params.path),
+ recursive: switchValue(
+ params.folderRecursive,
+ switchValue(toolCallArg(context, params.recursive))
+ ),
/* Bounded here as well as at the contract, so a typo fails while
configuring rather than on the first run. */
- depth: parseOptionalNumberInput(params.folderDepth, 'Max Depth', {
- integer: true,
- min: 1,
- max: MAX_FOLDER_PATH_SEGMENTS,
- }),
- search: optionalText(params.folderSearch),
- limit: parseOptionalNumberInput(params.folderLimit, 'Limit', {
- integer: true,
- min: 1,
- max: MAX_FILE_LIST_LIMIT,
- }),
+ depth:
+ parseOptionalNumberInput(params.folderDepth, 'Max Depth', {
+ integer: true,
+ min: 1,
+ max: MAX_FOLDER_PATH_SEGMENTS,
+ }) ?? toolCallArg(context, params.depth),
+ search: optionalText(params.folderSearch) ?? toolCallArg(context, params.search),
+ limit:
+ parseOptionalNumberInput(params.folderLimit, 'Limit', {
+ integer: true,
+ min: 1,
+ max: MAX_FILE_LIST_LIMIT,
+ }) ?? toolCallArg(context, params.limit),
workspaceId: params._context?.workspaceId,
}
}
@@ -2006,9 +2051,17 @@ export const FileV5Block: BlockConfig = {
* tool takes a canonical path.
*/
const name = optionalText(params.folderName)
- const parentPrefix = folderPathPrefix(optionalText(params.createParentRef))
+ const createParent = optionalText(params.createParentRef)
+ const parentPrefix = folderPathPrefix(createParent)
+ /* A model-supplied path keeps only its last segment when the row pins a parent. */
+ const modelPath = toolCallArg(context, optionalText(params.path))
+ const modelSegment = modelPath?.split('/').filter(Boolean).pop()
return {
- path: name ? `${parentPrefix}/${encodeFolderPathSegment(name)}` : undefined,
+ path: name
+ ? `${parentPrefix}/${encodeFolderPathSegment(name)}`
+ : createParent && modelSegment
+ ? `${parentPrefix}/${modelSegment}`
+ : modelPath,
workspaceId: params._context?.workspaceId,
}
}
@@ -2021,80 +2074,106 @@ export const FileV5Block: BlockConfig = {
* carried from the source path's last segment. An unset parent means
* the workspace root. Renaming is not a move and is not offered here.
*/
- const sourcePath = optionalText(params.folderRef)
+ const sourcePath =
+ optionalText(params.folderRef) ?? toolCallArg(context, optionalText(params.path))
const segment = sourcePath?.split('/').pop()
- const parentPrefix = folderPathPrefix(optionalText(params.destinationParentRef))
+ const destinationParent = optionalText(params.destinationParentRef)
+ const parentPrefix = folderPathPrefix(destinationParent)
+ /* A model-supplied full destination applies unless the row pins a destination parent. */
+ const modelDestination = destinationParent
+ ? undefined
+ : toolCallArg(context, optionalText(params.destinationPath))
return {
path: sourcePath,
- destinationPath: segment ? `${parentPrefix}/${segment}` : undefined,
+ destinationPath:
+ modelDestination ?? (segment ? `${parentPrefix}/${segment}` : undefined),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_delete_folder') {
return {
- path: optionalText(params.folderRef),
- recursive: switchValue(params.deleteFolderRecursive),
+ path: optionalText(params.folderRef) ?? toolCallArg(context, params.path),
+ recursive: switchValue(
+ params.deleteFolderRecursive,
+ switchValue(toolCallArg(context, params.recursive))
+ ),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_move') {
return {
- fileId: optionalText(params.moveFileId),
- folderPath: optionalText(params.moveTargetRef),
+ fileId: optionalText(params.moveFileId) ?? toolCallArg(context, params.fileId),
+ folderPath: optionalText(params.moveTargetRef) ?? modelFolderPath,
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_restore_folder') {
return {
- folderId: optionalText(params.restoreFolderId),
+ folderId: optionalText(params.restoreFolderId) ?? toolCallArg(context, params.folderId),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_append') {
return {
- ...namedFileTarget(params, params.appendFileInput, 'append'),
- content: params.appendContent,
+ ...namedFileTargetWithModelFolder(
+ params,
+ params.appendFileInput,
+ 'append',
+ context,
+ modelFolderPath
+ ),
+ content: params.appendContent ?? toolCallArg(context, params.content),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_edit') {
- const mode = optionalText(params.editMode) ?? 'search_replace'
+ const mode =
+ optionalText(params.editMode) ??
+ toolCallArg(context, optionalText(params.mode)) ??
+ 'search_replace'
if (!FILE_EDIT_MODES.has(mode)) throw new Error('Edit Type is invalid')
return {
- ...namedFileTarget(params, params.editFileInput, 'edit'),
+ ...namedFileTargetWithModelFolder(
+ params,
+ params.editFileInput,
+ 'edit',
+ context,
+ modelFolderPath
+ ),
mode,
- search: params.editSearch,
- content: params.editContent ?? '',
+ search: params.editSearch ?? toolCallArg(context, params.search),
+ content: params.editContent ?? toolCallArg(context, params.content) ?? '',
replaceAll: switchValue(params.replaceAll),
beforeAnchor: params.beforeAnchor,
afterAnchor: params.afterAnchor,
anchor: params.anchor,
startAnchor: params.startAnchor,
endAnchor: params.endAnchor,
- occurrence: parseOptionalNumberInput(params.editOccurrence, 'Anchor Occurrence', {
- integer: true,
- min: 1,
- }),
+ occurrence:
+ parseOptionalNumberInput(params.editOccurrence, 'Anchor Occurrence', {
+ integer: true,
+ min: 1,
+ }) ?? toolCallArg(context, params.occurrence),
workspaceId: params._context?.workspaceId,
}
}
if (operation === 'file_compress') {
return {
- ...fileFamilyInput(params, 'compress', params.compressInput),
+ ...fileFamilyInput(params, 'compress', params.compressInput, context),
archiveName: optionalText(params.archiveName),
}
}
if (operation === 'file_decompress') {
- const decompressInput = params.decompressInput
+ const decompressInput = params.decompressInput || toolCallArg(context, params.fileId)
if (!decompressInput) {
throw new Error('File is required for decompress')
}
@@ -2126,26 +2205,34 @@ export const FileV5Block: BlockConfig = {
}
if (operation === 'file_manage_sharing') {
- const shareInput = params.shareInput
+ const shareInput = params.shareInput || toolCallArg(context, params.fileId)
if (!shareInput) {
throw new Error('File is required to manage sharing')
}
- const allowedEmails =
+ const rowEmails =
typeof params.shareAllowedEmails === 'string'
? params.shareAllowedEmails
.split(/[\n,]/)
.map((email) => email.trim())
.filter(Boolean)
: undefined
+ const allowedEmails = rowEmails?.length
+ ? rowEmails
+ : (toolCallArg(context, params.allowedEmails) ?? rowEmails)
+ /* A tool row has no visibility dropdown, so a tool call states the link
+ with the tool's own `isActive` / `authType` args. */
+ const modelSharing = !params.shareVisibility && isToolCall(context)
const visibility = (params.shareVisibility as string) || 'public'
- const isActive = visibility !== 'private'
+ const isActive = modelSharing
+ ? switchValue(params.isActive, true)
+ : visibility !== 'private'
const shareParams = {
isActive,
// When disabling, leave authType unset so the stored access mode is preserved.
- authType: isActive ? visibility : undefined,
- password: params.sharePassword,
+ authType: isActive ? (modelSharing ? params.authType : visibility) : undefined,
+ password: params.sharePassword ?? toolCallArg(context, params.password),
allowedEmails,
workspaceId: params._context?.workspaceId,
}
@@ -2189,13 +2276,13 @@ export const FileV5Block: BlockConfig = {
const range = optionalPositiveInt(params.contentOffset, 'Start Line')
const count = optionalPositiveInt(params.contentLimit, 'Line Count')
return {
- ...fileFamilyInput(params, 'get content', params.getContentInput),
+ ...fileFamilyInput(params, 'get content', params.getContentInput, context),
...(range === undefined ? {} : { offset: range }),
...(count === undefined ? {} : { limit: count }),
}
}
- return fileFamilyInput(params, 'read', params.readFileInput)
+ return fileFamilyInput(params, 'read', params.readFileInput, context)
},
},
},
diff --git a/apps/sim/blocks/blocks/firecrawl.test.ts b/apps/sim/blocks/blocks/firecrawl.test.ts
new file mode 100644
index 00000000000..fd3dab6b31a
--- /dev/null
+++ b/apps/sim/blocks/blocks/firecrawl.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest'
+import { FirecrawlBlock } from '@/blocks/blocks/firecrawl'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = FirecrawlBlock.tools.config?.params
+ if (!mapper) throw new Error('Firecrawl block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Firecrawl tool calls', () => {
+ it('sends Parse a single document when the model passes it in a list', () => {
+ const file = { id: 'file-1' }
+ expect(mapParams({ file: [file] }, { operation: 'parse' }).file).toEqual(file)
+ })
+})
diff --git a/apps/sim/blocks/blocks/firecrawl.ts b/apps/sim/blocks/blocks/firecrawl.ts
index 323f3b8a4b3..128bb994734 100644
--- a/apps/sim/blocks/blocks/firecrawl.ts
+++ b/apps/sim/blocks/blocks/firecrawl.ts
@@ -1,7 +1,7 @@
import { FirecrawlIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta, SubBlockType } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput } from '@/blocks/utils'
/** The document being parsed, whether it was uploaded or passed in by reference. */
const DOCUMENT_FIELD = ['fileUpload', 'fileReference'] as const
@@ -592,9 +592,9 @@ Example 2 - Product Data:
return 'firecrawl_scrape'
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
limit,
urls,
formats,
diff --git a/apps/sim/blocks/blocks/fireflies.test.ts b/apps/sim/blocks/blocks/fireflies.test.ts
new file mode 100644
index 00000000000..06ee181af64
--- /dev/null
+++ b/apps/sim/blocks/blocks/fireflies.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+import { FirefliesBlock, FirefliesV2Block } from '@/blocks/blocks/fireflies'
+import type { BlockConfig, BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(
+ block: BlockConfig,
+ params: Record,
+ context?: BlockToolParamsContext
+) {
+ const mapper = block.tools.config?.params
+ if (!mapper) throw new Error('Fireflies block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Fireflies tool calls', () => {
+ it('uploads a picked file by its https URL when the operation arrives only in the context', () => {
+ const mapped = mapParams(
+ FirefliesV2Block,
+ { audioFile: { name: 'call.mp3', url: 'https://files.example.com/call.mp3' } },
+ { operation: 'fireflies_upload_audio' }
+ )
+ expect(mapped.audioUrl).toBe('https://files.example.com/call.mp3')
+ expect(mapped.audioFile).toBeUndefined()
+ })
+
+ it('keeps the model bite name and a zero start time', () => {
+ const mapped = mapParams(
+ FirefliesBlock,
+ { transcriptId: 't1', startTime: 0, endTime: 30, name: 'Intro', summary: 'Opening' },
+ { operation: 'fireflies_create_bite' }
+ )
+ expect(mapped).toMatchObject({ startTime: 0, endTime: 30, name: 'Intro', summary: 'Opening' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/fireflies.ts b/apps/sim/blocks/blocks/fireflies.ts
index f2da0288c59..cf971fff653 100644
--- a/apps/sim/blocks/blocks/fireflies.ts
+++ b/apps/sim/blocks/blocks/fireflies.ts
@@ -3,11 +3,21 @@ import { FirefliesIcon } from '@/components/icons'
import { resolveHttpsUrlFromFileInput } from '@/lib/uploads/utils/file'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const AUDIO_FILE_FIELD = ['audioFile', 'audioFileReference'] as const
+/** A bite boundary the caller never set; `0` is a valid start time. */
+function isBlankTime(value: unknown): boolean {
+ return value === undefined || value === null || value === ''
+}
+
export const FirefliesBlock: BlockConfig = {
type: 'fireflies',
name: 'Fireflies (Legacy)',
@@ -523,12 +533,12 @@ Return ONLY the summary text - no quotes, no labels.`,
tool: (params) => {
return params.operation || 'fireflies_list_transcripts'
},
- params: (params) => {
+ params: (params, context) => {
const baseParams: Record = {
apiKey: params.apiKey,
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'fireflies_list_transcripts':
return {
...baseParams,
@@ -605,7 +615,7 @@ Return ONLY the summary text - no quotes, no labels.`,
if (!params.transcriptId?.trim()) {
throw new Error('Transcript ID is required.')
}
- if (!params.startTime || !params.endTime) {
+ if (isBlankTime(params.startTime) || isBlankTime(params.endTime)) {
throw new Error('Start time and end time are required.')
}
return {
@@ -613,16 +623,17 @@ Return ONLY the summary text - no quotes, no labels.`,
transcriptId: params.transcriptId.trim(),
startTime: Number(params.startTime),
endTime: Number(params.endTime),
- name: params.biteName?.trim() || undefined,
+ name: params.biteName?.trim() || toolCallArg(context, params.name) || undefined,
mediaType: params.mediaType?.trim() || undefined,
- summary: params.biteSummary?.trim() || undefined,
+ summary:
+ params.biteSummary?.trim() || toolCallArg(context, params.summary) || undefined,
}
case 'fireflies_list_bites':
return {
...baseParams,
transcriptId: params.transcriptId?.trim() || undefined,
- mine: true,
+ mine: toolCallArg(context, params.mine) ?? true,
limit: params.limit ? Number(params.limit) : undefined,
skip: params.skip ? Number(params.skip) : undefined,
}
@@ -717,16 +728,18 @@ export const FirefliesV2Block: BlockConfig = {
FirefliesBlock.tools?.config?.tool
? FirefliesBlock.tools.config.tool(params)
: params.operation || 'fireflies_list_transcripts',
- params: (params) => {
+ params: (params, context) => {
const baseParams = FirefliesBlock.tools?.config?.params
if (!baseParams) {
return params
}
- if (params.operation === 'fireflies_upload_audio') {
- // Use canonical 'audioFile' param directly
+ if (mapperOperation(params, context) === 'fireflies_upload_audio') {
const audioFile = normalizeFileInput(params.audioFile, { single: true })
if (!audioFile) {
+ if (toolCallArg(context, params.audioUrl?.trim())) {
+ return baseParams(params, context)
+ }
throw new Error('Audio file is required.')
}
const audioUrl = resolveHttpsUrlFromFileInput(audioFile)
@@ -734,14 +747,17 @@ export const FirefliesV2Block: BlockConfig = {
throw new Error('Audio file must include a https URL.')
}
- return baseParams({
- ...params,
- audioUrl,
- audioFile: undefined,
- })
+ return baseParams(
+ {
+ ...params,
+ audioUrl,
+ audioFile: undefined,
+ },
+ context
+ )
}
- return baseParams(params)
+ return baseParams(params, context)
},
},
},
diff --git a/apps/sim/blocks/blocks/fivetran.test.ts b/apps/sim/blocks/blocks/fivetran.test.ts
new file mode 100644
index 00000000000..8ff9bd4e83f
--- /dev/null
+++ b/apps/sim/blocks/blocks/fivetran.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from 'vitest'
+import { FivetranBlock } from '@/blocks/blocks/fivetran'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** Mirrors the tool-call path: the mapper result is spread over the merged params. */
+function toolCallParams(args: Record, context: BlockToolParamsContext) {
+ const mapper = FivetranBlock.tools.config?.params
+ if (!mapper) throw new Error('Fivetran block has no params mapper')
+ return { ...args, ...mapper(args, context) }
+}
+
+describe('Fivetran agent tool calls', () => {
+ it('pauses the connection when the operation arrives only in the context', () => {
+ const sent = toolCallParams(
+ { connectionId: 'c1', syncFrequency: 60 },
+ { operation: 'pause_connection' }
+ )
+ expect(sent.paused).toBe(true)
+ expect(sent.syncFrequency).toBeUndefined()
+ })
+
+ it.each([
+ ['create_group', { name: 'Analytics' }],
+ ['create_destination', { groupId: 'g1', service: 'snowflake', config: { host: 'h' } }],
+ ['update_schema_config', { connectionId: 'c1', schemas: { public: { enabled: true } } }],
+ [
+ 'update_connection_schema',
+ { connectionId: 'c1', schemaName: 'public', enabled: false, tables: { t: {} } },
+ ],
+ [
+ 'update_connection_table',
+ { connectionId: 'c1', schemaName: 'public', tableName: 't', enabled: true },
+ ],
+ ])('keeps the model arguments for %s', (operation, args) => {
+ expect(toolCallParams(args, { operation })).toMatchObject(args)
+ })
+})
diff --git a/apps/sim/blocks/blocks/fivetran.ts b/apps/sim/blocks/blocks/fivetran.ts
index 49eb01fe8a5..8eb1d6833a9 100644
--- a/apps/sim/blocks/blocks/fivetran.ts
+++ b/apps/sim/blocks/blocks/fivetran.ts
@@ -1,5 +1,6 @@
import { FivetranIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const CONNECTION_ID_OPS = [
@@ -1058,16 +1059,17 @@ export const FivetranBlock: BlockConfig = {
}
return `fivetran_${params.operation}`
},
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
+ const operation = mapperOperation(params, context)
const isConnectionSettings = (CONNECTION_SETTINGS_OPS as readonly string[]).includes(
- params.operation
+ operation
)
- if (params.operation === 'pause_connection' || params.operation === 'resume_connection') {
+ if (operation === 'pause_connection' || operation === 'resume_connection') {
return {
...PAUSE_ONLY_UPDATE,
- paused: params.operation === 'pause_connection',
+ paused: operation === 'pause_connection',
}
}
@@ -1077,43 +1079,51 @@ export const FivetranBlock: BlockConfig = {
result.pauseAfterTrial = toOptionalBoolean(params.pauseAfterTrial)
result.dataDelayThreshold = toOptionalNumber(params.dataDelayThreshold)
}
- if (isConnectionSettings || params.operation === 'create_destination') {
+ if (isConnectionSettings || operation === 'create_destination') {
result.runSetupTests = toOptionalBoolean(params.runSetupTests)
}
- if (params.operation === 'create_destination') {
- result.service = params.destinationService
- result.config = params.destinationConfig
+ if (operation === 'create_destination') {
+ result.service = params.destinationService ?? toolCallArg(context, params.service)
+ result.config = params.destinationConfig ?? toolCallArg(context, params.config)
result.daylightSavingTimeEnabled = toOptionalBoolean(params.daylightSavingTimeEnabled)
}
- if (params.operation === 'create_group') result.name = params.groupName
- if (params.operation === 'update_schema_config') result.schemas = params.schemasConfig
- if (params.operation === 'update_connection_schema') {
- result.enabled = toOptionalBoolean(params.schemaEnabled)
- result.tables = params.schemaTables
+ if (operation === 'create_group') {
+ result.name = params.groupName ?? toolCallArg(context, params.name)
+ }
+ if (operation === 'update_schema_config') {
+ result.schemas = params.schemasConfig ?? toolCallArg(context, params.schemas)
+ }
+ if (operation === 'update_connection_schema') {
+ result.enabled =
+ toOptionalBoolean(params.schemaEnabled) ??
+ toOptionalBoolean(toolCallArg(context, params.enabled))
+ result.tables = params.schemaTables ?? toolCallArg(context, params.tables)
}
- if (params.operation === 'update_connection') {
+ if (operation === 'update_connection') {
result.isHistoricalSync = toOptionalBoolean(params.isHistoricalSync)
}
- if ((SETUP_TEST_OPS as readonly string[]).includes(params.operation)) {
+ if ((SETUP_TEST_OPS as readonly string[]).includes(operation)) {
result.trustCertificates = toOptionalBoolean(params.trustCertificates)
result.trustFingerprints = toOptionalBoolean(params.trustFingerprints)
}
- if (params.operation === 'sync_connection') result.force = toOptionalBoolean(params.force)
- if (params.operation === 'update_connection_table') {
- result.enabled = toOptionalBoolean(params.tableEnabled)
+ if (operation === 'sync_connection') result.force = toOptionalBoolean(params.force)
+ if (operation === 'update_connection_table') {
+ result.enabled =
+ toOptionalBoolean(params.tableEnabled) ??
+ toOptionalBoolean(toolCallArg(context, params.enabled))
}
- if (params.operation === 'create_connect_card') {
+ if (operation === 'create_connect_card') {
result.hideSetupGuide = toOptionalBoolean(params.hideSetupGuide)
result.allFields = toOptionalBoolean(params.allFields)
}
- if (params.operation === 'run_transformation') {
+ if (operation === 'run_transformation') {
result.fullRefresh = toOptionalBoolean(params.fullRefresh)
}
- if (params.operation === 'list_users') {
+ if (operation === 'list_users') {
result.active = toOptionalBoolean(params.active)
result.hasApiKey = toOptionalBoolean(params.hasApiKey)
}
- if ((PAGINATED_OPS as readonly string[]).includes(params.operation)) {
+ if ((PAGINATED_OPS as readonly string[]).includes(operation)) {
result.limit = toOptionalNumber(params.limit)
}
return result
diff --git a/apps/sim/blocks/blocks/flint.ts b/apps/sim/blocks/blocks/flint.ts
index 02be8b453c4..2ce183ee4f6 100644
--- a/apps/sim/blocks/blocks/flint.ts
+++ b/apps/sim/blocks/blocks/flint.ts
@@ -1,7 +1,7 @@
import { FlintIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
/**
* Coerces the publish switch value to an explicit boolean, preserving an
@@ -155,10 +155,10 @@ Return ONLY the raw JSON array starting with [ and ending with ] - no explanatio
access: ['flint_create_task', 'flint_generate_pages', 'flint_get_task'],
config: {
tool: (params) => params.operation || 'flint_create_task',
- params: (params) => {
+ params: (params, context) => {
const base: Record = { apiKey: params.apiKey }
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'flint_generate_pages':
return {
...base,
diff --git a/apps/sim/blocks/blocks/gauge.ts b/apps/sim/blocks/blocks/gauge.ts
index af734b73eb6..5fdce04a6be 100644
--- a/apps/sim/blocks/blocks/gauge.ts
+++ b/apps/sim/blocks/blocks/gauge.ts
@@ -1,5 +1,6 @@
import { GaugeIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
export const GaugeBlock: BlockConfig = {
type: 'gauge',
@@ -972,7 +973,7 @@ export const GaugeBlock: BlockConfig = {
config: {
tool: (params) => params.operation,
params: (params, context) => {
- const operation = context?.operation ?? params.operation
+ const operation = mapperOperation(params, context)
const patch = ['gauge_bulk_update_prompts', 'gauge_update_prompt'].includes(operation)
return {
...params,
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..ec08815ce2a 100644
--- a/apps/sim/blocks/blocks/gitlab.test.ts
+++ b/apps/sim/blocks/blocks/gitlab.test.ts
@@ -94,3 +94,219 @@ describe('GitLabBlock access operations', () => {
expect(untouched?.admin).toBeUndefined()
})
})
+
+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 mapParams({ 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 = mapParams({
+ 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) =>
+ mapParams({
+ 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 = mapParams({
+ 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..2e87ff0b8d7 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,70 @@ 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
+ /** 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 (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 +2397,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 +2420,483 @@ 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:
+ textOrToolArg(params.sourceBranchFilter, params.sourceBranch) || undefined,
+ targetBranch:
+ textOrToolArg(params.targetBranchFilter, params.targetBranch) || undefined,
+ 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: textOrToolArg(params.mergeSha, params.sha) || undefined,
+ }
+
+ 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 = 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.')
}
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: textOrToolArg(params.releaseName, params.name) || undefined,
+ 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: textOrToolArg(params.memberUserIds, params.userIds) || undefined,
+ 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 +2906,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 +2998,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 +3048,90 @@ 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: textOrToolArg(params.samlProvider, params.provider) || undefined,
}
+ }
- 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: textOrToolArg(params.samlProvider, params.provider) || undefined,
}
+ }
- case 'gitlab_search_users':
- if (!params.userSearch?.trim()) {
+ case 'gitlab_search_users': {
+ const search = textOrToolArg(params.userSearch, 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 = 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.')
}
- 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 +3140,19 @@ 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: 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.
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 +3181,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 +3208,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 +3306,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/gmail.test.ts b/apps/sim/blocks/blocks/gmail.test.ts
index 6f999b9c3e6..92f00dc3067 100644
--- a/apps/sim/blocks/blocks/gmail.test.ts
+++ b/apps/sim/blocks/blocks/gmail.test.ts
@@ -11,12 +11,12 @@ const buildParams = (
/**
* On an agent call the model supplies `threadId`/`format`/`name`/`query`/`labelIds` under the
* tool's own names; the dedicated V2 fields (`targetThreadId`, `threadFormat`, `labelName`,
- * `listQuery`, `threadLabelIds`) are never rendered in the agent tool input.
+ * `listQuery`, `threadLabelIds`) are never rendered in the agent tool input. A tool call carries
+ * the operation only in `context`.
*/
describe('GmailV2Block agent tool calls', () => {
const agentCall = (operation: string, args: Record): Record => {
- const inputs = { ...args, operation }
- return { ...inputs, ...buildParams(inputs, { operation }) }
+ return { ...args, ...buildParams(args, { operation }) }
}
it('keeps the model threadId and format on get_thread_gmail', () => {
@@ -41,6 +41,11 @@ describe('GmailV2Block agent tool calls', () => {
}
)
+ it('joins model labelIds sent as an array on list_threads_gmail', () => {
+ const mapped = agentCall('list_threads_gmail', { labelIds: ['INBOX', 'UNREAD'] })
+ expect(mapped.labelIds).toBe('INBOX,UNREAD')
+ })
+
it('drops a Send threadId left over on the canvas under get_thread_gmail', () => {
const inputs = { operation: 'get_thread_gmail', threadId: 'stale' }
expect({ ...inputs, ...buildParams(inputs) }.threadId).toBeUndefined()
diff --git a/apps/sim/blocks/blocks/gmail.ts b/apps/sim/blocks/blocks/gmail.ts
index 2f120055b2a..66b30745683 100644
--- a/apps/sim/blocks/blocks/gmail.ts
+++ b/apps/sim/blocks/blocks/gmail.ts
@@ -6,6 +6,7 @@ import { AuthMode, IntegrationType } from '@/blocks/types'
import {
createVersionedToolSelector,
isToolCall,
+ mapperOperation,
normalizeFileInput,
SERVICE_ACCOUNT_SUBBLOCKS,
toolCallArg,
@@ -543,7 +544,8 @@ Return ONLY the search query - no explanations, no extra text.`,
],
config: {
tool: selectGmailToolId,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
oauthCredential,
folder,
@@ -560,12 +562,12 @@ Return ONLY the search query - no explanations, no extra text.`,
// Use canonical 'folder' param directly
const effectiveFolder = folder ? String(folder).trim() : ''
- if (rest.operation === 'read_gmail') {
+ if (operation === 'read_gmail') {
rest.folder = effectiveFolder || 'INBOX'
}
// Handle move operation - use canonical params addLabelIds and removeLabelIds
- if (rest.operation === 'move_gmail') {
+ if (operation === 'move_gmail') {
if (moveMessageId) {
rest.messageId = moveMessageId
}
@@ -585,14 +587,14 @@ Return ONLY the search query - no explanations, no extra text.`,
'archive_gmail',
'unarchive_gmail',
'delete_gmail',
- ].includes(rest.operation)
+ ].includes(operation)
) {
if (actionMessageId) {
rest.messageId = actionMessageId
}
}
- if (['add_label_gmail', 'remove_label_gmail'].includes(rest.operation)) {
+ if (['add_label_gmail', 'remove_label_gmail'].includes(operation)) {
if (labelActionMessageId) {
rest.messageId = labelActionMessageId
}
@@ -972,6 +974,7 @@ export const GmailV2Block: BlockConfig = {
fallbackToolId: 'gmail_send_v2',
}),
params: (params, context) => {
+ const operation = mapperOperation(params, context)
const mapped = GmailBlock.tools?.config?.params?.(params, context) ?? params
const {
labelName,
@@ -983,16 +986,16 @@ export const GmailV2Block: BlockConfig = {
labelListVisibility,
...rest
} = mapped
- if (LABEL_WRITE_OPERATIONS.includes(rest.operation)) {
+ if (LABEL_WRITE_OPERATIONS.includes(operation)) {
rest.name = labelName || toolCallArg(context, rest.name) || undefined
rest.messageListVisibility = messageListVisibility || undefined
rest.labelListVisibility = labelListVisibility || undefined
}
- if (THREAD_TARGET_OPERATIONS.includes(rest.operation)) {
+ if (THREAD_TARGET_OPERATIONS.includes(operation)) {
rest.threadId = isToolCall(context) ? targetThreadId || rest.threadId : targetThreadId
rest.format = threadFormat || toolCallArg(context, rest.format) || undefined
}
- if (LIST_OPERATIONS.includes(rest.operation)) {
+ if (LIST_OPERATIONS.includes(operation)) {
rest.query = listQuery || toolCallArg(context, rest.query) || undefined
const labelIds = threadLabelIds || toolCallArg(context, rest.labelIds)
rest.labelIds = labelIds ? String(labelIds).trim() : undefined
diff --git a/apps/sim/blocks/blocks/gong.test.ts b/apps/sim/blocks/blocks/gong.test.ts
new file mode 100644
index 00000000000..5d13dd8b9f7
--- /dev/null
+++ b/apps/sim/blocks/blocks/gong.test.ts
@@ -0,0 +1,20 @@
+/**
+ * Agent tool calls pass the operation in context and supply arguments under the tool's param
+ * names, which the mapper spreads over and must keep.
+ */
+import { describe, expect, it } from 'vitest'
+import { GongBlock } from '@/blocks/blocks/gong'
+
+function agentParams(operation: string, args: Record): Record {
+ return { ...args, ...(GongBlock.tools.config?.params?.(args, { operation }) ?? {}) }
+}
+
+describe('GongBlock agent tool calls', () => {
+ it('keeps the model flowId when unassigning flow prospects', () => {
+ const params = agentParams('unassign_flow_prospects', {
+ crmProspectId: 'lead-1',
+ flowId: 'flow-9',
+ })
+ expect(params.flowId).toBe('flow-9')
+ })
+})
diff --git a/apps/sim/blocks/blocks/gong.ts b/apps/sim/blocks/blocks/gong.ts
index 7599830cc87..938bf3b09f5 100644
--- a/apps/sim/blocks/blocks/gong.ts
+++ b/apps/sim/blocks/blocks/gong.ts
@@ -1,6 +1,6 @@
import { GongIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
export const GongBlock: BlockConfig = {
@@ -1088,11 +1088,11 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
],
config: {
tool: (params) => `gong_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
// Map operation-specific subBlock IDs to tool param names, gated by the
// selected operation so stale values from other operations never leak in
- const operation = params.operation as string
+ const operation = mapperOperation(params, context)
if (operation === 'get_call_transcript' || operation === 'get_extensive_calls') {
if (params.transcriptFromDateTime) result.fromDateTime = params.transcriptFromDateTime
if (params.transcriptToDateTime) result.toDateTime = params.transcriptToDateTime
@@ -1123,7 +1123,7 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
if (params.logsToDateTime) result.toDateTime = params.logsToDateTime
}
if (operation === 'unassign_flow_prospects') {
- result.flowId = params.unassignFlowId || undefined
+ result.flowId = params.unassignFlowId || toolCallArg(context, params.flowId) || undefined
}
return result
},
diff --git a/apps/sim/blocks/blocks/google_appsheet.ts b/apps/sim/blocks/blocks/google_appsheet.ts
index be2726ac42c..2c79ec9cf67 100644
--- a/apps/sim/blocks/blocks/google_appsheet.ts
+++ b/apps/sim/blocks/blocks/google_appsheet.ts
@@ -1,6 +1,8 @@
+import { getErrorMessage } from '@sim/utils/errors'
import { GoogleAppsheetIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
export const GoogleAppsheetBlock: BlockConfig = {
type: 'google_appsheet',
@@ -163,15 +165,15 @@ Return ONLY the valid JSON array - no explanations, no markdown.`,
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
const { rows, ...rest } = params
const result: Record = { ...rest }
- if (params.operation !== 'google_appsheet_find_rows' && rows) {
+ if (mapperOperation(params, context) !== 'google_appsheet_find_rows' && rows) {
let parsedRows: unknown
try {
parsedRows = typeof rows === 'string' ? JSON.parse(rows) : rows
- } catch (error: any) {
- throw new Error(`Invalid JSON in Rows field: ${error.message}`)
+ } catch (error) {
+ throw new Error(`Invalid JSON in Rows field: ${getErrorMessage(error)}`)
}
if (!Array.isArray(parsedRows)) {
throw new Error('Rows must be a JSON array of row objects, e.g. [{ "RowID": "123" }]')
diff --git a/apps/sim/blocks/blocks/google_bigquery.ts b/apps/sim/blocks/blocks/google_bigquery.ts
index 5c9844d06b2..bc8354f531a 100644
--- a/apps/sim/blocks/blocks/google_bigquery.ts
+++ b/apps/sim/blocks/blocks/google_bigquery.ts
@@ -2,6 +2,7 @@ import { GoogleBigQueryIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
const EXISTING_DATASET_OPS = [
'list_tables',
@@ -420,7 +421,7 @@ Return ONLY the JSON array - no explanations, no wrapping, no extra text.`,
throw new Error(`Invalid Google BigQuery operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
const {
oauthCredential,
rows,
@@ -435,7 +436,7 @@ Return ONLY the JSON array - no explanations, no wrapping, no extra text.`,
tableId,
...rest
} = params
- const operation = String(params.operation)
+ const operation = mapperOperation(params, context)
return {
...rest,
oauthCredential,
diff --git a/apps/sim/blocks/blocks/google_calendar.test.ts b/apps/sim/blocks/blocks/google_calendar.test.ts
index 07beac3b4d8..f0d5487904d 100644
--- a/apps/sim/blocks/blocks/google_calendar.test.ts
+++ b/apps/sim/blocks/blocks/google_calendar.test.ts
@@ -14,7 +14,7 @@ const buildParams = (
*/
describe('GoogleCalendarBlock list timeZone', () => {
it('keeps the model timeZone on an agent list call', () => {
- const inputs = { operation: 'list', timeZone: 'America/New_York' }
+ const inputs = { timeZone: 'America/New_York' }
const mapped = buildParams(inputs, { operation: 'list' })
expect({ ...inputs, ...mapped }.timeZone).toBe('America/New_York')
})
@@ -24,3 +24,11 @@ describe('GoogleCalendarBlock list timeZone', () => {
expect({ ...inputs, ...buildParams(inputs) }.timeZone).toBeUndefined()
})
})
+
+describe('GoogleCalendarBlock invite replaceExisting', () => {
+ it('keeps a boolean replaceExisting the model sends on an agent invite call', () => {
+ const inputs = { eventId: 'evt1', attendees: 'a@example.com', replaceExisting: true }
+ const mapped = buildParams(inputs, { operation: 'invite' })
+ expect({ ...inputs, ...mapped }.replaceExisting).toBe(true)
+ })
+})
diff --git a/apps/sim/blocks/blocks/google_calendar.ts b/apps/sim/blocks/blocks/google_calendar.ts
index a514ef29a54..f994d6960b2 100644
--- a/apps/sim/blocks/blocks/google_calendar.ts
+++ b/apps/sim/blocks/blocks/google_calendar.ts
@@ -2,7 +2,12 @@ import { GoogleCalendarIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS, toolCallArg } from '@/blocks/utils'
+import {
+ createVersionedToolSelector,
+ mapperOperation,
+ SERVICE_ACCOUNT_SUBBLOCKS,
+ toolCallArg,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const CALENDAR_FIELD = ['calendarId', 'manualCalendarId'] as const
@@ -994,13 +999,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
params: (params, context) => {
const {
oauthCredential,
- operation,
attendees,
replaceExisting,
calendarId,
destinationCalendarId,
...rest
} = params
+ const operation = mapperOperation(params, context)
const effectiveCalendarId = calendarId ? String(calendarId).trim() : ''
@@ -1029,7 +1034,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
}
if (operation === 'invite' && replaceExisting !== undefined) {
- processedParams.replaceExisting = replaceExisting === 'true'
+ processedParams.replaceExisting = replaceExisting === true || replaceExisting === 'true'
}
if (processedParams.addGoogleMeet !== undefined) {
diff --git a/apps/sim/blocks/blocks/google_drive.test.ts b/apps/sim/blocks/blocks/google_drive.test.ts
index 51168d39875..0db286a23c9 100644
--- a/apps/sim/blocks/blocks/google_drive.test.ts
+++ b/apps/sim/blocks/blocks/google_drive.test.ts
@@ -76,10 +76,14 @@ describe('GoogleDriveBlock pagination', () => {
* the per-operation fields (`permissionsPageSize`, `searchPageToken`, `searchQuery`) are never rendered.
*/
describe('GoogleDriveBlock agent tool calls', () => {
- const agentCall = (operation: string, args: Record): Record => {
- const inputs = { ...args, operation }
- return { ...inputs, ...buildParams(inputs, { operation }) }
- }
+ /** A stored agent tool keeps its operation on the tool, so it reaches the mapper only in `context`. */
+ const agentCall = (
+ operation: string,
+ args: Record
+ ): Record => ({
+ ...args,
+ ...buildParams(args, { operation }),
+ })
it.each(['search', 'list_permissions', 'list_revisions', 'list_comments'])(
'keeps the model pageSize and pageToken on %s',
@@ -103,4 +107,39 @@ describe('GoogleDriveBlock agent tool calls', () => {
const args = { fileId: 'f-1', pageToken: 'next' }
expect({ ...args, ...buildParams(args, { operation: 'list_comments' }) }.pageToken).toBe('next')
})
+
+ it('sends the file picked on the tool row over the fileId the model supplies', () => {
+ expect(agentCall('get_file', { getFileId: 'picked-1', fileId: 'model-1' }).fileId).toBe(
+ 'picked-1'
+ )
+ })
+
+ it('sends the folders picked on the tool row over the ids the model supplies', () => {
+ const moved = agentCall('move', {
+ fileId: 'f-1',
+ moveDestFolderId: 'picked-dest',
+ destinationFolderId: 'model-dest',
+ })
+ expect(moved.destinationFolderId).toBe('picked-dest')
+ expect(
+ agentCall('list', { listFolderId: 'picked-folder', folderId: 'model-folder' }).folderId
+ ).toBe('picked-folder')
+ })
+
+ it('keeps the model fileId when the tool row has no file picked', () => {
+ expect(agentCall('get_file', { fileId: 'model-1' }).fileId).toBe('model-1')
+ })
+
+ it('keeps the export format the model supplies', () => {
+ expect(agentCall('export', { fileId: 'f-1', mimeType: 'text/plain' }).mimeType).toBe(
+ 'text/plain'
+ )
+ })
+
+ it('keeps boolean args the model sends as booleans', () => {
+ expect(agentCall('update', { fileId: 'f-1', starred: true }).starred).toBe(true)
+ expect(agentCall('move', { fileId: 'f-1', removeFromCurrent: false }).removeFromCurrent).toBe(
+ false
+ )
+ })
})
diff --git a/apps/sim/blocks/blocks/google_drive.ts b/apps/sim/blocks/blocks/google_drive.ts
index 18e709cff6d..f6aec85be9a 100644
--- a/apps/sim/blocks/blocks/google_drive.ts
+++ b/apps/sim/blocks/blocks/google_drive.ts
@@ -5,7 +5,9 @@ import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
isToolCall,
+ mapperOperation,
normalizeFileInput,
+ parseOptionalBooleanInput,
SERVICE_ACCOUNT_SUBBLOCKS,
toolCallArg,
} from '@/blocks/utils'
@@ -1591,13 +1593,17 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
shareExpirationTime,
shareAllowFileDiscovery,
shareMoveToNewOwnersRoot,
+ fileId,
+ folderId,
+ destinationFolderId,
...rest
} = params
+ const operation = mapperOperation(params, context)
const normalizedFile = normalizeFileInput(file, { single: true })
let effectiveFolderId: string | undefined
- switch (params.operation) {
+ switch (operation) {
case 'create_file':
case 'upload':
effectiveFolderId = uploadFolderId?.trim() || undefined
@@ -1611,7 +1617,7 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
}
let effectiveFileId: string | undefined
- switch (params.operation) {
+ switch (operation) {
case 'download':
effectiveFileId = downloadFileId?.trim() || undefined
break
@@ -1669,69 +1675,53 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
}
let effectiveDestinationFolderId: string | undefined
- if (params.operation === 'copy') {
+ if (operation === 'copy') {
effectiveDestinationFolderId = copyDestFolderId?.trim() || undefined
- } else if (params.operation === 'move') {
+ } else if (operation === 'move') {
effectiveDestinationFolderId = moveDestFolderId?.trim() || undefined
}
- const starredValue = starred === 'true' ? true : starred === 'false' ? false : undefined
-
- const sendNotificationValue =
- sendNotification === 'true' ? true : sendNotification === 'false' ? false : undefined
-
- const removeFromCurrentValue =
- removeFromCurrent === 'true' ? true : removeFromCurrent === 'false' ? false : undefined
-
- const includeRevisionsValue =
- includeRevisions === 'true' ? true : includeRevisions === 'false' ? false : undefined
-
- const includeDeletedValue =
- includeDeleted === 'true' ? true : includeDeleted === 'false' ? false : undefined
+ const starredValue = parseOptionalBooleanInput(starred)
+ const sendNotificationValue = parseOptionalBooleanInput(sendNotification)
+ const removeFromCurrentValue = parseOptionalBooleanInput(removeFromCurrent)
+ const includeRevisionsValue = parseOptionalBooleanInput(includeRevisions)
+ const includeDeletedValue = parseOptionalBooleanInput(includeDeleted)
let effectivePageSize: string | undefined = pageSize
// `pageSize`, `pageToken` and `query` are List's fields; other operations trust them only from a tool call
const agentPageSize = toolCallArg(context, pageSize)
- if (params.operation === 'search') effectivePageSize = searchPageSize || agentPageSize
- else if (params.operation === 'list_revisions')
+ if (operation === 'search') effectivePageSize = searchPageSize || agentPageSize
+ else if (operation === 'list_revisions')
effectivePageSize = revisionsPageSize || agentPageSize
- else if (params.operation === 'list_comments')
+ else if (operation === 'list_comments')
effectivePageSize = commentsPageSize || agentPageSize
- else if (params.operation === 'list_permissions')
+ else if (operation === 'list_permissions')
effectivePageSize = permissionsPageSize || agentPageSize
const agentPageToken = toolCallArg(context, pageToken)
let effectivePageToken: string | undefined = pageToken
- if (params.operation === 'search') effectivePageToken = searchPageToken || agentPageToken
- else if (params.operation === 'list_permissions')
+ if (operation === 'search') effectivePageToken = searchPageToken || agentPageToken
+ else if (operation === 'list_permissions')
effectivePageToken = permissionsPageToken || agentPageToken
- else if (params.operation === 'list_revisions')
+ else if (operation === 'list_revisions')
effectivePageToken = revisionsPageToken || agentPageToken
- else if (params.operation === 'list_comments')
+ else if (operation === 'list_comments')
effectivePageToken = commentsPageToken || agentPageToken
- else if (params.operation !== 'list') effectivePageToken = agentPageToken
+ else if (operation !== 'list') effectivePageToken = agentPageToken
const effectiveQuery =
- params.operation === 'search'
+ operation === 'search'
? isToolCall(context) && !searchQuery
? query
: searchQuery
: query
const effectiveOrderBy =
- params.operation === 'list'
- ? listOrderBy
- : params.operation === 'search'
- ? searchOrderBy
- : undefined
+ operation === 'list' ? listOrderBy : operation === 'search' ? searchOrderBy : undefined
const effectiveDriveId =
- params.operation === 'list'
- ? listDriveId
- : params.operation === 'search'
- ? searchDriveId
- : undefined
+ operation === 'list' ? listDriveId : operation === 'search' ? searchDriveId : undefined
- const isShare = params.operation === 'share'
+ const isShare = operation === 'share'
const isUserOrGroupShare = isShare && (shareType === 'user' || shareType === 'group')
const isDomainOrAnyoneShare = isShare && (shareType === 'domain' || shareType === 'anyone')
const allowFileDiscoveryValue = !isDomainOrAnyoneShare
@@ -1748,17 +1738,17 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
? true
: undefined
const effectiveMimeType =
- params.operation === 'get_content'
- ? getContentExportMimeType
- : params.operation === 'export'
- ? exportMimeType
+ operation === 'get_content'
+ ? getContentExportMimeType || toolCallArg(context, mimeType)
+ : operation === 'export'
+ ? exportMimeType || toolCallArg(context, mimeType)
: mimeType
return {
oauthCredential,
- folderId: effectiveFolderId,
- fileId: effectiveFileId,
- destinationFolderId: effectiveDestinationFolderId,
+ folderId: effectiveFolderId || folderId,
+ fileId: effectiveFileId || fileId,
+ destinationFolderId: effectiveDestinationFolderId || destinationFolderId,
file: normalizedFile,
pageSize: effectivePageSize
? Number.parseInt(effectivePageSize as string, 10)
@@ -1776,7 +1766,7 @@ Return ONLY the comment text - no explanations, no quotes, no extra formatting.`
orderBy: effectiveOrderBy?.trim() || undefined,
driveId: effectiveDriveId?.trim() || undefined,
startModifiedTime:
- params.operation === 'list_comments'
+ operation === 'list_comments'
? commentsStartModifiedTime?.trim() || undefined
: undefined,
expirationTime: isUserOrGroupShare ? shareExpirationTime?.trim() || undefined : undefined,
diff --git a/apps/sim/blocks/blocks/google_forms.test.ts b/apps/sim/blocks/blocks/google_forms.test.ts
new file mode 100644
index 00000000000..db62f9cfbad
--- /dev/null
+++ b/apps/sim/blocks/blocks/google_forms.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+import { GoogleFormsBlock } from '@/blocks/blocks/google_forms'
+
+/**
+ * On an agent tool call the operation arrives only in `context`, never in the stored row params.
+ */
+describe('GoogleFormsBlock agent tool calls', () => {
+ it('maps a get_responses call instead of rejecting the missing params operation', () => {
+ const inputs = { oauthCredential: 'cred-1', formId: ' form-1 ', pageSize: 5 }
+ const mapped = GoogleFormsBlock.tools.config?.params?.(inputs, { operation: 'get_responses' })
+ expect(mapped).toMatchObject({ formId: 'form-1', pageSize: 5 })
+ })
+
+ it.each([
+ { operation: 'create_form', inputs: { documentTitle: 'd' }, missing: 'title' },
+ { operation: 'create_watch', inputs: { formId: 'f', topicName: 't' }, missing: 'eventType' },
+ {
+ operation: 'create_watch',
+ inputs: { formId: 'f', eventType: 'RESPONSES' },
+ missing: 'topicName',
+ },
+ { operation: 'delete_watch', inputs: { formId: 'f' }, missing: 'watchId' },
+ { operation: 'renew_watch', inputs: { formId: 'f' }, missing: 'watchId' },
+ ])(
+ 'leaves a $missing the model omitted on $operation for the required-param check',
+ ({ operation, inputs, missing }) => {
+ const mapped = GoogleFormsBlock.tools.config?.params?.(
+ { oauthCredential: 'cred-1', ...inputs },
+ { operation }
+ )
+ expect(mapped?.[missing]).toBeUndefined()
+ }
+ )
+})
diff --git a/apps/sim/blocks/blocks/google_forms.ts b/apps/sim/blocks/blocks/google_forms.ts
index 4ee9fe1a337..8761fed0e0f 100644
--- a/apps/sim/blocks/blocks/google_forms.ts
+++ b/apps/sim/blocks/blocks/google_forms.ts
@@ -2,7 +2,7 @@ import { GoogleFormsIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
-import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
+import { mapperOperation, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/*
@@ -314,10 +314,9 @@ Example for "Add a required multiple choice question about favorite color":
throw new Error(`Invalid Google Forms operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
const {
oauthCredential,
- operation,
formId, // Canonical param from formSelector (basic) or manualFormId (advanced)
responseId,
pageSize,
@@ -336,6 +335,7 @@ Example for "Add a required multiple choice question about favorite color":
...rest
} = params
+ const operation = mapperOperation(params, context)
const baseParams = { ...rest, oauthCredential }
const effectiveFormId = formId ? String(formId).trim() : undefined
@@ -355,7 +355,7 @@ Example for "Add a required multiple choice question about favorite color":
case 'create_form':
return {
...baseParams,
- title: String(title).trim(),
+ title: title == null ? undefined : String(title).trim(),
documentTitle: documentTitle ? String(documentTitle).trim() : undefined,
unpublished: unpublished ?? false,
}
@@ -377,8 +377,8 @@ Example for "Add a required multiple choice question about favorite color":
return {
...baseParams,
formId: effectiveFormId,
- eventType: String(eventType),
- topicName: String(topicName).trim(),
+ eventType: eventType == null ? undefined : String(eventType),
+ topicName: topicName == null ? undefined : String(topicName).trim(),
watchId: watchId ? String(watchId).trim() : undefined,
}
case 'delete_watch':
@@ -386,7 +386,7 @@ Example for "Add a required multiple choice question about favorite color":
return {
...baseParams,
formId: effectiveFormId,
- watchId: String(watchId).trim(),
+ watchId: watchId == null ? undefined : String(watchId).trim(),
}
default:
throw new Error(`Invalid Google Forms operation: ${operation}`)
diff --git a/apps/sim/blocks/blocks/google_groups.test.ts b/apps/sim/blocks/blocks/google_groups.test.ts
index 8889b65fa97..0b48c760cb8 100644
--- a/apps/sim/blocks/blocks/google_groups.test.ts
+++ b/apps/sim/blocks/blocks/google_groups.test.ts
@@ -47,8 +47,16 @@ describe('GoogleGroupsBlock update settings', () => {
describe('GoogleGroupsBlock agent tool calls', () => {
it('keeps the model orderBy on list_groups when no sort order is chosen', () => {
- const inputs = { operation: 'list_groups', customer: 'my_customer', orderBy: 'email' }
+ const inputs = { customer: 'my_customer', orderBy: 'email' }
const mapped = GoogleGroupsBlock.tools.config?.params?.(inputs, { operation: 'list_groups' })
expect({ ...inputs, ...mapped }.orderBy).toBe('email')
})
+
+ it.each([
+ ['update_group', { groupKey: 'team@example.com', name: 'Team', email: 'new@example.com' }],
+ ['add_member', { groupKey: 'team@example.com', email: 'member@example.com', role: 'MEMBER' }],
+ ])('keeps the model name and email on %s', (operation, inputs) => {
+ const mapped = GoogleGroupsBlock.tools.config?.params?.(inputs, { operation })
+ expect({ ...inputs, ...mapped }).toMatchObject(inputs)
+ })
})
diff --git a/apps/sim/blocks/blocks/google_groups.ts b/apps/sim/blocks/blocks/google_groups.ts
index 5948e35f745..7b27a75b608 100644
--- a/apps/sim/blocks/blocks/google_groups.ts
+++ b/apps/sim/blocks/blocks/google_groups.ts
@@ -2,7 +2,7 @@ import { GoogleGroupsIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { SERVICE_ACCOUNT_SUBBLOCKS, toolCallArg } from '@/blocks/utils'
+import { mapperOperation, SERVICE_ACCOUNT_SUBBLOCKS, toolCallArg } from '@/blocks/utils'
/** Settings the Update Settings operation forwards when set; empty means unchanged. */
const UPDATE_SETTINGS_FIELDS = [
@@ -727,9 +727,9 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
}
},
params: (params, context) => {
- const { oauthCredential, operation, ...rest } = params
+ const { oauthCredential, ...rest } = params
- switch (operation) {
+ switch (mapperOperation(params, context)) {
case 'list_groups':
return {
oauthCredential,
@@ -759,8 +759,8 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
return {
oauthCredential,
groupKey: rest.groupKey,
- name: rest.newName,
- email: rest.newEmail,
+ name: rest.newName ?? toolCallArg(context, rest.name),
+ email: rest.newEmail ?? toolCallArg(context, rest.email),
description: rest.description,
}
case 'list_members':
@@ -786,7 +786,7 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
return {
oauthCredential,
groupKey: rest.groupKey,
- email: rest.memberEmail,
+ email: rest.memberEmail ?? toolCallArg(context, rest.email),
role: rest.role,
}
case 'update_member':
diff --git a/apps/sim/blocks/blocks/google_maps.test.ts b/apps/sim/blocks/blocks/google_maps.test.ts
new file mode 100644
index 00000000000..46cc107705a
--- /dev/null
+++ b/apps/sim/blocks/blocks/google_maps.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from 'vitest'
+import { GoogleMapsBlock } from '@/blocks/blocks/google_maps'
+
+/**
+ * On an agent tool call the model supplies args under the tool's own param names (`lat`, `lng`,
+ * `address`, arrays for JSON params), not the block's dedicated fields.
+ */
+describe('GoogleMapsBlock agent tool calls', () => {
+ it.each([
+ ['reverse_geocode', { lat: 40.7128, lng: -74.006 }],
+ ['validate_address', { address: '1600 Amphitheatre Pkwy', regionCode: 'US' }],
+ ['distance_matrix', { origin: 'Boston', destinations: ['New York', 'Albany'] }],
+ ['places_nearby', { lat: 1, lng: 2, radius: 500, includedTypes: ['cafe'] }],
+ ['speed_limits', { placeIds: ['place-1'], units: 'MPH' }],
+ ])('keeps the model args on %s', (operation, inputs) => {
+ const mapped = GoogleMapsBlock.tools.config?.params?.(inputs, { operation })
+ expect({ ...inputs, ...mapped }).toMatchObject(inputs)
+ })
+})
diff --git a/apps/sim/blocks/blocks/google_maps.ts b/apps/sim/blocks/blocks/google_maps.ts
index 4daaa4025dd..86eacb433ca 100644
--- a/apps/sim/blocks/blocks/google_maps.ts
+++ b/apps/sim/blocks/blocks/google_maps.ts
@@ -1,6 +1,7 @@
import { GoogleMapsIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
export const GoogleMapsBlock: BlockConfig = {
type: 'google_maps',
@@ -582,8 +583,9 @@ export const GoogleMapsBlock: BlockConfig = {
],
config: {
tool: (params) => `google_maps_${params.operation}`,
- params: (params) => {
- const { operation, locationBias, addressToValidate, ...rest } = params
+ params: (params, context) => {
+ const { locationBias, addressToValidate, ...rest } = params
+ const operation = mapperOperation(params, context)
let location: { lat: number; lng: number } | undefined
if (locationBias && typeof locationBias === 'string' && locationBias.includes(',')) {
@@ -617,6 +619,8 @@ export const GoogleMapsBlock: BlockConfig = {
let destinations: string[] | undefined
if (params.destinations && typeof params.destinations === 'string') {
destinations = params.destinations.split('|').map((d: string) => d.trim())
+ } else if (Array.isArray(params.destinations)) {
+ destinations = toolCallArg(context, params.destinations)
}
let waypoints: string[] | undefined
@@ -625,6 +629,8 @@ export const GoogleMapsBlock: BlockConfig = {
.split('|')
.map((w: string) => w.trim())
.filter(Boolean)
+ } else if (Array.isArray(params.waypoints)) {
+ waypoints = toolCallArg(context, params.waypoints)
}
let radius: number | undefined
@@ -639,6 +645,8 @@ export const GoogleMapsBlock: BlockConfig = {
.split('|')
.map((p: string) => p.trim())
.filter(Boolean)
+ } else if (Array.isArray(params.placeIds)) {
+ placeIds = toolCallArg(context, params.placeIds)
}
let wifiAccessPoints: unknown[] | undefined
@@ -648,6 +656,8 @@ export const GoogleMapsBlock: BlockConfig = {
} catch {
// Ignore parse errors
}
+ } else if (Array.isArray(params.wifiAccessPoints)) {
+ wifiAccessPoints = toolCallArg(context, params.wifiAccessPoints)
}
let cellTowers: unknown[] | undefined
@@ -657,9 +667,14 @@ export const GoogleMapsBlock: BlockConfig = {
} catch {
// Ignore parse errors
}
+ } else if (Array.isArray(params.cellTowers)) {
+ cellTowers = toolCallArg(context, params.cellTowers)
}
- const address = operation === 'validate_address' ? addressToValidate : params.address
+ const address =
+ operation === 'validate_address'
+ ? (addressToValidate ?? toolCallArg(context, params.address))
+ : params.address
// Parse boolean switches (can come as string or boolean from form)
let interpolate: boolean | undefined
@@ -710,9 +725,9 @@ export const GoogleMapsBlock: BlockConfig = {
return {
...rest,
address,
- location,
- lat,
- lng,
+ location: location ?? toolCallArg(context, params.location),
+ lat: lat ?? toolCallArg(context, params.lat),
+ lng: lng ?? toolCallArg(context, params.lng),
timestamp,
destinations,
waypoints,
@@ -729,11 +744,16 @@ export const GoogleMapsBlock: BlockConfig = {
homeMobileCountryCode,
homeMobileNetworkCode,
requiredQuality: params.requiredQuality || undefined,
- type: params.placeType || undefined,
- includedTypes: params.placeType ? [params.placeType] : undefined,
+ type: params.placeType || toolCallArg(context, params.type) || undefined,
+ includedTypes: params.placeType
+ ? [params.placeType]
+ : toolCallArg(context, params.includedTypes),
avoid: params.avoid || undefined,
radioType: params.radioType || undefined,
- units: operation === 'speed_limits' ? params.speedUnits || undefined : params.units,
+ units:
+ operation === 'speed_limits'
+ ? params.speedUnits || toolCallArg(context, params.units) || undefined
+ : params.units,
}
},
},
diff --git a/apps/sim/blocks/blocks/google_sheets.test.ts b/apps/sim/blocks/blocks/google_sheets.test.ts
new file mode 100644
index 00000000000..19531b45bd0
--- /dev/null
+++ b/apps/sim/blocks/blocks/google_sheets.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from 'vitest'
+import { GoogleSheetsV2Block } from '@/blocks/blocks/google_sheets'
+
+/**
+ * On an agent tool call the operation arrives only in `context`, and the model supplies args under
+ * the tool's own param names with JSON params already parsed.
+ */
+describe('GoogleSheetsV2Block agent tool calls', () => {
+ it.each([
+ ['delete_sheet', { spreadsheetId: 'ss-1', sheetId: 42 }],
+ ['delete_rows', { spreadsheetId: 'ss-1', sheetId: 42, startIndex: 0, endIndex: 3 }],
+ ['copy_sheet', { sourceSpreadsheetId: 'ss-1', sheetId: 42, destinationSpreadsheetId: 'ss-2' }],
+ ['batch_get', { spreadsheetId: 'ss-1', ranges: ['Sheet1!A1:B2'], majorDimension: 'COLUMNS' }],
+ ['batch_update', { spreadsheetId: 'ss-1', data: [{ range: 'Sheet1!A1', values: [['x']] }] }],
+ ['create', { title: 'Budget', sheetTitles: ['Q1', 'Q2'] }],
+ ['read', { spreadsheetId: 'ss-1', sheetName: 'Sheet1', majorDimension: 'COLUMNS' }],
+ [
+ 'append',
+ { spreadsheetId: 'ss-1', sheetName: 'Sheet1', values: [['a']], valueInputOption: 'RAW' },
+ ],
+ ])('keeps the model args on %s', (operation, inputs) => {
+ const mapped = GoogleSheetsV2Block.tools.config?.params?.(inputs, { operation })
+ expect({ ...inputs, ...mapped }).toMatchObject(inputs)
+ })
+})
diff --git a/apps/sim/blocks/blocks/google_sheets.ts b/apps/sim/blocks/blocks/google_sheets.ts
index 5563dbae06e..0a88a693b95 100644
--- a/apps/sim/blocks/blocks/google_sheets.ts
+++ b/apps/sim/blocks/blocks/google_sheets.ts
@@ -2,7 +2,13 @@ import { GoogleSheetsIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
+import {
+ createVersionedToolSelector,
+ isToolCall,
+ mapperOperation,
+ SERVICE_ACCOUNT_SUBBLOCKS,
+ toolCallArg,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/**
@@ -927,7 +933,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
suffix: '_v2',
fallbackToolId: 'google_sheets_read_v2',
}),
- params: (params) => {
+ params: (params, context) => {
const {
oauthCredential,
values,
@@ -951,12 +957,19 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
...rest
} = params
- const operation = params.operation as string
+ const operation = mapperOperation(params, context)
+
+ /** A model sends JSON-typed tool params already parsed; the canvas sends JSON text. */
+ const parseJsonInput = (value: unknown) =>
+ typeof value !== 'string' && isToolCall(context) ? value : JSON.parse(value as string)
if (operation === 'create') {
- const sheetTitlesArray = sheetTitles
- ? (sheetTitles as string).split(',').map((s: string) => s.trim())
- : undefined
+ const sheetTitlesArray =
+ Array.isArray(sheetTitles) && isToolCall(context)
+ ? sheetTitles
+ : sheetTitles
+ ? (sheetTitles as string).split(',').map((s: string) => s.trim())
+ : undefined
return {
title: (title as string)?.trim(),
sheetTitles: sheetTitlesArray,
@@ -964,7 +977,10 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
}
- const effectiveSpreadsheetId = spreadsheetId ? String(spreadsheetId).trim() : ''
+ const rawSpreadsheetId =
+ spreadsheetId ||
+ (operation === 'copy_sheet' ? toolCallArg(context, rest.sourceSpreadsheetId) : undefined)
+ const effectiveSpreadsheetId = rawSpreadsheetId ? String(rawSpreadsheetId).trim() : ''
if (!effectiveSpreadsheetId) {
throw new Error('Spreadsheet ID is required.')
@@ -978,7 +994,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
if (operation === 'batch_get') {
- const parsedRanges = ranges ? JSON.parse(ranges as string) : []
+ const parsedRanges = ranges ? parseJsonInput(ranges) : []
return {
spreadsheetId: effectiveSpreadsheetId,
ranges: parsedRanges,
@@ -992,7 +1008,9 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
if (operation === 'batch_update') {
- const parsedData = batchData ? JSON.parse(batchData as string) : []
+ const parsedData = batchData
+ ? JSON.parse(batchData as string)
+ : (toolCallArg(context, rest.data) ?? [])
return {
...rest,
spreadsheetId: effectiveSpreadsheetId,
@@ -1002,7 +1020,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
if (operation === 'batch_clear') {
- const parsedRanges = ranges ? JSON.parse(ranges as string) : []
+ const parsedRanges = ranges ? parseJsonInput(ranges) : []
return {
spreadsheetId: effectiveSpreadsheetId,
ranges: parsedRanges,
@@ -1027,7 +1045,10 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
if (operation === 'delete_sheet') {
- const parsedSheetId = Number.parseInt(deleteSheetId as string, 10)
+ const parsedSheetId = Number.parseInt(
+ (deleteSheetId ?? toolCallArg(context, sheetId)) as string,
+ 10
+ )
if (Number.isNaN(parsedSheetId)) {
throw new Error('Sheet ID must be a valid number')
}
@@ -1039,7 +1060,10 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
}
if (operation === 'delete_rows') {
- const parsedSheetId = Number.parseInt(deleteSheetId as string, 10)
+ const parsedSheetId = Number.parseInt(
+ (deleteSheetId ?? toolCallArg(context, sheetId)) as string,
+ 10
+ )
const parsedStartIndex = Number.parseInt(startIndex as string, 10)
const parsedEndIndex = Number.parseInt(endIndex as string, 10)
if (
@@ -1064,7 +1088,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
throw new Error('Sheet name is required. Please select or enter a sheet name.')
}
- const parsedValues = values ? JSON.parse(values as string) : undefined
+ const parsedValues = values ? parseJsonInput(values) : undefined
return {
...rest,
@@ -1079,9 +1103,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
: {}),
...(filterMatchType ? { filterMatchType: filterMatchType as string } : {}),
...(operation === 'append'
- ? { valueInputOption: appendValueInputOption || undefined }
+ ? {
+ valueInputOption:
+ appendValueInputOption ||
+ toolCallArg(context, rest.valueInputOption) ||
+ undefined,
+ }
: {}),
- majorDimension: undefined,
+ majorDimension: operation === 'read' ? toolCallArg(context, majorDimension) : undefined,
}
},
},
diff --git a/apps/sim/blocks/blocks/google_slides.test.ts b/apps/sim/blocks/blocks/google_slides.test.ts
new file mode 100644
index 00000000000..2910f1f6563
--- /dev/null
+++ b/apps/sim/blocks/blocks/google_slides.test.ts
@@ -0,0 +1,96 @@
+import { describe, expect, it } from 'vitest'
+import { GoogleSlidesBlock, GoogleSlidesV2Block } from '@/blocks/blocks/google_slides'
+import type { BlockConfig, BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(
+ block: BlockConfig,
+ params: Record,
+ context?: BlockToolParamsContext
+) {
+ const mapper = block.tools.config?.params
+ if (!mapper) throw new Error(`${block.type} has no params mapper`)
+ return mapper(params, context)
+}
+
+describe('Google Slides agent tool calls', () => {
+ it('forwards the model slide index for write', () => {
+ const mapped = mapParams(
+ GoogleSlidesV2Block,
+ { presentationId: 'p1', content: 'Hello', slideIndex: 2 },
+ { operation: 'write' }
+ )
+ expect(mapped.slideIndex).toBe(2)
+ })
+
+ it('forwards the model folder for create and copy', () => {
+ expect(
+ mapParams(GoogleSlidesV2Block, { title: 'Deck', folderId: 'f1' }, { operation: 'create' })
+ .folderId
+ ).toBe('f1')
+ expect(
+ mapParams(
+ GoogleSlidesV2Block,
+ { sourcePresentationId: 'src', title: 'Copy', folderId: 'f2' },
+ { operation: 'copy_presentation' }
+ ).folderId
+ ).toBe('f2')
+ })
+
+ it('keeps the model object id instead of the empty block field', () => {
+ const mapped = mapParams(
+ GoogleSlidesV2Block,
+ { presentationId: 'p1', objectId: 'shape_1' },
+ { operation: 'delete_object' }
+ )
+ expect(mapped.objectId).toBe('shape_1')
+ })
+
+ it('keeps the model z-order enum in the tool operation param', () => {
+ const mapped = mapParams(
+ GoogleSlidesV2Block,
+ { presentationId: 'p1', objectIds: 'a,b', operation: 'SEND_TO_BACK' },
+ { operation: 'update_page_elements_z_order' }
+ )
+ expect(mapped.operation).toBe('SEND_TO_BACK')
+ })
+
+ it('accepts a model image URL for add_image without an uploaded file', () => {
+ const mapped = mapParams(
+ GoogleSlidesV2Block,
+ { presentationId: 'p1', pageObjectId: 's1', imageUrl: 'https://example.com/a.png' },
+ { operation: 'add_image' }
+ )
+ expect(mapped.imageUrl).toBe('https://example.com/a.png')
+ })
+})
+
+describe('Google Slides canvas', () => {
+ it('never sends the block operation name as the z-order enum', () => {
+ const mapped = mapParams(GoogleSlidesV2Block, {
+ operation: 'update_page_elements_z_order',
+ presentationId: 'p1',
+ zOrderObjectIds: 'a',
+ })
+ expect(mapped.operation).toBeUndefined()
+ })
+
+ it('sends the legacy image source as the image URL', () => {
+ const mapped = mapParams(GoogleSlidesBlock, {
+ operation: 'add_image',
+ presentationId: 'p1',
+ pageObjectId: 's1',
+ imageSource: 'https://example.com/a.png',
+ })
+ expect(mapped.imageUrl).toBe('https://example.com/a.png')
+ })
+
+ it('extracts the URL from a referenced file serialized into the legacy image source', () => {
+ const mapped = mapParams(GoogleSlidesBlock, {
+ operation: 'add_image',
+ presentationId: 'p1',
+ pageObjectId: 's1',
+ imageSource: JSON.stringify({ name: 'a.png', url: 'https://files.example.com/a.png' }),
+ })
+ expect(mapped.imageUrl).toBe('https://files.example.com/a.png')
+ })
+})
diff --git a/apps/sim/blocks/blocks/google_slides.ts b/apps/sim/blocks/blocks/google_slides.ts
index f58dcaf077b..328bbd22d36 100644
--- a/apps/sim/blocks/blocks/google_slides.ts
+++ b/apps/sim/blocks/blocks/google_slides.ts
@@ -4,7 +4,13 @@ import { getScopesForService } from '@/lib/oauth/utils'
import { resolveHttpsUrlFromFileInput } from '@/lib/uploads/utils/file'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
+import {
+ isToolCall,
+ mapperOperation,
+ normalizeFileInput,
+ SERVICE_ACCOUNT_SUBBLOCKS,
+ toolCallArg,
+} from '@/blocks/utils'
const PRESENTATION_FIELD = ['presentationId', 'manualPresentationId'] as const
const SOURCE_PRESENTATION_FIELD = [
@@ -2690,7 +2696,17 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
throw new Error(`Invalid Google Slides operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ /**
+ * The block field on the canvas. On a tool call a blank block field falls back to the
+ * model's arg, which arrives under the tool's param name.
+ */
+ const orModelArg = (blockValue: unknown, modelArg: unknown): unknown =>
+ isToolCall(context) &&
+ (blockValue === undefined || blockValue === null || blockValue === '')
+ ? modelArg
+ : blockValue
const {
oauthCredential,
presentationId,
@@ -2712,22 +2728,32 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
oauthCredential,
}
- if (params.operation === 'write' && slideIndex) {
+ if (operation === 'write' && slideIndex) {
result.slideIndex = Number.parseInt(slideIndex as string, 10)
}
- if (params.operation === 'create') {
+ if (operation === 'create') {
result.folderId = effectiveFolderId || undefined
if (createContent) {
result.content = createContent
}
}
- if (params.operation === 'add_slide' && params.insertionIndex) {
+ if (operation === 'add_slide' && params.insertionIndex) {
result.insertionIndex = Number.parseInt(params.insertionIndex as string, 10)
}
- if (params.operation === 'add_image') {
+ if (operation === 'add_image') {
+ const source = params.imageSource
+ if (source) {
+ const fileObject = normalizeFileInput(source, { single: true })
+ if (fileObject) {
+ const fileUrl = resolveHttpsUrlFromFileInput(fileObject)
+ if (fileUrl) result.imageUrl = fileUrl
+ } else if (typeof source === 'string') {
+ result.imageUrl = source.trim()
+ }
+ }
if (imageWidth) {
result.width = Number.parseInt(imageWidth as string, 10)
}
@@ -2742,34 +2768,34 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
}
}
- if (params.operation === 'get_thumbnail') {
- result.pageObjectId = thumbnailPageId
+ if (operation === 'get_thumbnail') {
+ result.pageObjectId = orModelArg(thumbnailPageId, params.pageObjectId)
}
- if (params.operation === 'get_page') {
- result.pageObjectId = params.getPageObjectId
+ if (operation === 'get_page') {
+ result.pageObjectId = orModelArg(params.getPageObjectId, params.pageObjectId)
}
- if (params.operation === 'delete_object') {
- result.objectId = params.deleteObjectId
+ if (operation === 'delete_object') {
+ result.objectId = orModelArg(params.deleteObjectId, params.objectId)
}
- if (params.operation === 'duplicate_object') {
- result.objectId = params.duplicateObjectId
+ if (operation === 'duplicate_object') {
+ result.objectId = orModelArg(params.duplicateObjectId, params.objectId)
if (params.duplicateObjectIds) {
result.objectIds = params.duplicateObjectIds
}
}
- if (params.operation === 'reorder_slides') {
- result.slideObjectIds = params.reorderSlideIds
+ if (operation === 'reorder_slides') {
+ result.slideObjectIds = orModelArg(params.reorderSlideIds, params.slideObjectIds)
if (params.reorderInsertionIndex) {
result.insertionIndex = Number.parseInt(params.reorderInsertionIndex as string, 10)
}
}
- if (params.operation === 'create_table') {
- result.pageObjectId = params.tablePageObjectId
+ if (operation === 'create_table') {
+ result.pageObjectId = orModelArg(params.tablePageObjectId, params.pageObjectId)
if (params.tableRows) {
result.rows = Number.parseInt(params.tableRows as string, 10)
}
@@ -2790,8 +2816,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
}
}
- if (params.operation === 'create_shape') {
- result.pageObjectId = params.shapePageObjectId
+ if (operation === 'create_shape') {
+ result.pageObjectId = orModelArg(params.shapePageObjectId, params.pageObjectId)
result.shapeType = params.shapeType
if (params.shapeWidth) {
result.width = Number.parseInt(params.shapeWidth as string, 10)
@@ -2807,9 +2833,9 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
}
}
- if (params.operation === 'insert_text') {
- result.objectId = params.insertTextObjectId
- result.text = params.insertTextContent
+ if (operation === 'insert_text') {
+ result.objectId = orModelArg(params.insertTextObjectId, params.objectId)
+ result.text = orModelArg(params.insertTextContent, params.text)
if (params.insertTextIndex) {
result.insertionIndex = Number.parseInt(params.insertTextIndex as string, 10)
}
@@ -2828,8 +2854,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
'create_paragraph_bullets',
'delete_paragraph_bullets',
])
- if (TEXT_RANGE_OPS.has(params.operation as string)) {
- result.objectId = params.textObjectId
+ if (TEXT_RANGE_OPS.has(operation)) {
+ result.objectId = orModelArg(params.textObjectId, params.objectId)
const rowIdx = toNum(params.textRowIndex)
const colIdx = toNum(params.textColumnIndex)
if (rowIdx !== undefined) result.rowIndex = rowIdx
@@ -2841,7 +2867,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (endIdx !== undefined) result.endIndex = endIdx
}
- if (params.operation === 'update_text_style') {
+ if (operation === 'update_text_style') {
if (params.textBold !== undefined) result.bold = params.textBold
if (params.textItalic !== undefined) result.italic = params.textItalic
if (params.textUnderline !== undefined) result.underline = params.textUnderline
@@ -2859,7 +2885,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.textStyleFields) result.fields = params.textStyleFields
}
- if (params.operation === 'update_paragraph_style') {
+ if (operation === 'update_paragraph_style') {
if (params.paragraphAlignment) result.alignment = params.paragraphAlignment
const ls = toNum(params.paragraphLineSpacing)
if (ls !== undefined) result.lineSpacing = ls
@@ -2879,13 +2905,13 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.paragraphStyleFields) result.fields = params.paragraphStyleFields
}
- if (params.operation === 'create_paragraph_bullets' && params.bulletPreset) {
+ if (operation === 'create_paragraph_bullets' && params.bulletPreset) {
result.bulletPreset = params.bulletPreset
}
- if (params.operation === 'replace_all_shapes_with_image') {
- result.imageUrl = params.replaceShapesImageUrl
- result.findText = params.replaceShapesFindText
+ if (operation === 'replace_all_shapes_with_image') {
+ result.imageUrl = orModelArg(params.replaceShapesImageUrl, rest.imageUrl)
+ result.findText = orModelArg(params.replaceShapesFindText, params.findText)
if (params.replaceShapesMatchCase !== undefined)
result.matchCase = params.replaceShapesMatchCase
if (params.replaceShapesImageMethod)
@@ -2894,14 +2920,14 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
result.pageObjectIds = params.replaceShapesPageObjectIds
}
- if (params.operation === 'replace_image') {
- result.imageObjectId = params.replaceImageObjectId
- result.imageUrl = params.replaceImageUrl
+ if (operation === 'replace_image') {
+ result.imageObjectId = orModelArg(params.replaceImageObjectId, params.imageObjectId)
+ result.imageUrl = orModelArg(params.replaceImageUrl, rest.imageUrl)
if (params.replaceImageMethod) result.imageReplaceMethod = params.replaceImageMethod
}
- if (params.operation === 'update_image_properties') {
- result.objectId = params.imagePropsObjectId
+ if (operation === 'update_image_properties') {
+ result.objectId = orModelArg(params.imagePropsObjectId, params.objectId)
const brightness = toNum(params.imageBrightness)
if (brightness !== undefined) result.brightness = brightness
const contrast = toNum(params.imageContrast)
@@ -2917,8 +2943,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.imagePropertiesFields) result.fields = params.imagePropertiesFields
}
- if (params.operation === 'update_shape_properties') {
- result.objectId = params.shapePropsObjectId
+ if (operation === 'update_shape_properties') {
+ result.objectId = orModelArg(params.shapePropsObjectId, params.objectId)
if (params.shapeFillColor) result.fillColor = params.shapeFillColor
const fillAlpha = toNum(params.shapeFillAlpha)
if (fillAlpha !== undefined) result.fillAlpha = fillAlpha
@@ -2935,8 +2961,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.shapePropertiesFields) result.fields = params.shapePropertiesFields
}
- if (params.operation === 'update_page_properties') {
- result.objectId = params.pagePropsObjectId
+ if (operation === 'update_page_properties') {
+ result.objectId = orModelArg(params.pagePropsObjectId, params.objectId)
if (params.pageBackgroundColor) result.backgroundColor = params.pageBackgroundColor
const bgAlpha = toNum(params.pageBackgroundAlpha)
if (bgAlpha !== undefined) result.backgroundAlpha = bgAlpha
@@ -2948,22 +2974,22 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.pagePropertiesFields) result.fields = params.pagePropertiesFields
}
- if (params.operation === 'update_slide_properties') {
- result.objectId = params.slidePropsObjectId
+ if (operation === 'update_slide_properties') {
+ result.objectId = orModelArg(params.slidePropsObjectId, params.objectId)
if (params.slideIsSkipped !== undefined) result.isSkipped = params.slideIsSkipped
if (params.slidePropertiesJson) result.propertiesJson = params.slidePropertiesJson
if (params.slidePropertiesFields) result.fields = params.slidePropertiesFields
}
- if (params.operation === 'update_page_element_alt_text') {
- result.objectId = params.altTextObjectId
+ if (operation === 'update_page_element_alt_text') {
+ result.objectId = orModelArg(params.altTextObjectId, params.objectId)
if (params.altTextTitle !== undefined) result.title = params.altTextTitle
if (params.altTextDescription !== undefined)
result.description = params.altTextDescription
}
- if (params.operation === 'update_page_element_transform') {
- result.objectId = params.transformObjectId
+ if (operation === 'update_page_element_transform') {
+ result.objectId = orModelArg(params.transformObjectId, params.objectId)
const sx = toNum(params.transformScaleX)
const sy = toNum(params.transformScaleY)
const shx = toNum(params.transformShearX)
@@ -2979,25 +3005,30 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.transformApplyMode) result.applyMode = params.transformApplyMode
}
- if (params.operation === 'update_page_elements_z_order') {
- result.objectIds = params.zOrderObjectIds
- // Always overwrite — even when zOrderOperation is empty — so the block-level
- // operation name 'update_page_elements_z_order' can never leak through as the
- // z-order enum value and produce a confusing API error.
- result.operation = params.zOrderOperation || undefined
+ if (operation === 'update_page_elements_z_order') {
+ result.objectIds = orModelArg(params.zOrderObjectIds, params.objectIds)
+ // The tool's z-order enum shares the block's `operation` key. On the canvas always
+ // overwrite it so the block operation name never reaches the API; on a tool call
+ // `rest` already holds the model's enum under the tool's own `operation` param.
+ if (params.zOrderOperation || !isToolCall(context)) {
+ Object.assign(result, { operation: params.zOrderOperation || undefined })
+ }
}
- if (params.operation === 'group_objects') {
- result.childrenObjectIds = params.groupChildrenObjectIds
+ if (operation === 'group_objects') {
+ result.childrenObjectIds = orModelArg(
+ params.groupChildrenObjectIds,
+ params.childrenObjectIds
+ )
if (params.groupObjectIdInput) result.groupObjectId = params.groupObjectIdInput
}
- if (params.operation === 'ungroup_objects') {
- result.objectIds = params.ungroupObjectIds
+ if (operation === 'ungroup_objects') {
+ result.objectIds = orModelArg(params.ungroupObjectIds, params.objectIds)
}
- if (params.operation === 'create_line') {
- result.pageObjectId = params.linePageObjectId
+ if (operation === 'create_line') {
+ result.pageObjectId = orModelArg(params.linePageObjectId, params.pageObjectId)
if (params.lineCategory) result.lineCategory = params.lineCategory
const lw = toNum(params.lineWidth)
const lh = toNum(params.lineHeight)
@@ -3009,8 +3040,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (lpy !== undefined) result.positionY = lpy
}
- if (params.operation === 'update_line_properties') {
- result.objectId = params.linePropsObjectId
+ if (operation === 'update_line_properties') {
+ result.objectId = orModelArg(params.linePropsObjectId, params.objectId)
if (params.lineColor) result.lineColor = params.lineColor
const lineWeight = toNum(params.lineWeight)
if (lineWeight !== undefined) result.lineWeight = lineWeight
@@ -3022,13 +3053,13 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.linePropertiesFields) result.fields = params.linePropertiesFields
}
- if (params.operation === 'update_line_category') {
- result.objectId = params.lineCategoryObjectId
+ if (operation === 'update_line_category') {
+ result.objectId = orModelArg(params.lineCategoryObjectId, params.objectId)
if (params.newLineCategory) result.lineCategory = params.newLineCategory
}
- if (params.operation === 'reroute_line') {
- result.objectId = params.rerouteLineObjectId
+ if (operation === 'reroute_line') {
+ result.objectId = orModelArg(params.rerouteLineObjectId, params.objectId)
}
const TABLE_CELL_REF_OPS = new Set([
@@ -3037,24 +3068,21 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
'delete_table_row',
'delete_table_column',
])
- if (TABLE_CELL_REF_OPS.has(params.operation as string)) {
- result.tableObjectId = params.tableTargetObjectId
+ if (TABLE_CELL_REF_OPS.has(operation)) {
+ result.tableObjectId = orModelArg(params.tableTargetObjectId, params.tableObjectId)
const rIdx = toNum(params.tableCellRowIndex)
const cIdx = toNum(params.tableCellColumnIndex)
if (rIdx !== undefined) result.rowIndex = rIdx
if (cIdx !== undefined) result.columnIndex = cIdx
}
- if (
- params.operation === 'insert_table_rows' ||
- params.operation === 'insert_table_columns'
- ) {
+ if (operation === 'insert_table_rows' || operation === 'insert_table_columns') {
const n = toNum(params.tableInsertNumber)
if (n !== undefined) result.number = n
}
- if (params.operation === 'insert_table_rows' && params.tableInsertBelow !== undefined) {
+ if (operation === 'insert_table_rows' && params.tableInsertBelow !== undefined) {
result.insertBelow = params.tableInsertBelow
}
- if (params.operation === 'insert_table_columns' && params.tableInsertRight !== undefined) {
+ if (operation === 'insert_table_columns' && params.tableInsertRight !== undefined) {
result.insertRight = params.tableInsertRight
}
@@ -3064,8 +3092,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
'update_table_cell_properties',
'update_table_border_properties',
])
- if (TABLE_RANGE_OPS.has(params.operation as string)) {
- result.objectId = params.tableRangeObjectId
+ if (TABLE_RANGE_OPS.has(operation)) {
+ result.objectId = orModelArg(params.tableRangeObjectId, params.objectId)
const rIdx = toNum(params.tableRangeRowIndex)
const cIdx = toNum(params.tableRangeColumnIndex)
const rSpan = toNum(params.tableRangeRowSpan)
@@ -3076,7 +3104,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (cSpan !== undefined) result.columnSpan = cSpan
}
- if (params.operation === 'update_table_cell_properties') {
+ if (operation === 'update_table_cell_properties') {
if (params.tableCellBackgroundColor)
result.backgroundColor = params.tableCellBackgroundColor
const cellAlpha = toNum(params.tableCellBackgroundAlpha)
@@ -3087,7 +3115,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.tableCellPropertiesFields) result.fields = params.tableCellPropertiesFields
}
- if (params.operation === 'update_table_border_properties') {
+ if (operation === 'update_table_border_properties') {
if (params.tableBorderPosition) result.borderPosition = params.tableBorderPosition
if (params.tableBorderColor) result.borderColor = params.tableBorderColor
const borderWeight = toNum(params.tableBorderWeight)
@@ -3098,8 +3126,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.tableBorderPropertiesFields) result.fields = params.tableBorderPropertiesFields
}
- if (params.operation === 'update_table_column_properties') {
- result.objectId = params.tableColumnPropsObjectId
+ if (operation === 'update_table_column_properties') {
+ result.objectId = orModelArg(params.tableColumnPropsObjectId, params.objectId)
if (params.tableColumnIndices) result.columnIndices = params.tableColumnIndices
const colWidth = toNum(params.tableColumnWidth)
if (colWidth !== undefined) result.columnWidth = colWidth
@@ -3108,8 +3136,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.tableColumnPropertiesFields) result.fields = params.tableColumnPropertiesFields
}
- if (params.operation === 'update_table_row_properties') {
- result.objectId = params.tableRowPropsObjectId
+ if (operation === 'update_table_row_properties') {
+ result.objectId = orModelArg(params.tableRowPropsObjectId, params.objectId)
if (params.tableRowIndices) result.rowIndices = params.tableRowIndices
const minHeight = toNum(params.tableMinRowHeight)
if (minHeight !== undefined) result.minRowHeight = minHeight
@@ -3117,8 +3145,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.tableRowPropertiesFields) result.fields = params.tableRowPropertiesFields
}
- if (params.operation === 'create_sheets_chart') {
- result.pageObjectId = params.chartPageObjectId
+ if (operation === 'create_sheets_chart') {
+ result.pageObjectId = orModelArg(params.chartPageObjectId, params.pageObjectId)
if (params.chartSpreadsheetId) result.spreadsheetId = params.chartSpreadsheetId
const cId = toNum(params.chartId)
if (cId !== undefined) result.chartId = cId
@@ -3133,15 +3161,15 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (cpy !== undefined) result.positionY = cpy
}
- if (params.operation === 'refresh_sheets_chart') {
- result.objectId = params.refreshChartObjectId
+ if (operation === 'refresh_sheets_chart') {
+ result.objectId = orModelArg(params.refreshChartObjectId, params.objectId)
}
- if (params.operation === 'replace_all_shapes_with_sheets_chart') {
+ if (operation === 'replace_all_shapes_with_sheets_chart') {
if (params.chartSpreadsheetId) result.spreadsheetId = params.chartSpreadsheetId
const cId = toNum(params.chartId)
if (cId !== undefined) result.chartId = cId
- result.findText = params.replaceShapesChartFindText
+ result.findText = orModelArg(params.replaceShapesChartFindText, params.findText)
if (params.replaceShapesChartMatchCase !== undefined)
result.matchCase = params.replaceShapesChartMatchCase
if (params.chartLinkingMode) result.linkingMode = params.chartLinkingMode
@@ -3149,8 +3177,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
result.pageObjectIds = params.replaceShapesChartPageObjectIds
}
- if (params.operation === 'create_video') {
- result.pageObjectId = params.videoPageObjectId
+ if (operation === 'create_video') {
+ result.pageObjectId = orModelArg(params.videoPageObjectId, params.pageObjectId)
if (params.videoSource) result.source = params.videoSource
if (params.videoId) result.videoId = params.videoId
const vw = toNum(params.videoWidth)
@@ -3163,8 +3191,8 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (vpy !== undefined) result.positionY = vpy
}
- if (params.operation === 'update_video_properties') {
- result.objectId = params.videoPropsObjectId
+ if (operation === 'update_video_properties') {
+ result.objectId = orModelArg(params.videoPropsObjectId, params.objectId)
if (params.videoAutoPlay !== undefined) result.autoPlay = params.videoAutoPlay
if (params.videoMute !== undefined) result.mute = params.videoMute
const vStart = toNum(params.videoStart)
@@ -3179,15 +3207,16 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
if (params.videoPropertiesFields) result.fields = params.videoPropertiesFields
}
- if (params.operation === 'batch_update') {
+ if (operation === 'batch_update') {
if (params.requestsJson) result.requests = params.requestsJson
if (params.writeControlJson) result.writeControl = params.writeControlJson
}
- if (params.operation === 'copy_presentation') {
+ if (operation === 'copy_presentation') {
if (params.sourcePresentationId) result.sourcePresentationId = params.sourcePresentationId
if (params.copyTitle) result.title = params.copyTitle
if (params.copyFolderId) result.folderId = params.copyFolderId
+ else if (isToolCall(context) && effectiveFolderId) result.folderId = effectiveFolderId
result.presentationId = undefined
}
@@ -3599,15 +3628,16 @@ export const GoogleSlidesV2Block: BlockConfig = {
access: GoogleSlidesBlock.tools!.access,
config: {
tool: GoogleSlidesBlock.tools!.config!.tool,
- params: (params) => {
+ params: (params, context) => {
const baseParams = GoogleSlidesBlock.tools?.config?.params
if (!baseParams) {
return params
}
- if (params.operation === 'add_image') {
+ if (mapperOperation(params, context) === 'add_image') {
const fileObject = normalizeFileInput(params.imageFile, { single: true })
if (!fileObject) {
+ if (toolCallArg(context, params.imageUrl)) return baseParams(params, context)
throw new Error('Image file is required.')
}
const imageUrl = resolveHttpsUrlFromFileInput(fileObject)
@@ -3615,13 +3645,16 @@ export const GoogleSlidesV2Block: BlockConfig = {
throw new Error('Image file must include a https URL.')
}
- return baseParams({
- ...params,
- imageUrl,
- })
+ return baseParams(
+ {
+ ...params,
+ imageUrl,
+ },
+ context
+ )
}
- return baseParams(params)
+ return baseParams(params, context)
},
},
},
diff --git a/apps/sim/blocks/blocks/google_vault.test.ts b/apps/sim/blocks/blocks/google_vault.test.ts
index 9cb2b713243..634bf27e9e0 100644
--- a/apps/sim/blocks/blocks/google_vault.test.ts
+++ b/apps/sim/blocks/blocks/google_vault.test.ts
@@ -16,7 +16,7 @@ describe('GoogleVaultBlock includeSharedDrives', () => {
it.each(['create_matters_export', 'create_saved_query'])(
'keeps the model value on an agent %s call',
(operation) => {
- const inputs = { operation, matterId: 'm-1', corpus: 'DRIVE', includeSharedDrives: true }
+ const inputs = { matterId: 'm-1', corpus: 'DRIVE', includeSharedDrives: true }
expect(buildParams(inputs, { operation }).includeSharedDrives).toBe(true)
}
)
@@ -30,3 +30,13 @@ describe('GoogleVaultBlock includeSharedDrives', () => {
expect(buildParams(inputs).includeSharedDrives).toBe(false)
})
})
+
+/** A tool call carries its operation only in `context`, never in the stored row params. */
+describe('GoogleVaultBlock list_matters tool call', () => {
+ it('sends the Detail Level set on the agent tool row as view', () => {
+ const inputs = { matterView: 'FULL', matterState: 'OPEN' }
+ const params = buildParams(inputs, { operation: 'list_matters' })
+ expect(params.view).toBe('FULL')
+ expect(params.state).toBe('OPEN')
+ })
+})
diff --git a/apps/sim/blocks/blocks/google_vault.ts b/apps/sim/blocks/blocks/google_vault.ts
index a8823cb7f7c..6bb333ef239 100644
--- a/apps/sim/blocks/blocks/google_vault.ts
+++ b/apps/sim/blocks/blocks/google_vault.ts
@@ -3,7 +3,12 @@ import { GoogleVaultIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { parseOptionalBooleanInput, SERVICE_ACCOUNT_SUBBLOCKS, toolCallArg } from '@/blocks/utils'
+import {
+ mapperOperation,
+ parseOptionalBooleanInput,
+ SERVICE_ACCOUNT_SUBBLOCKS,
+ toolCallArg,
+} from '@/blocks/utils'
export const GoogleVaultBlock: BlockConfig = {
type: 'google_vault',
@@ -929,8 +934,9 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
dataScope,
...rest
} = params
+ const operation = mapperOperation(params, context)
const isQueryOperation =
- params.operation === 'create_matters_export' || params.operation === 'create_saved_query'
+ operation === 'create_matters_export' || operation === 'create_saved_query'
return {
...rest,
oauthCredential,
@@ -954,8 +960,8 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
...(listExportId && { exportId: listExportId }),
...(listHoldId && { holdId: listHoldId }),
...(listSavedQueryId && { savedQueryId: listSavedQueryId }),
- ...(params.operation === 'list_matters' && matterView && { view: matterView }),
- ...(params.operation === 'list_matters' && matterState && { state: matterState }),
+ ...(operation === 'list_matters' && matterView && { view: matterView }),
+ ...(operation === 'list_matters' && matterState && { state: matterState }),
...(isQueryOperation && {
includeSharedDrives:
exportIncludeSharedDrives == null
@@ -964,7 +970,7 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
: exportIncludeSharedDrives === true || exportIncludeSharedDrives === 'true',
...(dataScope && { dataScope }),
}),
- ...(params.operation === 'create_matters_export' && exportFormat && { exportFormat }),
+ ...(operation === 'create_matters_export' && exportFormat && { exportFormat }),
}
},
},
diff --git a/apps/sim/blocks/blocks/grafana.test.ts b/apps/sim/blocks/blocks/grafana.test.ts
new file mode 100644
index 00000000000..eac82d598dd
--- /dev/null
+++ b/apps/sim/blocks/blocks/grafana.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, it } from 'vitest'
+import { GrafanaBlock } from '@/blocks/blocks/grafana'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = GrafanaBlock.tools.config?.params
+ if (!mapper) throw new Error('Grafana block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Grafana tool calls', () => {
+ it('keeps the model folder UID and parent UID when moving a folder', () => {
+ const mapped = mapParams(
+ { folderUid: 'child', parentUid: 'parent' },
+ { operation: 'grafana_move_folder' }
+ )
+
+ expect(mapped).toMatchObject({ folderUid: 'child', parentUid: 'parent' })
+ })
+
+ it('keeps the model folder UID and rule group when reading an alert rule group', () => {
+ const mapped = mapParams(
+ { folderUid: 'folder-1', ruleGroup: 'cpu' },
+ { operation: 'grafana_get_alert_rule_group' }
+ )
+
+ expect(mapped).toMatchObject({ folderUid: 'folder-1', ruleGroup: 'cpu' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/grafana.ts b/apps/sim/blocks/blocks/grafana.ts
index e5811970090..cfb95065be8 100644
--- a/apps/sim/blocks/blocks/grafana.ts
+++ b/apps/sim/blocks/blocks/grafana.ts
@@ -1,7 +1,7 @@
import { GrafanaIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const GrafanaBlock: BlockConfig = {
type: 'grafana',
@@ -1110,9 +1110,9 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'grafana_list_dashboards':
if (params.page) result.page = Number(params.page)
if (params.limit) result.limit = Number(params.limit)
@@ -1144,17 +1144,17 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
if (params.contactPointSettings) result.settings = params.contactPointSettings
break
case 'grafana_query_data_source':
- result.queries = params.dataSourceQueries
+ result.queries = params.dataSourceQueries ?? toolCallArg(context, params.queries)
if (params.queryFrom) result.from = params.queryFrom
if (params.queryTo) result.to = params.queryTo
break
case 'grafana_move_folder':
- result.folderUid = params.manageFolderUid
- result.parentUid = params.newParentUid ?? ''
+ result.folderUid = params.manageFolderUid ?? toolCallArg(context, params.folderUid)
+ result.parentUid = params.newParentUid ?? toolCallArg(context, params.parentUid) ?? ''
break
case 'grafana_get_alert_rule_group':
- result.folderUid = params.manageFolderUid
- result.ruleGroup = params.ruleGroupName
+ result.folderUid = params.manageFolderUid ?? toolCallArg(context, params.folderUid)
+ result.ruleGroup = params.ruleGroupName ?? toolCallArg(context, params.ruleGroup)
break
case 'grafana_create_annotation':
if (params.annotationTags) result.tags = params.annotationTags
diff --git a/apps/sim/blocks/blocks/grain.test.ts b/apps/sim/blocks/blocks/grain.test.ts
new file mode 100644
index 00000000000..8d93892d126
--- /dev/null
+++ b/apps/sim/blocks/blocks/grain.test.ts
@@ -0,0 +1,29 @@
+/**
+ * Agent tool calls pass the operation in context and supply arguments under the tool's param
+ * names, which the mapper spreads over and must keep.
+ */
+import { describe, expect, it } from 'vitest'
+import { GrainV2Block } from '@/blocks/blocks/grain'
+
+function agentParams(operation: string, args: Record): Record {
+ return { ...args, ...(GrainV2Block.tools.config?.params?.(args, { operation }) ?? {}) }
+}
+
+describe('GrainV2Block agent tool calls', () => {
+ it('keeps the model include options when creating a webhook', () => {
+ const params = agentParams('grain_create_hook_v2', {
+ hookUrl: 'https://example.com/hook',
+ hookType: 'recording_added',
+ include: { participants: true },
+ })
+ expect(params.include).toEqual({ participants: true })
+ })
+
+ it('keeps the model event type and state filters when listing webhooks', () => {
+ const params = agentParams('grain_list_hooks_v2', {
+ hookType: 'highlight_added',
+ state: 'enabled',
+ })
+ expect(params).toMatchObject({ hookType: 'highlight_added', state: 'enabled' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/grain.ts b/apps/sim/blocks/blocks/grain.ts
index 4c5181114b4..fbcd860c004 100644
--- a/apps/sim/blocks/blocks/grain.ts
+++ b/apps/sim/blocks/blocks/grain.ts
@@ -2,7 +2,7 @@ import { omit } from '@sim/utils/object'
import { GrainIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
import { GRAIN_HOOK_TYPE_OPTIONS, grainTriggerOptions } from '@/triggers/grain/utils'
@@ -368,12 +368,12 @@ Return ONLY the search term - no explanations, no quotes, no extra text.`,
tool: (params) => {
return params.operation || 'grain_list_recordings'
},
- params: (params) => {
+ params: (params, context) => {
const baseParams: Record = {
apiKey: params.apiKey,
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'grain_list_recordings':
return {
...baseParams,
@@ -705,12 +705,12 @@ export const GrainV2Block: BlockConfig = {
tool: (params) => {
return params.operation || 'grain_list_recordings'
},
- params: (params) => {
+ params: (params, context) => {
const baseParams: Record = {
apiKey: params.apiKey,
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'grain_create_hook_v2': {
if (!params.hookUrl?.trim()) {
throw new Error('Webhook URL is required.')
@@ -719,12 +719,10 @@ export const GrainV2Block: BlockConfig = {
throw new Error('Event type is required.')
}
let include: unknown
- if (params.hookInclude) {
+ const rawInclude = params.hookInclude || toolCallArg(context, params.include)
+ if (rawInclude) {
try {
- include =
- typeof params.hookInclude === 'string'
- ? JSON.parse(params.hookInclude)
- : params.hookInclude
+ include = typeof rawInclude === 'string' ? JSON.parse(rawInclude) : rawInclude
} catch {
throw new Error('Invalid JSON for include options')
}
@@ -740,8 +738,8 @@ export const GrainV2Block: BlockConfig = {
case 'grain_list_hooks_v2':
return {
...baseParams,
- hookType: params.hookTypeFilter || undefined,
- state: params.hookState || undefined,
+ hookType: params.hookTypeFilter || toolCallArg(context, params.hookType) || undefined,
+ state: params.hookState || toolCallArg(context, params.state) || undefined,
}
case 'grain_delete_hook_v2':
@@ -754,7 +752,7 @@ export const GrainV2Block: BlockConfig = {
}
default:
- return GrainBlock.tools!.config!.params!(params)
+ return GrainBlock.tools!.config!.params!(params, context)
}
},
},
diff --git a/apps/sim/blocks/blocks/greenhouse.ts b/apps/sim/blocks/blocks/greenhouse.ts
index cf4ba4c1fd3..acae12ce0c0 100644
--- a/apps/sim/blocks/blocks/greenhouse.ts
+++ b/apps/sim/blocks/blocks/greenhouse.ts
@@ -1,6 +1,7 @@
import { GreenhouseIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
export const GreenhouseBlock: BlockConfig = {
@@ -362,16 +363,17 @@ Return ONLY the ISO 8601 timestamp - no explanations, no extra text.`,
],
config: {
tool: (params) => `${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
+ const operation = mapperOperation(params, context)
if (params.per_page) result.per_page = Number(params.per_page)
if (params.page) result.page = Number(params.page)
- if (params.operation === 'greenhouse_list_applications' && params.applicationStatus) {
+ if (operation === 'greenhouse_list_applications' && params.applicationStatus) {
result.status = params.applicationStatus
}
- if (params.operation === 'greenhouse_list_jobs' && params.status === '') {
+ if (operation === 'greenhouse_list_jobs' && params.status === '') {
result.status = undefined
}
diff --git a/apps/sim/blocks/blocks/harmonic.test.ts b/apps/sim/blocks/blocks/harmonic.test.ts
index 78f3f0a8b4f..37b08bd04eb 100644
--- a/apps/sim/blocks/blocks/harmonic.test.ts
+++ b/apps/sim/blocks/blocks/harmonic.test.ts
@@ -55,6 +55,12 @@ describe('HarmonicBlock', () => {
expect(direct.personUrns).toEqual(['urn:harmonic:person:44'])
})
+ it('keeps model arguments on agent tool calls, where the operation arrives in context', () => {
+ const args = { oauthCredential: 'credential-id', personId: '22', companyContextUrns: ['urn:c'] }
+ const params = { ...args, ...buildParams(args, { operation: 'harmonic_get_person' }) }
+ expect(params).toMatchObject({ personId: '22', companyContextUrns: ['urn:c'] })
+ })
+
it('does not parse malformed batch JSON before the secret-safe tool boundary', () => {
expect(
resolve({
diff --git a/apps/sim/blocks/blocks/harmonic.ts b/apps/sim/blocks/blocks/harmonic.ts
index f20b4ceee54..e46e94dbf98 100644
--- a/apps/sim/blocks/blocks/harmonic.ts
+++ b/apps/sim/blocks/blocks/harmonic.ts
@@ -1,6 +1,7 @@
import { HarmonicIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
const HARMONIC_OPERATIONS = [
'harmonic_search_people_scout',
@@ -497,8 +498,8 @@ export const HarmonicBlock: BlockConfig = {
* operation-specific key is therefore assigned explicitly; `undefined`
* is what removes a stale value after the operation changes.
*/
- params: (params) => {
- const operation = String(params.operation ?? '')
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const isPaged = (PAGED_OPERATIONS as readonly string[]).includes(operation)
const usesSavedSearch = (SAVED_SEARCH_OPERATIONS as readonly string[]).includes(operation)
const usesPersonUrns = (PERSON_URN_OPERATIONS as readonly string[]).includes(operation)
diff --git a/apps/sim/blocks/blocks/helpscout.test.ts b/apps/sim/blocks/blocks/helpscout.test.ts
new file mode 100644
index 00000000000..06f06eda6a6
--- /dev/null
+++ b/apps/sim/blocks/blocks/helpscout.test.ts
@@ -0,0 +1,35 @@
+/**
+ * Agent tool calls pass the operation in context and supply arguments under the tool's param
+ * names (`status`, `type`, `sortField`), which the mapper spreads over and must keep.
+ */
+import { describe, expect, it } from 'vitest'
+import { HelpScoutBlock } from '@/blocks/blocks/helpscout'
+
+function agentParams(operation: string, args: Record): Record {
+ return { ...args, ...(HelpScoutBlock.tools.config?.params?.(args, { operation }) ?? {}) }
+}
+
+describe('HelpScoutBlock agent tool calls', () => {
+ it('keeps the model status when updating a conversation status', () => {
+ const params = agentParams('update_conversation_status', {
+ conversationId: '123',
+ status: 'closed',
+ })
+ expect(params.status).toBe('closed')
+ })
+
+ it('keeps the model type and status when creating a conversation', () => {
+ const params = agentParams('create_conversation', {
+ mailboxId: '1',
+ subject: 'Hi',
+ type: 'chat',
+ status: 'pending',
+ })
+ expect(params).toMatchObject({ type: 'chat', status: 'pending' })
+ })
+
+ it('keeps the model sort field when listing customers', () => {
+ const params = agentParams('list_customers', { sortField: 'lastName' })
+ expect(params.sortField).toBe('lastName')
+ })
+})
diff --git a/apps/sim/blocks/blocks/helpscout.ts b/apps/sim/blocks/blocks/helpscout.ts
index 167c47364d3..7d5bb29f707 100644
--- a/apps/sim/blocks/blocks/helpscout.ts
+++ b/apps/sim/blocks/blocks/helpscout.ts
@@ -2,6 +2,7 @@ import { HelpScoutIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const CONVERSATION_OPERATIONS = [
@@ -71,8 +72,8 @@ const TIMESTAMP_WAND = {
} as const
/** The status dropdown the active operation shows, collapsed onto the tools' shared `status` param. */
-function resolveStatus(params: Record): unknown {
- switch (params.operation) {
+function resolveStatus(params: Record, operation: string): unknown {
+ switch (operation) {
case 'list_conversations':
return params.listStatus
case 'update_conversation_status':
@@ -934,21 +935,29 @@ export const HelpScoutBlock: BlockConfig = {
],
config: {
tool: (params) => `helpscout_${params.operation || 'list_conversations'}`,
- params: (params) => ({
- status: optionalString(resolveStatus(params)),
- type: optionalString(params.conversationType),
- sortField: optionalString(
- params.operation === 'list_customers'
- ? params.customerSortField
- : params.conversationSortField
- ),
- sortOrder: optionalString(params.sortOrder),
- gender: optionalString(params.gender),
- workflowType: optionalString(params.workflowType),
- organizationSort: optionalString(params.organizationSort),
- page: optionalNumber(params.page),
- number: optionalNumber(params.number),
- }),
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ return {
+ status:
+ optionalString(resolveStatus(params, operation)) ??
+ optionalString(toolCallArg(context, params.status)),
+ type:
+ optionalString(params.conversationType) ??
+ optionalString(toolCallArg(context, params.type)),
+ sortField:
+ optionalString(
+ operation === 'list_customers'
+ ? params.customerSortField
+ : params.conversationSortField
+ ) ?? optionalString(toolCallArg(context, params.sortField)),
+ sortOrder: optionalString(params.sortOrder),
+ gender: optionalString(params.gender),
+ workflowType: optionalString(params.workflowType),
+ organizationSort: optionalString(params.organizationSort),
+ page: optionalNumber(params.page),
+ number: optionalNumber(params.number),
+ }
+ },
},
},
inputs: {
diff --git a/apps/sim/blocks/blocks/hex.test.ts b/apps/sim/blocks/blocks/hex.test.ts
index 5e632ff4f64..8e71341a5e2 100644
--- a/apps/sim/blocks/blocks/hex.test.ts
+++ b/apps/sim/blocks/blocks/hex.test.ts
@@ -6,6 +6,7 @@
import { describe, expect, it } from 'vitest'
import { HexBlock } from '@/blocks/blocks/hex'
import type { BlockToolParamsContext } from '@/blocks/types'
+import { getGroupTool } from '@/tools/hex/get_group'
import { getProjectRunsTool } from '@/tools/hex/get_project_runs'
import { getQueriedTablesTool } from '@/tools/hex/get_queried_tables'
import { listGroupsTool } from '@/tools/hex/list_groups'
@@ -77,13 +78,13 @@ describe('Hex block keeps stale subBlock values out of tool requests', () => {
})
it('get project runs keeps a run status an agent passes directly', () => {
- const args = { operation: 'get_project_runs', projectId: PROJECT_ID, statusFilter: 'errored' }
+ const args = { projectId: PROJECT_ID, statusFilter: 'errored' }
const built = requestUrl(getProjectRunsTool, args, { operation: 'get_project_runs' })
expect(built.searchParams.get('statusFilter')).toBe('errored')
})
it('list groups keeps a user id an agent passes directly', () => {
- const args = { operation: 'list_groups', userId: PROJECT_ID }
+ const args = { userId: PROJECT_ID }
const built = requestUrl(listGroupsTool, args, { operation: 'list_groups' })
expect(built.searchParams.get('userId')).toBe(PROJECT_ID)
})
@@ -94,8 +95,13 @@ describe('Hex block keeps stale subBlock values out of tool requests', () => {
})
it('get queried tables keeps a cursor an agent passes directly', () => {
- const args = { operation: 'get_queried_tables', projectId: PROJECT_ID, after: 'tables-cursor' }
+ const args = { projectId: PROJECT_ID, after: 'tables-cursor' }
const built = requestUrl(getQueriedTablesTool, args, { operation: 'get_queried_tables' })
expect(built.searchParams.get('after')).toBe('tables-cursor')
})
+
+ it('get group sends the Group ID stored on an agent tool row', () => {
+ const built = requestUrl(getGroupTool, { groupIdInput: PROJECT_ID }, { operation: 'get_group' })
+ expect(built.pathname).toBe(`/api/v1/groups/${PROJECT_ID}`)
+ })
})
diff --git a/apps/sim/blocks/blocks/hex.ts b/apps/sim/blocks/blocks/hex.ts
index 9d23f46547d..7c6950cf67a 100644
--- a/apps/sim/blocks/blocks/hex.ts
+++ b/apps/sim/blocks/blocks/hex.ts
@@ -1,7 +1,7 @@
import { HexIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { isToolCall, toolCallArg, withSavedCredential } from '@/blocks/utils'
+import { isToolCall, mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/**
* Sort fields each list endpoint accepts. The only Sort By field is the List Projects one, so a
@@ -711,7 +711,7 @@ Do not include any explanations, markdown formatting, or other text outside the
},
params: (params, context) => {
const result: Record = {}
- const op = params.operation
+ const op = mapperOperation(params, context)
const fieldOrToolArg = (field: unknown, arg: unknown) =>
emptyToUndefined(field) ?? emptyToUndefined(toolCallArg(context, arg))
diff --git a/apps/sim/blocks/blocks/higgsfield.ts b/apps/sim/blocks/blocks/higgsfield.ts
index 4aff26c8b90..149a094e8ed 100644
--- a/apps/sim/blocks/blocks/higgsfield.ts
+++ b/apps/sim/blocks/blocks/higgsfield.ts
@@ -1,6 +1,6 @@
import { HiggsfieldIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { parseOptionalNumberInput } from '@/blocks/utils'
+import { mapperOperation, parseOptionalNumberInput } from '@/blocks/utils'
const GENERATE_OPERATIONS = ['higgsfield_generate', 'higgsfield_generate_soul_image']
const REQUEST_OPERATIONS = [
@@ -315,7 +315,7 @@ export const HiggsfieldBlock: BlockConfig = {
config: {
tool: (params) => params.operation,
params: (params, context) => {
- const operation = context?.operation ?? params.operation
+ const operation = mapperOperation(params, context)
const isSoul = operation === SOUL
const isGenerate = GENERATE_OPERATIONS.includes(operation)
const isList = operation === 'higgsfield_list_characters'
diff --git a/apps/sim/blocks/blocks/hubspot.test.ts b/apps/sim/blocks/blocks/hubspot.test.ts
new file mode 100644
index 00000000000..bbf335e25f2
--- /dev/null
+++ b/apps/sim/blocks/blocks/hubspot.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest'
+import { HubSpotBlock } from '@/blocks/blocks/hubspot'
+
+function mapParams(params: Record, operation: string) {
+ const mapper = HubSpotBlock.tools.config?.params
+ if (!mapper) throw new Error('HubSpot block has no params mapper')
+ return mapper(params, { operation })
+}
+
+describe('HubSpot create_list name on a tool call', () => {
+ const list = { oauthCredential: 'cred-1', objectTypeId: '0-1', processingType: 'MANUAL' }
+
+ it('keeps the List Name pinned on the tool row over the model name', () => {
+ expect(
+ mapParams({ ...list, listName: 'My List', name: 'Model Name' }, 'create_list').name
+ ).toBe('My List')
+ })
+
+ it('uses the model name when the row leaves List Name empty', () => {
+ expect(mapParams({ ...list, name: 'Model Name' }, 'create_list').name).toBe('Model Name')
+ })
+})
diff --git a/apps/sim/blocks/blocks/hubspot.ts b/apps/sim/blocks/blocks/hubspot.ts
index 4909c3b0516..b689e2b430b 100644
--- a/apps/sim/blocks/blocks/hubspot.ts
+++ b/apps/sim/blocks/blocks/hubspot.ts
@@ -2,7 +2,7 @@ import { HubspotIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { toolCallArg } from '@/blocks/utils'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
export const HubSpotBlock: BlockConfig = {
@@ -1635,7 +1635,6 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
params: (params, context) => {
const {
oauthCredential,
- operation: storedOperation,
propertiesToSet,
properties,
searchProperties,
@@ -1647,7 +1646,7 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
archived,
...rest
} = params
- const operation = storedOperation ?? context?.operation
+ const operation = mapperOperation(params, context)
const cleanParams: Record = {
oauthCredential,
@@ -1727,10 +1726,6 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
cleanParams.associations = associations
}
- if (listName && operation === 'create_list') {
- cleanParams.name = listName
- }
-
if (
operation === 'create_association' &&
associationTypeId !== undefined &&
@@ -1769,6 +1764,11 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
}
})
+ // After the copy so the row's List Name beats a model `name` on a tool call.
+ if (listName && operation === 'create_list') {
+ cleanParams.name = listName
+ }
+
return cleanParams
},
},
diff --git a/apps/sim/blocks/blocks/iam.test.ts b/apps/sim/blocks/blocks/iam.test.ts
index 6fbaaa58c5f..1f2a6a6b0f7 100644
--- a/apps/sim/blocks/blocks/iam.test.ts
+++ b/apps/sim/blocks/blocks/iam.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import { IAMBlock } from '@/blocks/blocks/iam'
+import type { BlockToolParamsContext } from '@/blocks/types'
const SHAPE_ERROR =
'Condition Context Keys must be a JSON array of { contextKeyName, contextKeyValues, contextKeyType }'
@@ -48,3 +49,32 @@ describe('IAMBlock contextEntries parsing', () => {
expect(result.contextEntries).toBeUndefined()
})
})
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = IAMBlock.tools.config?.params
+ if (!mapper) throw new Error('IAM block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('IAMBlock tool calls', () => {
+ it('parses stored context entries when the operation arrives only in the context', () => {
+ const result = mapParams(
+ {
+ region: 'us-east-1',
+ policySourceArn: 'arn:aws:iam::000000000000:role/example',
+ actionNames: 's3:GetObject',
+ contextEntries: JSON.stringify([CONTEXT_ENTRY]),
+ },
+ { operation: 'simulate_principal_policy' }
+ )
+ expect(result.contextEntries).toEqual([CONTEXT_ENTRY])
+ })
+
+ it('keeps the model access key status on update_access_key', () => {
+ const result = mapParams(
+ { region: 'us-east-1', accessKeyIdToUpdate: 'AKIAEXAMPLE', status: 'Active' },
+ { operation: 'update_access_key' }
+ )
+ expect(result.status).toBe('Active')
+ })
+})
diff --git a/apps/sim/blocks/blocks/iam.ts b/apps/sim/blocks/blocks/iam.ts
index ce502858d6a..ea5e898b984 100644
--- a/apps/sim/blocks/blocks/iam.ts
+++ b/apps/sim/blocks/blocks/iam.ts
@@ -2,7 +2,7 @@ import { isRecordLike } from '@sim/utils/object'
import { IAMIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/**
* Converts the Tags table, a `[{ key, value }]` list (or its JSON string), a plain
@@ -632,9 +632,8 @@ export const IAMBlock: BlockConfig = {
throw new Error(`Invalid IAM operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
const {
- operation,
maxItems,
maxSessionDuration,
onlyAttached,
@@ -651,7 +650,7 @@ export const IAMBlock: BlockConfig = {
const result: Record = { ...connectionConfig }
- switch (operation) {
+ switch (mapperOperation(params, context)) {
case 'list_users':
case 'list_roles':
case 'list_groups':
@@ -737,7 +736,7 @@ export const IAMBlock: BlockConfig = {
break
case 'update_access_key':
result.accessKeyIdToUpdate = rest.accessKeyIdToUpdate
- result.status = rest.accessKeyStatus
+ result.status = rest.accessKeyStatus ?? toolCallArg(context, rest.status)
if (rest.userName) result.userName = rest.userName
break
case 'add_user_to_group':
diff --git a/apps/sim/blocks/blocks/identity_center.test.ts b/apps/sim/blocks/blocks/identity_center.test.ts
new file mode 100644
index 00000000000..d38760d42be
--- /dev/null
+++ b/apps/sim/blocks/blocks/identity_center.test.ts
@@ -0,0 +1,20 @@
+import { describe, expect, it } from 'vitest'
+import { IdentityCenterBlock } from '@/blocks/blocks/identity_center'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = IdentityCenterBlock.tools.config?.params
+ if (!mapper) throw new Error('Identity Center block has no params mapper')
+ return mapper(params, context)
+}
+
+describe('Identity Center list_account_assignments tool calls', () => {
+ it('keeps the model accountId when no account filter is stored', () => {
+ const mapped = mapParams(
+ { instanceArn: 'arn:i', principalId: 'u1', principalType: 'USER', accountId: '222' },
+ { operation: 'list_account_assignments' }
+ )
+
+ expect(mapped.accountId).toBe('222')
+ })
+})
diff --git a/apps/sim/blocks/blocks/identity_center.ts b/apps/sim/blocks/blocks/identity_center.ts
index a9b885903ac..a46a9c2ff58 100644
--- a/apps/sim/blocks/blocks/identity_center.ts
+++ b/apps/sim/blocks/blocks/identity_center.ts
@@ -1,7 +1,7 @@
import { IdentityCenterIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const IdentityCenterBlock: BlockConfig = {
type: 'identity_center',
@@ -418,8 +418,8 @@ export const IdentityCenterBlock: BlockConfig = {
throw new Error(`Invalid Identity Center operation: ${params.operation}`)
}
},
- params: (params) => {
- const { operation, maxResults, ...rest } = params
+ params: (params, context) => {
+ const { maxResults, ...rest } = params
const connectionConfig = {
region: rest.region,
@@ -429,7 +429,7 @@ export const IdentityCenterBlock: BlockConfig = {
const result: Record = { ...connectionConfig }
- switch (operation) {
+ switch (mapperOperation(params, context)) {
case 'list_instances':
if (maxResults) {
const parsed = Number.parseInt(String(maxResults), 10)
@@ -505,7 +505,8 @@ export const IdentityCenterBlock: BlockConfig = {
result.instanceArn = rest.instanceArn
result.principalId = rest.principalId
result.principalType = rest.principalType
- result.accountId = rest.filterAccountId || undefined
+ result.accountId =
+ rest.filterAccountId || toolCallArg(context, rest.accountId) || undefined
if (maxResults) {
const parsed = Number.parseInt(String(maxResults), 10)
if (!Number.isNaN(parsed)) result.maxResults = parsed
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/infisical.ts b/apps/sim/blocks/blocks/infisical.ts
index b233d6f3744..71a40032a63 100644
--- a/apps/sim/blocks/blocks/infisical.ts
+++ b/apps/sim/blocks/blocks/infisical.ts
@@ -1,7 +1,7 @@
import { InfisicalIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
export const InfisicalBlock: BlockConfig = {
type: 'infisical',
@@ -192,7 +192,7 @@ export const InfisicalBlock: BlockConfig = {
],
config: {
tool: (params) => `infisical_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {
apiKey: params.apiKey,
projectId: params.projectId,
@@ -202,7 +202,7 @@ export const InfisicalBlock: BlockConfig = {
if (params.baseUrl) result.baseUrl = params.baseUrl
if (params.secretPath) result.secretPath = params.secretPath
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'list_secrets':
if (params.recursive != null) result.recursive = params.recursive
if (params.includeImports != null) result.includeImports = params.includeImports
diff --git a/apps/sim/blocks/blocks/instagram.test.ts b/apps/sim/blocks/blocks/instagram.test.ts
index d1948b9a428..917c1a82c88 100644
--- a/apps/sim/blocks/blocks/instagram.test.ts
+++ b/apps/sim/blocks/blocks/instagram.test.ts
@@ -76,4 +76,26 @@ describe('InstagramBlock', () => {
buildParams({ operation: 'instagram_get_account_insights', period: 'week' })
).toThrow('Instagram account insights period must be day or lifetime')
})
+
+ it('forwards the media and metrics an agent passes under the tool param names', () => {
+ const file = {
+ id: 'file-1',
+ key: 'execution/workflow/execution/photo.jpg',
+ name: 'photo.jpg',
+ size: 1024,
+ type: 'image/jpeg',
+ }
+ const carousel = buildParams(
+ { oauthCredential: 'credential-1', media: [file, { ...file, id: 'file-2' }], caption: 'hi' },
+ { operation: 'instagram_publish_carousel' }
+ )
+ expect(carousel).toMatchObject({ caption: 'hi' })
+ expect(carousel.media).toHaveLength(2)
+
+ const insights = buildParams(
+ { oauthCredential: 'credential-1', mediaId: 'media-1', metrics: 'reach,views' },
+ { operation: 'instagram_get_media_insights' }
+ )
+ expect(insights).toMatchObject({ mediaId: 'media-1', metrics: 'reach,views' })
+ })
})
diff --git a/apps/sim/blocks/blocks/instagram.ts b/apps/sim/blocks/blocks/instagram.ts
index 6862204a45b..da0749eede4 100644
--- a/apps/sim/blocks/blocks/instagram.ts
+++ b/apps/sim/blocks/blocks/instagram.ts
@@ -2,7 +2,7 @@ import { InstagramIcon } 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 { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
const IG_USER_ID_OPS = [
'instagram_list_media',
@@ -780,8 +780,8 @@ Return ONLY the timestamp or date - no explanations, no extra text.`,
}
return operation
},
- params: (params) => {
- const operation = typeof params.operation === 'string' ? params.operation : ''
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {
credential: params.oauthCredential,
}
@@ -805,12 +805,17 @@ Return ONLY the timestamp or date - no explanations, no extra text.`,
const resolved = normalizeFileInput(params.media, { single: true })
if (resolved) result.media = resolved
} else if (operation === 'instagram_publish_carousel') {
- const resolved = normalizeFileInput(params.carouselMedia)
+ const resolved =
+ normalizeFileInput(params.carouselMedia) ??
+ normalizeFileInput(toolCallArg(context, params.media))
if (resolved) result.media = resolved
}
for (const key of OPERATION_PARAM_KEYS[operation] ?? []) {
- const value = params[key]
+ const value =
+ key === 'insightMetrics'
+ ? params.insightMetrics || toolCallArg(context, params.metrics)
+ : params[key]
if (value === undefined || value === null || value === '') continue
if (key === 'insightMetrics') {
diff --git a/apps/sim/blocks/blocks/instantly.test.ts b/apps/sim/blocks/blocks/instantly.test.ts
new file mode 100644
index 00000000000..a616b454f7f
--- /dev/null
+++ b/apps/sim/blocks/blocks/instantly.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it } from 'vitest'
+import { InstantlyV2Block } from '@/blocks/blocks/instantly'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+function mapParams(params: Record, context?: BlockToolParamsContext) {
+ const mapper = InstantlyV2Block.tools.config?.params
+ if (!mapper) throw new Error('Instantly block has no params mapper')
+ return { ...params, ...mapper(params, context) }
+}
+
+describe('Instantly agent tool calls', () => {
+ it('keeps the model interest value so the update does not fail as missing', () => {
+ const merged = mapParams(
+ { lead_email: 'ann@example.com', interest_value: 1, campaign_id: 'camp-1' },
+ { operation: 'update_lead_interest_status' }
+ )
+
+ expect(merged.interest_value).toBe(1)
+ expect(merged.campaign_id).toBe('camp-1')
+ })
+
+ it('keeps model lead fields named by the tool instead of wiping them', () => {
+ const merged = mapParams(
+ { email: 'ann@example.com', first_name: 'Ann', campaign: 'camp-1', skip_if_in_list: true },
+ { operation: 'create_lead' }
+ )
+
+ expect(merged).toMatchObject({ first_name: 'Ann', campaign: 'camp-1', skip_if_in_list: true })
+ })
+
+ it('keeps the model reply body when the block body fields are empty', () => {
+ const merged = mapParams(
+ { reply_to_uuid: 'email-1', eaccount: 'me@example.com', subject: 'Re', body: { text: 'Hi' } },
+ { operation: 'reply_to_email' }
+ )
+
+ expect(merged.body).toEqual({ text: 'Hi' })
+ })
+})
diff --git a/apps/sim/blocks/blocks/instantly.ts b/apps/sim/blocks/blocks/instantly.ts
index 08c22aecefe..9484186e167 100644
--- a/apps/sim/blocks/blocks/instantly.ts
+++ b/apps/sim/blocks/blocks/instantly.ts
@@ -2,7 +2,7 @@ import { isRecordLike } from '@sim/utils/object'
import { InstantlyIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { isToolCall, mapperOperation, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const LEAD_LIST_OPERATIONS = ['list_leads'] as const
@@ -932,81 +932,198 @@ export const InstantlyBlock: BlockConfig = {
],
config: {
tool: (params) => `instantly_${params.operation}`,
- params: (params) => ({
- campaign: mapCampaignParam(params),
- list_id: mapListIdParam(params),
- campaign_id: mapCampaignIdParam(params),
- leadId: params.leadId,
- email: emptyToUndefined(params.email),
- first_name: emptyToUndefined(params.firstName),
- last_name: emptyToUndefined(params.lastName),
- company_name: emptyToUndefined(params.companyName),
- job_title: emptyToUndefined(params.jobTitle),
- phone: emptyToUndefined(params.phone),
- website: emptyToUndefined(params.website),
- personalization: emptyToUndefined(params.personalization),
- custom_variables: parseJsonObject(params.customVariables),
- lt_interest_status: toNumberParam(params.leadInterestStatus),
- pl_value_lead: emptyToUndefined(params.potentialLeadValue),
- assigned_to: optionalIdParam(params.assignedTo),
- blocklist_id: optionalIdParam(params.blocklistId),
- skip_if_in_workspace: toBooleanParam(params.skipIfInWorkspace),
- skip_if_in_campaign: toBooleanParam(params.skipIfInCampaign),
- skip_if_in_list: toBooleanParam(params.skipIfInList),
- verify_leads_for_lead_finder: toBooleanParam(params.verifyLeadsForLeadFinder),
- verify_leads_on_import: toBooleanParam(params.verifyLeadsOnImport),
- filter: emptyToUndefined(params.leadFilter),
- ids: mapIdsParam(params),
- excluded_ids: parseStringList(params.excludedLeadIds),
- contacts: parseStringList(params.contacts),
- organization_user_ids: parseStringList(params.organizationUserIds),
- smart_view_id: optionalIdParam(params.smartViewId),
- is_website_visitor: toBooleanParam(params.websiteVisitor),
- distinct_contacts: toBooleanParam(params.distinctContacts),
- enrichment_status: toNumberParam(params.enrichmentStatus),
- esg_code: emptyToUndefined(params.esgCode),
- in_campaign: toBooleanParam(params.inCampaign),
- in_list: toBooleanParam(params.inList),
- status: mapStatusParam(params),
- limit: mapLimitParam(params),
- starting_after: mapStartingAfterParam(params),
- lead_email: emptyToUndefined(params.leadEmail),
- interest_value:
- params.operation === 'update_lead_interest_status'
- ? toNullableNumberParam(params.interestValue, true)
- : undefined,
- ai_interest_value: toNumberParam(params.aiInterestValue),
- disable_auto_interest: toBooleanParam(params.disableAutoInterest),
- name: mapNameParam(params),
- campaign_schedule: parseJsonObject(params.campaignSchedule),
- sequences: parseJsonArray(params.sequences),
- email_list: parseStringList(params.emailList),
- daily_limit: toNumberParam(params.dailyLimit),
- daily_max_leads: toNumberParam(params.dailyMaxLeads),
- open_tracking: toBooleanParam(params.openTracking),
- stop_on_reply: toBooleanParam(params.stopOnReply),
- pl_value: toNumberParam(params.positiveLeadValue),
- email_gap: toNumberParam(params.emailGap),
- link_tracking: toBooleanParam(params.linkTracking),
- text_only: toBooleanParam(params.textOnly),
- tag_ids: emptyToUndefined(params.tagIds),
- ai_sales_agent_id: optionalIdParam(params.aiSalesAgentId),
- search: mapSearchParam(params),
- eaccount: emptyToUndefined(params.emailAccount),
- i_status: toNumberParam(params.emailStatus),
- lead: emptyToUndefined(params.emailLead),
- is_unread: toBooleanParam(params.emailIsUnread),
- reply_to_uuid: emptyToUndefined(params.replyToUuid),
- subject: emptyToUndefined(params.subject),
- body: {
- text: emptyToUndefined(params.bodyText),
- html: emptyToUndefined(params.bodyHtml),
- },
- cc_address_email_list: emptyToUndefined(params.ccRecipients),
- bcc_address_email_list: emptyToUndefined(params.bccRecipients),
- has_enrichment_task: toBooleanParam(params.hasEnrichmentTask),
- owned_by: optionalIdParam(params.ownedBy),
- }),
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const toolCall = isToolCall(context)
+ /**
+ * The block field's value, else on a tool call the model's arg under the tool's own param
+ * name: the result is spread over the merged params, so an `undefined` here wipes that arg.
+ */
+ const orArg = (
+ blockValue: T | undefined,
+ toolKey: string,
+ coerce: (value: unknown) => T | undefined
+ ): T | undefined =>
+ blockValue !== undefined || !toolCall ? blockValue : coerce(params[toolKey])
+
+ return {
+ campaign: orArg(mapCampaignParam(params, operation), 'campaign', optionalIdParam),
+ list_id: orArg(mapListIdParam(params, operation), 'list_id', optionalIdParam),
+ campaign_id: orArg(mapCampaignIdParam(params, operation), 'campaign_id', optionalIdParam),
+ leadId: params.leadId,
+ email: emptyToUndefined(params.email),
+ first_name: orArg(emptyToUndefined(params.firstName), 'first_name', emptyToUndefined),
+ last_name: orArg(emptyToUndefined(params.lastName), 'last_name', emptyToUndefined),
+ company_name: orArg(
+ emptyToUndefined(params.companyName),
+ 'company_name',
+ emptyToUndefined
+ ),
+ job_title: orArg(emptyToUndefined(params.jobTitle), 'job_title', emptyToUndefined),
+ phone: emptyToUndefined(params.phone),
+ website: emptyToUndefined(params.website),
+ personalization: emptyToUndefined(params.personalization),
+ custom_variables: orArg(
+ parseJsonObject(params.customVariables),
+ 'custom_variables',
+ parseJsonObject
+ ),
+ lt_interest_status: orArg(
+ toNumberParam(params.leadInterestStatus),
+ 'lt_interest_status',
+ toNumberParam
+ ),
+ pl_value_lead: orArg(
+ emptyToUndefined(params.potentialLeadValue),
+ 'pl_value_lead',
+ emptyToUndefined
+ ),
+ assigned_to: orArg(optionalIdParam(params.assignedTo), 'assigned_to', optionalIdParam),
+ blocklist_id: orArg(optionalIdParam(params.blocklistId), 'blocklist_id', optionalIdParam),
+ skip_if_in_workspace: orArg(
+ toBooleanParam(params.skipIfInWorkspace),
+ 'skip_if_in_workspace',
+ toBooleanParam
+ ),
+ skip_if_in_campaign: orArg(
+ toBooleanParam(params.skipIfInCampaign),
+ 'skip_if_in_campaign',
+ toBooleanParam
+ ),
+ skip_if_in_list: orArg(
+ toBooleanParam(params.skipIfInList),
+ 'skip_if_in_list',
+ toBooleanParam
+ ),
+ verify_leads_for_lead_finder: orArg(
+ toBooleanParam(params.verifyLeadsForLeadFinder),
+ 'verify_leads_for_lead_finder',
+ toBooleanParam
+ ),
+ verify_leads_on_import: orArg(
+ toBooleanParam(params.verifyLeadsOnImport),
+ 'verify_leads_on_import',
+ toBooleanParam
+ ),
+ filter: orArg(emptyToUndefined(params.leadFilter), 'filter', emptyToUndefined),
+ ids: orArg(mapIdsParam(params, operation), 'ids', parseStringList),
+ excluded_ids: orArg(
+ parseStringList(params.excludedLeadIds),
+ 'excluded_ids',
+ parseStringList
+ ),
+ contacts: parseStringList(params.contacts),
+ organization_user_ids: orArg(
+ parseStringList(params.organizationUserIds),
+ 'organization_user_ids',
+ parseStringList
+ ),
+ smart_view_id: orArg(
+ optionalIdParam(params.smartViewId),
+ 'smart_view_id',
+ optionalIdParam
+ ),
+ is_website_visitor: orArg(
+ toBooleanParam(params.websiteVisitor),
+ 'is_website_visitor',
+ toBooleanParam
+ ),
+ distinct_contacts: orArg(
+ toBooleanParam(params.distinctContacts),
+ 'distinct_contacts',
+ toBooleanParam
+ ),
+ enrichment_status: orArg(
+ toNumberParam(params.enrichmentStatus),
+ 'enrichment_status',
+ toNumberParam
+ ),
+ esg_code: orArg(emptyToUndefined(params.esgCode), 'esg_code', emptyToUndefined),
+ in_campaign: orArg(toBooleanParam(params.inCampaign), 'in_campaign', toBooleanParam),
+ in_list: orArg(toBooleanParam(params.inList), 'in_list', toBooleanParam),
+ status: orArg(mapStatusParam(params, operation), 'status', toNumberParam),
+ limit: orArg(mapLimitParam(params, operation), 'limit', toNumberParam),
+ starting_after: orArg(
+ mapStartingAfterParam(params, operation),
+ 'starting_after',
+ emptyToUndefined
+ ),
+ lead_email: orArg(emptyToUndefined(params.leadEmail), 'lead_email', emptyToUndefined),
+ interest_value: mapInterestValueParam(params, operation, toolCall),
+ ai_interest_value: orArg(
+ toNumberParam(params.aiInterestValue),
+ 'ai_interest_value',
+ toNumberParam
+ ),
+ disable_auto_interest: orArg(
+ toBooleanParam(params.disableAutoInterest),
+ 'disable_auto_interest',
+ toBooleanParam
+ ),
+ name: orArg(mapNameParam(params, operation), 'name', emptyToUndefined),
+ campaign_schedule: orArg(
+ parseJsonObject(params.campaignSchedule),
+ 'campaign_schedule',
+ parseJsonObject
+ ),
+ sequences: parseJsonArray(params.sequences),
+ email_list: orArg(parseStringList(params.emailList), 'email_list', parseStringList),
+ daily_limit: orArg(toNumberParam(params.dailyLimit), 'daily_limit', toNumberParam),
+ daily_max_leads: orArg(
+ toNumberParam(params.dailyMaxLeads),
+ 'daily_max_leads',
+ toNumberParam
+ ),
+ open_tracking: orArg(
+ toBooleanParam(params.openTracking),
+ 'open_tracking',
+ toBooleanParam
+ ),
+ stop_on_reply: orArg(toBooleanParam(params.stopOnReply), 'stop_on_reply', toBooleanParam),
+ pl_value: orArg(toNumberParam(params.positiveLeadValue), 'pl_value', toNumberParam),
+ email_gap: orArg(toNumberParam(params.emailGap), 'email_gap', toNumberParam),
+ link_tracking: orArg(
+ toBooleanParam(params.linkTracking),
+ 'link_tracking',
+ toBooleanParam
+ ),
+ text_only: orArg(toBooleanParam(params.textOnly), 'text_only', toBooleanParam),
+ tag_ids: orArg(emptyToUndefined(params.tagIds), 'tag_ids', emptyToUndefined),
+ ai_sales_agent_id: orArg(
+ optionalIdParam(params.aiSalesAgentId),
+ 'ai_sales_agent_id',
+ optionalIdParam
+ ),
+ search: orArg(mapSearchParam(params, operation), 'search', emptyToUndefined),
+ eaccount: orArg(emptyToUndefined(params.emailAccount), 'eaccount', emptyToUndefined),
+ i_status: orArg(toNumberParam(params.emailStatus), 'i_status', toNumberParam),
+ lead: orArg(emptyToUndefined(params.emailLead), 'lead', emptyToUndefined),
+ is_unread: orArg(toBooleanParam(params.emailIsUnread), 'is_unread', toBooleanParam),
+ reply_to_uuid: orArg(
+ emptyToUndefined(params.replyToUuid),
+ 'reply_to_uuid',
+ emptyToUndefined
+ ),
+ subject: emptyToUndefined(params.subject),
+ body: mapBodyParam(params, toolCall),
+ cc_address_email_list: orArg(
+ emptyToUndefined(params.ccRecipients),
+ 'cc_address_email_list',
+ emptyToUndefined
+ ),
+ bcc_address_email_list: orArg(
+ emptyToUndefined(params.bccRecipients),
+ 'bcc_address_email_list',
+ emptyToUndefined
+ ),
+ has_enrichment_task: orArg(
+ toBooleanParam(params.hasEnrichmentTask),
+ 'has_enrichment_task',
+ toBooleanParam
+ ),
+ owned_by: orArg(optionalIdParam(params.ownedBy), 'owned_by', optionalIdParam),
+ }
+ },
},
},
inputs: {
@@ -1232,14 +1349,14 @@ function emptyToUndefined(value: unknown): unknown {
return trimmed === '' || trimmed === '-' ? undefined : trimmed
}
-function mapCampaignParam(params: Record): string | undefined {
- if (params.operation === 'list_leads') return optionalIdParam(params.campaignId)
- if (params.operation !== 'create_lead' || params.leadDestination !== 'campaign') return undefined
+function mapCampaignParam(params: Record, operation: string): string | undefined {
+ if (operation === 'list_leads') return optionalIdParam(params.campaignId)
+ if (operation !== 'create_lead' || params.leadDestination !== 'campaign') return undefined
return optionalIdParam(params.leadDestinationId)
}
-function mapListIdParam(params: Record): string | undefined {
- switch (params.operation) {
+function mapListIdParam(params: Record, operation: string): string | undefined {
+ switch (operation) {
case 'delete_leads':
return params.deleteSource === 'list' ? optionalIdParam(params.deleteSourceId) : undefined
case 'create_lead':
@@ -1255,42 +1372,45 @@ function mapListIdParam(params: Record): string | undefined {
}
}
-function mapCampaignIdParam(params: Record): string | undefined {
- if (params.operation === 'delete_leads') {
+function mapCampaignIdParam(
+ params: Record,
+ operation: string
+): string | undefined {
+ if (operation === 'delete_leads') {
return params.deleteSource === 'campaign' ? optionalIdParam(params.deleteSourceId) : undefined
}
- if (params.operation === 'update_lead_interest_status' || params.operation === 'list_emails') {
+ if (operation === 'update_lead_interest_status' || operation === 'list_emails') {
return optionalIdParam(params.campaignId)
}
return undefined
}
-function mapIdsParam(params: Record): string[] | undefined {
- if (params.operation === 'delete_leads') return parseStringList(params.deleteLeadIds)
- if (params.operation === 'list_leads') return parseStringList(params.leadIds)
+function mapIdsParam(params: Record, operation: string): string[] | undefined {
+ if (operation === 'delete_leads') return parseStringList(params.deleteLeadIds)
+ if (operation === 'list_leads') return parseStringList(params.leadIds)
return undefined
}
-function mapStatusParam(params: Record): number | undefined {
- if (params.operation === 'delete_leads') return toNumberParam(params.deleteStatus)
- if (params.operation === 'list_campaigns') return toNumberParam(params.campaignStatus)
+function mapStatusParam(params: Record, operation: string): number | undefined {
+ if (operation === 'delete_leads') return toNumberParam(params.deleteStatus)
+ if (operation === 'list_campaigns') return toNumberParam(params.campaignStatus)
return undefined
}
-function mapLimitParam(params: Record): number | undefined {
- if (params.operation === 'delete_leads') return toNumberParam(params.deleteLimit)
- if (isPaginatedOperation(params.operation)) return toNumberParam(params.limit)
+function mapLimitParam(params: Record, operation: string): number | undefined {
+ if (operation === 'delete_leads') return toNumberParam(params.deleteLimit)
+ if (isPaginatedOperation(operation)) return toNumberParam(params.limit)
return undefined
}
-function mapStartingAfterParam(params: Record): unknown {
- return isPaginatedOperation(params.operation) ? emptyToUndefined(params.startingAfter) : undefined
+function mapStartingAfterParam(params: Record, operation: string): unknown {
+ return isPaginatedOperation(operation) ? emptyToUndefined(params.startingAfter) : undefined
}
-function mapNameParam(params: Record): unknown {
- switch (params.operation) {
+function mapNameParam(params: Record, operation: string): unknown {
+ switch (operation) {
case 'create_lead_list':
return emptyToUndefined(params.leadListName)
case 'create_campaign':
@@ -1301,12 +1421,34 @@ function mapNameParam(params: Record): unknown {
}
}
-function mapSearchParam(params: Record): unknown {
- if (params.operation === 'list_emails') return emptyToUndefined(params.emailSearch)
- if (isSearchOperation(params.operation)) return emptyToUndefined(params.search)
+function mapSearchParam(params: Record, operation: string): unknown {
+ if (operation === 'list_emails') return emptyToUndefined(params.emailSearch)
+ if (isSearchOperation(operation)) return emptyToUndefined(params.search)
return undefined
}
+function mapInterestValueParam(
+ params: Record,
+ operation: string,
+ toolCall: boolean
+): number | null | undefined {
+ if (operation !== 'update_lead_interest_status') return undefined
+ const blockValueEmpty =
+ params.interestValue === undefined ||
+ (typeof params.interestValue === 'string' && params.interestValue.trim() === '')
+ if (toolCall && blockValueEmpty) return toNullableNumberParam(params.interest_value)
+ return toNullableNumberParam(params.interestValue, true)
+}
+
+function mapBodyParam(params: Record, toolCall: boolean): unknown {
+ const text = emptyToUndefined(params.bodyText)
+ const html = emptyToUndefined(params.bodyHtml)
+ if (toolCall && text === undefined && html === undefined) {
+ return parseJsonObject(params.body) ?? emptyToUndefined(params.body)
+ }
+ return { text, html }
+}
+
function isPaginatedOperation(value: unknown): boolean {
return (
value === 'list_leads' ||
diff --git a/apps/sim/blocks/blocks/intercom.test.ts b/apps/sim/blocks/blocks/intercom.test.ts
index 8e761a8c81a..077c4c2a58a 100644
--- a/apps/sim/blocks/blocks/intercom.test.ts
+++ b/apps/sim/blocks/blocks/intercom.test.ts
@@ -74,3 +74,35 @@ describe('Intercom role defaults', () => {
expect(options()[0]?.id).toBe('lead')
})
})
+
+describe('Intercom tool-row fields on a tool call', () => {
+ it.each([
+ { operation: 'update_ticket', field: 'ticket_assignee_id', param: 'assignee_id' },
+ { operation: 'create_contact', field: 'contact_company_id', param: 'company_id' },
+ { operation: 'close_conversation', field: 'close_body', param: 'body' },
+ { operation: 'assign_conversation', field: 'assign_body', param: 'body' },
+ { operation: 'create_note', field: 'note_body', param: 'body' },
+ { operation: 'create_note', field: 'tag_contact_id', param: 'contactId' },
+ { operation: 'attach_contact_to_company', field: 'attach_company_id', param: 'companyId' },
+ { operation: 'create_tag', field: 'tag_name', param: 'name' },
+ { operation: 'create_tag', field: 'tag_id_update', param: 'id' },
+ { operation: 'create_event', field: 'event_user_id', param: 'user_id' },
+ { operation: 'create_event', field: 'event_email', param: 'email' },
+ { operation: 'create_event', field: 'event_contact_id', param: 'id' },
+ { operation: 'create_event', field: 'event_metadata', param: 'metadata' },
+ { operation: 'create_message', field: 'message_type_msg', param: 'message_type' },
+ { operation: 'create_company', field: 'company_name', param: 'name' },
+ ])(
+ 'keeps the pinned $field over the model $param on $operation',
+ ({ operation, field, param }) => {
+ const mapped = mapParams({ [field]: 'pinned', [param]: 'model' }, { operation })
+ expect(mapped[param]).toBe('pinned')
+ }
+ )
+
+ it('fills a param from the model when the row leaves its field empty', () => {
+ expect(mapParams({ assignee_id: 'model' }, { operation: 'update_ticket' }).assignee_id).toBe(
+ 'model'
+ )
+ })
+})
diff --git a/apps/sim/blocks/blocks/intercom.ts b/apps/sim/blocks/blocks/intercom.ts
index 6121c2c4e32..7f92408daac 100644
--- a/apps/sim/blocks/blocks/intercom.ts
+++ b/apps/sim/blocks/blocks/intercom.ts
@@ -2,7 +2,12 @@ import { toBooleanFromInput } from '@sim/utils/coerce'
import { IntercomIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { createVersionedToolSelector, toolCallArg, withSavedCredential } from '@/blocks/utils'
+import {
+ createVersionedToolSelector,
+ mapperOperation,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/**
@@ -38,7 +43,6 @@ type IntercomParamsMapper = NonNullable {
const {
- operation: storedOperation,
message_type_msg,
company_name,
contact_company_id,
@@ -68,7 +72,7 @@ const mapIntercomParams: IntercomParamsMapper = (params, context) => {
event_created_at,
...rest
} = params
- const operation = storedOperation ?? context?.operation
+ const operation = mapperOperation(params, context)
const cleanParams: Record = {}
if (operation === 'create_message' && message_type_msg) {
@@ -169,8 +173,9 @@ const mapIntercomParams: IntercomParamsMapper = (params, context) => {
if (event_created_at) cleanParams.created_at = Number(event_created_at)
}
+ // A block field mapped above (pinned on a tool row) beats the model's arg under the tool's name.
Object.entries(rest).forEach(([key, value]) => {
- if (value !== undefined && value !== null && value !== '') {
+ if (hasInput(value) && cleanParams[key] === undefined) {
cleanParams[key] = value
}
})
diff --git a/apps/sim/blocks/blocks/jira.test.ts b/apps/sim/blocks/blocks/jira.test.ts
new file mode 100644
index 00000000000..e44eebff1ba
--- /dev/null
+++ b/apps/sim/blocks/blocks/jira.test.ts
@@ -0,0 +1,56 @@
+import { describe, expect, it } from 'vitest'
+import { JiraBlock } from '@/blocks/blocks/jira'
+
+/**
+ * What a tool call (agent, Pi, Human v2) hands the tool: the merged stored-row and model args,
+ * overlaid with the block mapper's output. The operation arrives only in `context`.
+ */
+function toolCallParams(operation: string, args: Record) {
+ const mapper = JiraBlock.tools.config?.params
+ if (!mapper) throw new Error('Jira block is missing tools.config.params')
+ return { ...args, ...mapper(args, { operation }) }
+}
+
+describe('JiraBlock tool calls', () => {
+ it('maps fields set on the agent tool row to the tool param names', () => {
+ expect(
+ toolCallParams('add_comment', { issueKey: 'PROJ-1', commentBody: 'From the row' }).body
+ ).toBe('From the row')
+ expect(
+ toolCallParams('get_users', { userAccountId: 'acc-1', usersMaxResults: '5' })
+ ).toMatchObject({ accountId: 'acc-1', maxResults: 5 })
+ })
+
+ it.each([
+ ['add_comment', { issueKey: 'PROJ-1', body: 'Model comment' }],
+ ['transition', { issueKey: 'PROJ-1', transitionId: '31', comment: 'Done', fields: { a: 1 } }],
+ ['update_worklog', { issueKey: 'PROJ-1', worklogId: '9', timeSpentSeconds: 600 }],
+ ['search_users', { query: 'ada', maxResults: 10, startAt: 20 }],
+ ['list_projects', { query: 'core', maxResults: 10, startAt: 0 }],
+ [
+ 'create_link',
+ { inwardIssueKey: 'A-1', outwardIssueKey: 'B-1', linkType: 'Blocks', comment: 'x' },
+ ],
+ ['update', { issueKey: 'PROJ-1', parent: { key: 'PROJ-0' }, notifyUsers: false }],
+ ])('keeps model args for %s', (operation, args) => {
+ expect(toolCallParams(operation, args)).toMatchObject(args)
+ })
+
+ it('accepts model-sent arrays for list params instead of throwing', () => {
+ const params = toolCallParams('write', {
+ projectId: '10000',
+ summary: 'Bug',
+ labels: ['a', ' b '],
+ parent: { key: 'PROJ-0' },
+ })
+ expect(params.labels).toEqual(['a', 'b'])
+ expect(params.parent).toEqual({ key: 'PROJ-0' })
+ expect(toolCallParams('search', { jql: 'x', fields: ['key', 'summary'] }).fields).toEqual([
+ 'key',
+ 'summary',
+ ])
+ expect(
+ toolCallParams('delete', { issueKey: 'PROJ-1', deleteSubtasks: true }).deleteSubtasks
+ ).toBe(true)
+ })
+})
diff --git a/apps/sim/blocks/blocks/jira.ts b/apps/sim/blocks/blocks/jira.ts
index 454636cd4e4..337c508691b 100644
--- a/apps/sim/blocks/blocks/jira.ts
+++ b/apps/sim/blocks/blocks/jira.ts
@@ -2,7 +2,12 @@ import { JiraIcon } from '@/components/icons'
import { getDefaultToolScopesForProvider } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput } from '@/blocks/utils'
+import {
+ mapperOperation,
+ normalizeFileInput,
+ parseOptionalBooleanInput,
+ toolCallArg,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/** Canonical `issueKey` pair: issue picker (basic) and raw issue key (advanced). */
@@ -12,6 +17,29 @@ const PROJECT_FIELD = ['projectId', 'manualProjectId'] as const
/** Canonical `files` pair: upload (basic) and file reference (advanced). */
const ATTACHMENT_FIELD = ['attachmentFiles', 'files'] as const
+/** A comma-separated canvas string or a model-sent array as a trimmed list; `undefined` when empty. */
+function parseList(value: unknown): string[] | undefined {
+ const items = Array.isArray(value)
+ ? value.map((item) => String(item).trim())
+ : typeof value === 'string'
+ ? value.split(',').map((item) => item.trim())
+ : []
+ const nonEmpty = items.filter((item) => item !== '')
+ return nonEmpty.length > 0 ? nonEmpty : undefined
+}
+
+/** Parses a worklog duration in seconds; `undefined` when blank, throws when not positive. */
+function parseTimeSpentSeconds(raw: unknown): number | undefined {
+ if (raw === undefined || raw === null || String(raw).trim() === '') return undefined
+ const seconds = Number(String(raw).trim())
+ if (!Number.isFinite(seconds) || seconds <= 0) {
+ throw new Error(
+ 'Time Spent (seconds) must be a positive number of seconds (e.g., 3600 for 1 hour)'
+ )
+ }
+ return seconds
+}
+
export const JiraBlock: BlockConfig = {
type: 'jira',
name: 'Jira',
@@ -1085,8 +1113,9 @@ Return ONLY the comment text - no explanations.`,
return 'jira_retrieve'
}
},
- params: (params) => {
+ params: (params, context) => {
const { oauthCredential, projectId, issueKey } = params
+ const operation = mapperOperation(params, context)
// Use canonical param IDs (raw subBlock IDs are deleted after serialization)
const effectiveProjectId = projectId ? String(projectId).trim() : ''
@@ -1097,7 +1126,7 @@ Return ONLY the comment text - no explanations.`,
domain: params.domain,
}
- switch (params.operation) {
+ switch (operation) {
case 'create_sprint': {
return {
...baseParams,
@@ -1109,14 +1138,6 @@ Return ONLY the comment text - no explanations.`,
}
}
case 'write': {
- const parseCommaSeparated = (value: string | undefined): string[] | undefined => {
- if (!value || value.trim() === '') return undefined
- return value
- .split(',')
- .map((item) => item.trim())
- .filter((item) => item !== '')
- }
-
const customFieldValue = params.customFieldValue || undefined
const writeParams = {
@@ -1124,13 +1145,15 @@ Return ONLY the comment text - no explanations.`,
summary: params.summary || '',
description: params.description || '',
issueType: params.issueType || 'Task',
- parent: params.parentIssue ? { key: params.parentIssue } : undefined,
+ parent: params.parentIssue
+ ? { key: params.parentIssue }
+ : toolCallArg(context, params.parent),
assignee: params.assignee || undefined,
priority: params.priority || undefined,
- labels: parseCommaSeparated(params.labels),
- components: parseCommaSeparated(params.components),
+ labels: parseList(params.labels),
+ components: parseList(params.components),
duedate: params.duedate || undefined,
- fixVersions: parseCommaSeparated(params.fixVersions),
+ fixVersions: parseList(params.fixVersions),
reporter: params.reporter || undefined,
environment: params.environment || undefined,
customFieldId: params.customFieldId || undefined,
@@ -1143,14 +1166,6 @@ Return ONLY the comment text - no explanations.`,
}
}
case 'update': {
- const parseCommaSeparated = (value: string | undefined): string[] | undefined => {
- if (!value || value.trim() === '') return undefined
- return value
- .split(',')
- .map((item) => item.trim())
- .filter((item) => item !== '')
- }
-
const updateParams = {
projectId: effectiveProjectId,
issueKey: effectiveIssueKey,
@@ -1158,21 +1173,18 @@ Return ONLY the comment text - no explanations.`,
description: params.description || undefined,
assignee: params.assignee || undefined,
priority: params.priority || undefined,
- labels: parseCommaSeparated(params.labels),
- components: parseCommaSeparated(params.components),
+ labels: parseList(params.labels),
+ components: parseList(params.components),
duedate: params.duedate || undefined,
- fixVersions: parseCommaSeparated(params.fixVersions),
+ fixVersions: parseList(params.fixVersions),
environment: params.environment || undefined,
customFieldId: params.customFieldId || undefined,
customFieldValue: params.customFieldValue || undefined,
customFields: params.customFields || undefined,
- parent: String(params.updateParentIssue ?? '').trim() || undefined,
- notifyUsers:
- params.notifyUsers === 'false'
- ? false
- : params.notifyUsers === 'true'
- ? true
- : undefined,
+ parent:
+ String(params.updateParentIssue ?? '').trim() ||
+ toolCallArg(context, params.parent),
+ notifyUsers: parseOptionalBooleanInput(params.notifyUsers),
}
return {
...baseParams,
@@ -1184,10 +1196,7 @@ Return ONLY the comment text - no explanations.`,
...baseParams,
issueKey: effectiveIssueKey,
...(effectiveProjectId && { projectId: effectiveProjectId }),
- includeAttachments:
- params.includeAttachments === true || params.includeAttachments === 'true'
- ? true
- : undefined,
+ includeAttachments: parseOptionalBooleanInput(params.includeAttachments) || undefined,
}
}
case 'read-bulk': {
@@ -1200,7 +1209,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueKey: effectiveIssueKey,
- deleteSubtasks: params.deleteSubtasks === 'true',
+ deleteSubtasks: parseOptionalBooleanInput(params.deleteSubtasks) === true,
}
}
case 'assign': {
@@ -1215,9 +1224,9 @@ Return ONLY the comment text - no explanations.`,
...baseParams,
issueKey: effectiveIssueKey,
transitionId: params.transitionId,
- comment: params.transitionComment,
+ comment: params.transitionComment ?? toolCallArg(context, params.comment),
resolution: params.resolution || undefined,
- fields: params.transitionFields || undefined,
+ fields: params.transitionFields || toolCallArg(context, params.fields),
}
}
case 'search': {
@@ -1226,12 +1235,7 @@ Return ONLY the comment text - no explanations.`,
jql: params.jql,
nextPageToken: params.nextPageToken || undefined,
maxResults: params.maxResults ? Number.parseInt(params.maxResults) : undefined,
- fields: params.fields
- ? params.fields
- .split(',')
- .map((f: string) => f.trim())
- .filter(Boolean)
- : undefined,
+ fields: parseList(params.fields),
expand: params.expand ? String(params.expand).trim() || undefined : undefined,
}
}
@@ -1239,7 +1243,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueKey: effectiveIssueKey,
- body: params.commentBody,
+ body: params.commentBody ?? toolCallArg(context, params.body),
}
}
case 'get_comments': {
@@ -1255,7 +1259,7 @@ Return ONLY the comment text - no explanations.`,
...baseParams,
issueKey: effectiveIssueKey,
commentId: params.commentId,
- body: params.commentBody,
+ body: params.commentBody ?? toolCallArg(context, params.body),
}
}
case 'delete_comment': {
@@ -1269,10 +1273,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueKey: effectiveIssueKey,
- includeAttachments:
- params.includeAttachments === true || params.includeAttachments === 'true'
- ? true
- : undefined,
+ includeAttachments: parseOptionalBooleanInput(params.includeAttachments) || undefined,
}
}
case 'add_attachment': {
@@ -1293,21 +1294,11 @@ Return ONLY the comment text - no explanations.`,
}
}
case 'add_worklog': {
- const rawTime = params.timeSpentSeconds
- const parsedTime =
- rawTime !== undefined && rawTime !== null && String(rawTime).trim() !== ''
- ? Number(String(rawTime).trim())
- : undefined
- if (parsedTime !== undefined && (!Number.isFinite(parsedTime) || parsedTime <= 0)) {
- throw new Error(
- 'Time Spent (seconds) must be a positive number of seconds (e.g., 3600 for 1 hour)'
- )
- }
return {
...baseParams,
issueKey: effectiveIssueKey,
- timeSpentSeconds: parsedTime,
- comment: params.worklogComment,
+ timeSpentSeconds: parseTimeSpentSeconds(params.timeSpentSeconds),
+ comment: params.worklogComment ?? toolCallArg(context, params.comment),
started: params.started,
}
}
@@ -1324,18 +1315,10 @@ Return ONLY the comment text - no explanations.`,
...baseParams,
issueKey: effectiveIssueKey,
worklogId: params.worklogId,
- timeSpentSeconds: (() => {
- const raw = params.timeSpentSecondsUpdate
- if (raw === undefined || raw === null || String(raw).trim() === '') return undefined
- const n = Number(String(raw).trim())
- if (!Number.isFinite(n) || n <= 0) {
- throw new Error(
- 'Time Spent (seconds) must be a positive number of seconds (e.g., 3600 for 1 hour)'
- )
- }
- return n
- })(),
- comment: params.worklogComment,
+ timeSpentSeconds: parseTimeSpentSeconds(
+ params.timeSpentSecondsUpdate ?? toolCallArg(context, params.timeSpentSeconds)
+ ),
+ comment: params.worklogComment ?? toolCallArg(context, params.comment),
started: params.started,
}
}
@@ -1352,7 +1335,7 @@ Return ONLY the comment text - no explanations.`,
inwardIssueKey: params.inwardIssueKey,
outwardIssueKey: params.outwardIssueKey,
linkType: params.linkType,
- comment: params.linkComment,
+ comment: params.linkComment ?? toolCallArg(context, params.comment),
}
}
case 'delete_link': {
@@ -1378,35 +1361,37 @@ Return ONLY the comment text - no explanations.`,
case 'get_users': {
return {
...baseParams,
- accountId: params.userAccountId || undefined,
- startAt: params.usersStartAt ? Number.parseInt(params.usersStartAt) : undefined,
+ accountId: params.userAccountId || toolCallArg(context, params.accountId),
+ startAt: params.usersStartAt
+ ? Number.parseInt(params.usersStartAt)
+ : toolCallArg(context, params.startAt),
maxResults: params.usersMaxResults
? Number.parseInt(params.usersMaxResults)
- : undefined,
+ : toolCallArg(context, params.maxResults),
}
}
case 'search_users': {
return {
...baseParams,
- query: params.searchUsersQuery,
+ query: params.searchUsersQuery ?? toolCallArg(context, params.query),
maxResults: params.searchUsersMaxResults
? Number.parseInt(params.searchUsersMaxResults)
- : undefined,
+ : toolCallArg(context, params.maxResults),
startAt: params.searchUsersStartAt
? Number.parseInt(params.searchUsersStartAt)
- : undefined,
+ : toolCallArg(context, params.startAt),
}
}
case 'list_projects': {
return {
...baseParams,
- query: params.projectSearchQuery || undefined,
+ query: params.projectSearchQuery || toolCallArg(context, params.query),
startAt: params.listProjectsStartAt
? Number.parseInt(params.listProjectsStartAt)
- : undefined,
+ : toolCallArg(context, params.startAt),
maxResults: params.listProjectsMaxResults
? Number.parseInt(params.listProjectsMaxResults)
- : undefined,
+ : toolCallArg(context, params.maxResults),
}
}
case 'get_project': {
diff --git a/apps/sim/blocks/blocks/jira_service_management.test.ts b/apps/sim/blocks/blocks/jira_service_management.test.ts
index 2d6d40439f4..2e7f2736f98 100644
--- a/apps/sim/blocks/blocks/jira_service_management.test.ts
+++ b/apps/sim/blocks/blocks/jira_service_management.test.ts
@@ -136,3 +136,40 @@ describe.each(PAGINATED_CASES.map((testCase) => [testCase.operation, testCase] a
})
}
)
+
+/**
+ * What a tool call (agent, Pi, Human v2) hands the tool: the merged stored-row and model args,
+ * overlaid with the block mapper's output. The operation arrives only in `context`.
+ */
+function toolCallParams(operation: string, args: Record) {
+ const mapper = JiraServiceManagementBlock.tools.config?.params
+ if (!mapper) throw new Error('Block is missing tools.config.params')
+ return { ...args, ...mapper({ domain: DOMAIN, ...args }, { operation }) }
+}
+
+describe('JiraServiceManagementBlock tool calls', () => {
+ it('maps fields set on the agent tool row to the tool param names', () => {
+ expect(
+ toolCallParams('add_comment', { issueIdOrKey: 'SD-1', commentBody: 'From the row' }).body
+ ).toBe('From the row')
+ expect(toolCallParams('get_queues', { serviceDeskId: '1', startIndex: '5' }).start).toBe(5)
+ })
+
+ it.each([
+ ['add_comment', { issueIdOrKey: 'SD-1', body: 'Model comment', isPublic: true }],
+ ['get_comments', { issueIdOrKey: 'SD-1', isPublic: false, start: 10, limit: 5 }],
+ ['create_organization', { name: 'Acme' }],
+ ['add_participants', { issueIdOrKey: 'SD-1', accountIds: 'a,b' }],
+ ['answer_approval', { issueIdOrKey: 'SD-1', approvalId: '2', decision: 'approve' }],
+ ['save_form_answers', { issueIdOrKey: 'SD-1', formId: 'f', answers: { '1': { text: 'x' } } }],
+ ['copy_forms', { sourceIssueIdOrKey: 'SD-1', targetIssueIdOrKey: 'SD-2', formIds: ['u1'] }],
+ [
+ 'create_request',
+ { serviceDeskId: '1', requestTypeId: '2', summary: 's', requestFieldValues: { a: 1 } },
+ ],
+ ['search_objects_aql', { qlQuery: 'Name = x', page: 2, objectTypeId: '7', workspaceId: 'w' }],
+ ['create_object', { objectTypeId: '7', attributes: [{ objectTypeAttributeId: '1' }] }],
+ ])('keeps model args for %s without throwing', (operation, args) => {
+ expect(toolCallParams(operation, args)).toMatchObject(args)
+ })
+})
diff --git a/apps/sim/blocks/blocks/jira_service_management.ts b/apps/sim/blocks/blocks/jira_service_management.ts
index 52b59ff2da5..6dabfb552be 100644
--- a/apps/sim/blocks/blocks/jira_service_management.ts
+++ b/apps/sim/blocks/blocks/jira_service_management.ts
@@ -2,6 +2,7 @@ import { JiraServiceManagementIcon } from '@/components/icons'
import { getDefaultToolScopesForProvider } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, parseOptionalBooleanInput, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/** Operations that accept Atlassian's `start`/`limit` pagination query params. */
@@ -23,12 +24,22 @@ const PAGINATED_OPERATIONS = [
* Coerce an optional numeric block input into an integer, returning undefined for
* empty or non-numeric values so no `NaN` reaches the API query string.
*/
-function toOptionalInt(value: string | undefined): number | undefined {
+function toOptionalInt(value: unknown): number | undefined {
if (!value) return undefined
- const parsed = Number.parseInt(value, 10)
+ const parsed = Number.parseInt(String(value), 10)
return Number.isNaN(parsed) ? undefined : parsed
}
+/** Parses a JSON string input; a model-sent object or array is already parsed and passes through. */
+function parseJsonInput(value: unknown, errorMessage: string): unknown {
+ if (typeof value !== 'string') return value
+ try {
+ return JSON.parse(value)
+ } catch {
+ throw new Error(errorMessage)
+ }
+}
+
/**
* Parse the Assets attributes input into the API payload array. Accepts either a
* JSON string (from the block input) or an already-parsed array (from a dynamic
@@ -1177,7 +1188,12 @@ Return ONLY the comment text - no explanations.`,
return 'jsm_get_service_desks'
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const pagination = {
+ start: toOptionalInt(params.startIndex) ?? toolCallArg(context, params.start),
+ limit: toOptionalInt(params.maxResults) ?? toolCallArg(context, params.limit),
+ }
const baseParams = {
oauthCredential: params.oauthCredential,
domain: params.domain,
@@ -1187,15 +1203,14 @@ Return ONLY the comment text - no explanations.`,
// route resolves the site's single Assets workspace automatically.
const assetBaseParams = {
...baseParams,
- workspaceId: params.assetWorkspaceId || undefined,
+ workspaceId: params.assetWorkspaceId || toolCallArg(context, params.workspaceId),
}
- switch (params.operation) {
+ switch (operation) {
case 'get_service_desks':
return {
...baseParams,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'get_request_types':
if (!params.serviceDeskId) {
@@ -1206,8 +1221,7 @@ Return ONLY the comment text - no explanations.`,
serviceDeskId: params.serviceDeskId,
searchQuery: params.searchQuery,
groupId: params.groupId,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'create_request':
if (!params.serviceDeskId) {
@@ -1229,22 +1243,10 @@ Return ONLY the comment text - no explanations.`,
requestParticipants: params.requestParticipants,
channel: params.channel,
requestFieldValues: params.requestFieldValues
- ? (() => {
- try {
- return JSON.parse(params.requestFieldValues)
- } catch {
- throw new Error('requestFieldValues must be valid JSON')
- }
- })()
+ ? parseJsonInput(params.requestFieldValues, 'requestFieldValues must be valid JSON')
: undefined,
formAnswers: params.formAnswers
- ? (() => {
- try {
- return JSON.parse(params.formAnswers)
- } catch {
- throw new Error('formAnswers must be valid JSON')
- }
- })()
+ ? parseJsonInput(params.formAnswers, 'formAnswers must be valid JSON')
: undefined,
}
case 'get_request':
@@ -1263,32 +1265,33 @@ Return ONLY the comment text - no explanations.`,
requestOwnership: params.requestOwnership,
requestStatus: params.requestStatus,
approvalStatus:
- params.requestOwnership === 'APPROVER'
+ (params.requestOwnership === 'APPROVER'
? params.requestApprovalStatus || undefined
- : undefined,
+ : undefined) ?? toolCallArg(context, params.approvalStatus),
organizationId:
- params.requestOwnership === 'ORGANIZATION'
+ (params.requestOwnership === 'ORGANIZATION'
? params.requestOrganizationId || undefined
- : undefined,
- requestTypeId: params.requestTypeFilter || undefined,
+ : undefined) ?? toolCallArg(context, params.organizationId),
+ requestTypeId: params.requestTypeFilter || toolCallArg(context, params.requestTypeId),
searchTerm: params.searchTerm,
expand: params.expand,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
- case 'add_comment':
+ case 'add_comment': {
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
}
- if (!params.commentBody) {
+ const body = params.commentBody ?? toolCallArg(context, params.body)
+ if (!body) {
throw new Error('Comment body is required')
}
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- body: params.commentBody,
- isPublic: params.isPublic === 'true',
+ body,
+ isPublic: parseOptionalBooleanInput(params.isPublic) === true,
}
+ }
case 'get_comments':
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
@@ -1296,11 +1299,16 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- isPublic: params.includePublicComments === 'false' ? false : undefined,
- internal: params.includeInternalComments === 'false' ? false : undefined,
+ isPublic:
+ params.includePublicComments === 'false'
+ ? false
+ : toolCallArg(context, params.isPublic),
+ internal:
+ params.includeInternalComments === 'false'
+ ? false
+ : toolCallArg(context, params.internal),
expand: params.expand,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'get_customers':
if (!params.serviceDeskId) {
@@ -1309,9 +1317,8 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
serviceDeskId: params.serviceDeskId,
- query: params.customerQuery,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ query: params.customerQuery ?? toolCallArg(context, params.query),
+ ...pagination,
}
case 'add_customer': {
if (!params.serviceDeskId) {
@@ -1333,8 +1340,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
serviceDeskId: params.serviceDeskId,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'get_queues':
if (!params.serviceDeskId) {
@@ -1343,9 +1349,8 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
serviceDeskId: params.serviceDeskId,
- includeCount: params.includeCount === 'true',
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ includeCount: parseOptionalBooleanInput(params.includeCount) === true,
+ ...pagination,
}
case 'get_sla':
if (!params.issueIdOrKey) {
@@ -1354,8 +1359,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'get_transitions':
if (!params.issueIdOrKey) {
@@ -1364,8 +1368,7 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
case 'transition_request':
if (!params.issueIdOrKey) {
@@ -1378,16 +1381,15 @@ Return ONLY the comment text - no explanations.`,
...baseParams,
issueIdOrKey: params.issueIdOrKey,
transitionId: params.transitionId,
- comment: params.transitionComment,
+ comment: params.transitionComment ?? toolCallArg(context, params.comment),
}
- case 'create_organization':
- if (!params.organizationName) {
+ case 'create_organization': {
+ const name = params.organizationName ?? toolCallArg(context, params.name)
+ if (!name) {
throw new Error('Organization name is required')
}
- return {
- ...baseParams,
- name: params.organizationName,
- }
+ return { ...baseParams, name }
+ }
case 'add_organization':
if (!params.serviceDeskId) {
throw new Error('Service Desk ID is required')
@@ -1407,21 +1409,19 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
- case 'add_participants':
+ case 'add_participants': {
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
}
- if (!params.participantAccountIds) {
+ const accountIds =
+ params.participantAccountIds ?? toolCallArg(context, params.accountIds)
+ if (!accountIds) {
throw new Error('Account IDs are required')
}
- return {
- ...baseParams,
- issueIdOrKey: params.issueIdOrKey,
- accountIds: params.participantAccountIds,
- }
+ return { ...baseParams, issueIdOrKey: params.issueIdOrKey, accountIds }
+ }
case 'get_approvals':
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
@@ -1429,25 +1429,26 @@ Return ONLY the comment text - no explanations.`,
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
- start: toOptionalInt(params.startIndex),
- limit: toOptionalInt(params.maxResults),
+ ...pagination,
}
- case 'answer_approval':
+ case 'answer_approval': {
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
}
if (!params.approvalId) {
throw new Error('Approval ID is required')
}
- if (!params.approvalDecision) {
+ const decision = params.approvalDecision ?? toolCallArg(context, params.decision)
+ if (!decision) {
throw new Error('Decision is required')
}
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
approvalId: params.approvalId,
- decision: params.approvalDecision,
+ decision,
}
+ }
case 'get_request_type_fields':
if (!params.serviceDeskId) {
throw new Error('Service Desk ID is required')
@@ -1500,28 +1501,24 @@ Return ONLY the comment text - no explanations.`,
issueIdOrKey: params.issueIdOrKey,
formTemplateId: params.formTemplateId,
}
- case 'save_form_answers':
+ case 'save_form_answers': {
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
}
if (!params.formId) {
throw new Error('Form ID is required')
}
- if (!params.formAnswers) {
+ const answers = params.formAnswers ?? toolCallArg(context, params.answers)
+ if (!answers) {
throw new Error('Form answers are required')
}
return {
...baseParams,
issueIdOrKey: params.issueIdOrKey,
formId: params.formId,
- answers: (() => {
- try {
- return JSON.parse(params.formAnswers)
- } catch {
- throw new Error('formAnswers must be valid JSON')
- }
- })(),
+ answers: parseJsonInput(answers, 'formAnswers must be valid JSON'),
}
+ }
case 'submit_form':
if (!params.issueIdOrKey) {
throw new Error('Issue ID or key is required')
@@ -1619,6 +1616,7 @@ Return ONLY the comment text - no explanations.`,
targetIssueIdOrKey: params.targetIssueIdOrKey,
formIds: params.formIds
? (() => {
+ if (Array.isArray(params.formIds)) return params.formIds
try {
const parsed = JSON.parse(params.formIds)
if (!Array.isArray(parsed)) {
@@ -1636,76 +1634,114 @@ Return ONLY the comment text - no explanations.`,
case 'list_object_schemas':
return {
...assetBaseParams,
- startAt: toOptionalInt(params.assetStartAt),
- maxResults: toOptionalInt(params.assetMaxResults),
- includeCounts: params.assetIncludeCounts === 'true' ? true : undefined,
- }
- case 'get_object_schema':
- if (!params.assetSchemaId) {
+ startAt: toOptionalInt(params.assetStartAt) ?? toolCallArg(context, params.startAt),
+ maxResults:
+ toOptionalInt(params.assetMaxResults) ?? toolCallArg(context, params.maxResults),
+ includeCounts:
+ params.assetIncludeCounts === 'true'
+ ? true
+ : toolCallArg(context, params.includeCounts),
+ }
+ case 'get_object_schema': {
+ const schemaId = params.assetSchemaId ?? toolCallArg(context, params.schemaId)
+ if (!schemaId) {
throw new Error('Schema ID is required')
}
- return { ...assetBaseParams, schemaId: params.assetSchemaId }
- case 'list_object_types':
- if (!params.assetSchemaId) {
+ return { ...assetBaseParams, schemaId }
+ }
+ case 'list_object_types': {
+ const schemaId = params.assetSchemaId ?? toolCallArg(context, params.schemaId)
+ if (!schemaId) {
throw new Error('Schema ID is required')
}
return {
...assetBaseParams,
- schemaId: params.assetSchemaId,
- excludeAbstract: params.assetExcludeAbstract === 'true' ? true : undefined,
+ schemaId,
+ excludeAbstract:
+ params.assetExcludeAbstract === 'true'
+ ? true
+ : toolCallArg(context, params.excludeAbstract),
}
- case 'get_object_type_attributes':
- if (!params.assetObjectTypeId) {
+ }
+ case 'get_object_type_attributes': {
+ const objectTypeId =
+ params.assetObjectTypeId ?? toolCallArg(context, params.objectTypeId)
+ if (!objectTypeId) {
throw new Error('Object type ID is required')
}
return {
...assetBaseParams,
- objectTypeId: params.assetObjectTypeId,
- onlyValueEditable: params.assetOnlyValueEditable === 'true' ? true : undefined,
- query: params.assetAttributeQuery || undefined,
+ objectTypeId,
+ onlyValueEditable:
+ params.assetOnlyValueEditable === 'true'
+ ? true
+ : toolCallArg(context, params.onlyValueEditable),
+ query: params.assetAttributeQuery || toolCallArg(context, params.query),
}
- case 'search_objects_aql':
- if (!params.assetQlQuery) {
+ }
+ case 'search_objects_aql': {
+ const qlQuery = params.assetQlQuery ?? toolCallArg(context, params.qlQuery)
+ if (!qlQuery) {
throw new Error('AQL query is required')
}
return {
...assetBaseParams,
- qlQuery: params.assetQlQuery,
- page: toOptionalInt(params.assetPage),
- resultsPerPage: toOptionalInt(params.assetResultsPerPage),
- includeAttributes: params.assetIncludeAttributes === 'false' ? false : undefined,
- objectTypeId: params.assetObjectTypeId || undefined,
- objectSchemaId: params.assetObjectSchemaId || undefined,
+ qlQuery,
+ page: toOptionalInt(params.assetPage) ?? toolCallArg(context, params.page),
+ resultsPerPage:
+ toOptionalInt(params.assetResultsPerPage) ??
+ toolCallArg(context, params.resultsPerPage),
+ includeAttributes:
+ params.assetIncludeAttributes === 'false'
+ ? false
+ : toolCallArg(context, params.includeAttributes),
+ objectTypeId: params.assetObjectTypeId || toolCallArg(context, params.objectTypeId),
+ objectSchemaId:
+ params.assetObjectSchemaId || toolCallArg(context, params.objectSchemaId),
}
- case 'get_object':
- if (!params.assetObjectId) {
+ }
+ case 'get_object': {
+ const objectId = params.assetObjectId ?? toolCallArg(context, params.objectId)
+ if (!objectId) {
throw new Error('Object ID is required')
}
- return { ...assetBaseParams, objectId: params.assetObjectId }
- case 'create_object':
- if (!params.assetObjectTypeId) {
+ return { ...assetBaseParams, objectId }
+ }
+ case 'create_object': {
+ const objectTypeId =
+ params.assetObjectTypeId ?? toolCallArg(context, params.objectTypeId)
+ if (!objectTypeId) {
throw new Error('Object type ID is required')
}
return {
...assetBaseParams,
- objectTypeId: params.assetObjectTypeId,
- attributes: parseAssetAttributes(params.assetAttributes),
+ objectTypeId,
+ attributes: parseAssetAttributes(
+ params.assetAttributes ?? toolCallArg(context, params.attributes)
+ ),
}
- case 'update_object':
- if (!params.assetObjectId) {
+ }
+ case 'update_object': {
+ const objectId = params.assetObjectId ?? toolCallArg(context, params.objectId)
+ if (!objectId) {
throw new Error('Object ID is required')
}
return {
...assetBaseParams,
- objectId: params.assetObjectId,
- attributes: parseAssetAttributes(params.assetAttributes),
- objectTypeId: params.assetObjectTypeId || undefined,
+ objectId,
+ attributes: parseAssetAttributes(
+ params.assetAttributes ?? toolCallArg(context, params.attributes)
+ ),
+ objectTypeId: params.assetObjectTypeId || toolCallArg(context, params.objectTypeId),
}
- case 'delete_object':
- if (!params.assetObjectId) {
+ }
+ case 'delete_object': {
+ const objectId = params.assetObjectId ?? toolCallArg(context, params.objectId)
+ if (!objectId) {
throw new Error('Object ID is required')
}
- return { ...assetBaseParams, objectId: params.assetObjectId }
+ return { ...assetBaseParams, objectId }
+ }
default:
return baseParams
}
diff --git a/apps/sim/blocks/blocks/jotform.test.ts b/apps/sim/blocks/blocks/jotform.test.ts
index e3279e61ebb..da3a395a959 100644
--- a/apps/sim/blocks/blocks/jotform.test.ts
+++ b/apps/sim/blocks/blocks/jotform.test.ts
@@ -25,4 +25,14 @@ describe('JotformBlock', () => {
expect({ ...inputs, ...buildParams(inputs) }.questions).toBe(inputs.bulkQuestions)
})
+
+ /**
+ * An agent tool call passes the operation only in `context`; a report title filled
+ * on the tool row must still reach the tool's `title` param.
+ */
+ it('maps tool-row fields on an agent tool call', () => {
+ const args: Record = { apiKey: 'key', formId: '2315', reportTitle: 'Weekly' }
+
+ expect({ ...args, ...buildParams(args, { operation: 'create_report' }) }.title).toBe('Weekly')
+ })
})
diff --git a/apps/sim/blocks/blocks/jotform.ts b/apps/sim/blocks/blocks/jotform.ts
index 7157680f467..d4b4d2cf8dd 100644
--- a/apps/sim/blocks/blocks/jotform.ts
+++ b/apps/sim/blocks/blocks/jotform.ts
@@ -1,6 +1,6 @@
import { JotformIcon } 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'
/**
@@ -730,10 +730,10 @@ export const JotformBlock: BlockConfig = {
* Everything else — formId, submissionId, answers, the pagination fields — is
* named after its param and reaches the tool unchanged.
*/
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'create_form':
if (params.newFormQuestions) result.questions = params.newFormQuestions
if (params.newFormProperties) result.properties = params.newFormProperties
diff --git a/apps/sim/blocks/blocks/jupyter.ts b/apps/sim/blocks/blocks/jupyter.ts
index 12f41d9f88e..891d4c3dffc 100644
--- a/apps/sim/blocks/blocks/jupyter.ts
+++ b/apps/sim/blocks/blocks/jupyter.ts
@@ -3,6 +3,7 @@ import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
createVersionedToolSelector,
+ mapperOperation,
normalizeFileInput,
withSavedCredential,
} from '@/blocks/utils'
@@ -292,61 +293,59 @@ export const JupyterBlock = {
],
config: {
tool: (params) => params.operation as string,
- params: (params) => {
+ params: (params, context) => {
const normalizedFile = normalizeFileInput(params.file, { single: true })
if (normalizedFile) {
params.file = normalizedFile
}
- const { operation, ...rest } = params
-
const baseParams: Record = {
- serverUrl: rest.serverUrl,
- token: rest.token,
+ serverUrl: params.serverUrl,
+ token: params.token,
}
- switch (operation) {
+ switch (mapperOperation(params, context)) {
case 'jupyter_list_contents':
- if (rest.path) baseParams.path = rest.path
+ if (params.path) baseParams.path = params.path
break
case 'jupyter_get_content':
case 'jupyter_delete_content':
- baseParams.path = rest.path
+ baseParams.path = params.path
break
case 'jupyter_create_file':
- baseParams.path = rest.path
- baseParams.type = rest.type
- if (rest.content) baseParams.content = rest.content
+ baseParams.path = params.path
+ baseParams.type = params.type
+ if (params.content) baseParams.content = params.content
break
case 'jupyter_upload_file':
- if (rest.directory) baseParams.directory = rest.directory
- baseParams.file = rest.file
- if (rest.uploadFileName) baseParams.fileName = rest.uploadFileName
+ if (params.directory) baseParams.directory = params.directory
+ baseParams.file = params.file
+ if (params.uploadFileName) baseParams.fileName = params.uploadFileName
break
case 'jupyter_rename_content':
- baseParams.path = rest.path
- baseParams.newPath = rest.newPath
+ baseParams.path = params.path
+ baseParams.newPath = params.newPath
break
case 'jupyter_copy_content':
- baseParams.path = rest.path
- baseParams.copyFromPath = rest.copyFromPath
+ baseParams.path = params.path
+ baseParams.copyFromPath = params.copyFromPath
break
case 'jupyter_start_kernel':
- if (rest.kernelName) baseParams.kernelName = rest.kernelName
+ if (params.kernelName) baseParams.kernelName = params.kernelName
break
case 'jupyter_stop_kernel':
case 'jupyter_restart_kernel':
case 'jupyter_interrupt_kernel':
- baseParams.kernelId = rest.kernelId
+ baseParams.kernelId = params.kernelId
break
case 'jupyter_create_session':
- baseParams.path = rest.path
- if (rest.kernelName) baseParams.kernelName = rest.kernelName
- if (rest.sessionName) baseParams.name = rest.sessionName
- if (rest.sessionType) baseParams.type = rest.sessionType
+ baseParams.path = params.path
+ if (params.kernelName) baseParams.kernelName = params.kernelName
+ if (params.sessionName) baseParams.name = params.sessionName
+ if (params.sessionType) baseParams.type = params.sessionType
break
case 'jupyter_delete_session':
- baseParams.sessionId = rest.sessionId
+ baseParams.sessionId = params.sessionId
break
}
diff --git a/apps/sim/blocks/blocks/kalshi.test.ts b/apps/sim/blocks/blocks/kalshi.test.ts
new file mode 100644
index 00000000000..0ba5bb8ef46
--- /dev/null
+++ b/apps/sim/blocks/blocks/kalshi.test.ts
@@ -0,0 +1,64 @@
+import { describe, expect, it } from 'vitest'
+import { KalshiBlock } from '@/blocks/blocks/kalshi'
+
+const buildParams = KalshiBlock.tools.config?.params
+if (!buildParams) throw new Error('KalshiBlock has no params mapper')
+
+describe('KalshiBlock', () => {
+ /**
+ * An agent tool call passes the operation only in `context`; the order ID filled
+ * on the tool row must still reach the tool's `orderId` param.
+ */
+ it('maps the order ID field on an agent tool call', () => {
+ const args: Record = { keyId: 'key', privateKey: 'pem', orderIdParam: 'ord-1' }
+
+ expect({ ...args, ...buildParams(args, { operation: 'cancel_order' }) }.orderId).toBe('ord-1')
+ })
+
+ it.each([
+ { operation: 'cancel_order', stale: { orderId: 'O-STALE' }, field: { orderIdParam: 'O-NEW' } },
+ { operation: 'get_order', stale: { orderId: 'O-STALE' }, field: { orderIdParam: 'O-NEW' } },
+ {
+ operation: 'amend_order',
+ stale: { clientOrderId: 'C-STALE' },
+ field: { clientOrderIdAmend: 'C-NEW' },
+ },
+ { operation: 'get_orders', stale: { status: 'open' }, field: { orderStatus: 'resting' } },
+ ])(
+ 'sends the $operation field over a stale canvas value under the tool param name',
+ ({ operation, stale, field }) => {
+ const canvas: Record = {
+ operation,
+ keyId: 'key',
+ privateKey: 'pem',
+ ...stale,
+ ...field,
+ }
+ const sent: Record = { ...canvas, ...buildParams(canvas) }
+ expect(sent[Object.keys(stale)[0]]).toBe(Object.values(field)[0])
+ }
+ )
+
+ it('drops a stale canvas order ID when the operation field is empty', () => {
+ const canvas = { operation: 'get_order', orderId: 'O-STALE', orderIdParam: '' }
+ expect({ ...canvas, ...buildParams(canvas) }.orderId).toBeUndefined()
+ })
+
+ it.each([
+ { operation: 'cancel_order', param: 'orderId', field: 'orderIdParam' },
+ { operation: 'get_orders', param: 'status', field: 'orderStatus' },
+ { operation: 'create_order', param: 'type', field: 'orderType' },
+ { operation: 'create_order', param: 'ticker', field: 'tickerOrder' },
+ ])(
+ 'keeps the row-pinned $field over the model $param on a $operation tool call',
+ ({ operation, param, field }) => {
+ const args = { [field]: 'pinned', [param]: 'model' }
+ expect({ ...args, ...buildParams(args, { operation }) }[param]).toBe('pinned')
+ }
+ )
+
+ it('keeps the model order ID on a tool call when the row leaves the field empty', () => {
+ const args = { orderId: 'model' }
+ expect({ ...args, ...buildParams(args, { operation: 'cancel_order' }) }.orderId).toBe('model')
+ })
+})
diff --git a/apps/sim/blocks/blocks/kalshi.ts b/apps/sim/blocks/blocks/kalshi.ts
index 280e6eebed4..500fc67e0da 100644
--- a/apps/sim/blocks/blocks/kalshi.ts
+++ b/apps/sim/blocks/blocks/kalshi.ts
@@ -1,7 +1,12 @@
import { KalshiIcon } 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,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
/*
* Mutually exclusive alternates, not canonical pairs — an order carries either
@@ -695,9 +700,9 @@ Return ONLY the numeric timestamp (seconds since Unix epoch) - no explanations,
return 'kalshi_get_markets'
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
orderStatus,
tickerFilter,
tickerFills,
@@ -712,69 +717,72 @@ Return ONLY the numeric timestamp (seconds since Unix epoch) - no explanations,
...rest
} = params
const cleanParams: Record = {}
+ Object.entries(rest).forEach(([key, value]) => {
+ if (value !== undefined && value !== null && value !== '') {
+ cleanParams[key] = value
+ }
+ })
+
+ /**
+ * The operation's own field wins over a value under the tool's param name: on the canvas
+ * that value is stale from another operation, and on a tool call the row's field is pinned.
+ * The model's value fills the param only on a tool call with the field empty.
+ */
+ const mapField = (key: string, field: unknown) => {
+ cleanParams[key] = field || toolCallArg(context, cleanParams[key])
+ }
- if (operation === 'get_orders' && orderStatus) {
- cleanParams.status = orderStatus
+ if (operation === 'get_orders') {
+ mapField('status', orderStatus)
}
if (
- (operation === 'get_orders' ||
- operation === 'get_positions' ||
- operation === 'get_settlements') &&
- tickerFilter
+ operation === 'get_orders' ||
+ operation === 'get_positions' ||
+ operation === 'get_settlements'
) {
- cleanParams.ticker = tickerFilter
+ mapField('ticker', tickerFilter)
}
- if (operation === 'get_fills' && tickerFills) {
- cleanParams.ticker = tickerFills
+ if (operation === 'get_fills') {
+ mapField('ticker', tickerFills)
}
if (operation === 'get_candlesticks') {
- if (seriesTickerCandlesticks) cleanParams.seriesTicker = seriesTickerCandlesticks
- if (tickerCandlesticks) cleanParams.ticker = tickerCandlesticks
+ mapField('seriesTicker', seriesTickerCandlesticks)
+ mapField('ticker', tickerCandlesticks)
}
- // Map series ticker for get_event_candlesticks (event ticker flows through eventTicker)
- if (operation === 'get_event_candlesticks' && seriesTickerCandlesticks) {
- cleanParams.seriesTicker = seriesTickerCandlesticks
+ // Event candlesticks take the event ticker through eventTicker
+ if (operation === 'get_event_candlesticks') {
+ mapField('seriesTicker', seriesTickerCandlesticks)
}
- if (operation === 'get_series_by_ticker' && seriesTickerGet) {
- cleanParams.seriesTicker = seriesTickerGet
+ if (operation === 'get_series_by_ticker') {
+ mapField('seriesTicker', seriesTickerGet)
}
if (
- (operation === 'get_order' ||
- operation === 'cancel_order' ||
- operation === 'amend_order') &&
- orderIdParam
+ operation === 'get_order' ||
+ operation === 'cancel_order' ||
+ operation === 'amend_order'
) {
- cleanParams.orderId = orderIdParam
+ mapField('orderId', orderIdParam)
}
- if ((operation === 'create_order' || operation === 'amend_order') && tickerOrder) {
- cleanParams.ticker = tickerOrder
+ if (operation === 'create_order' || operation === 'amend_order') {
+ mapField('ticker', tickerOrder)
}
- if (operation === 'create_order' && orderType) {
- cleanParams.type = orderType
+ if (operation === 'create_order') {
+ mapField('type', orderType)
}
- if (operation === 'amend_order' && countAmend) {
- cleanParams.count = countAmend
+ if (operation === 'amend_order') {
+ mapField('count', countAmend)
+ mapField('clientOrderId', clientOrderIdAmend)
}
- if (operation === 'amend_order' && clientOrderIdAmend) {
- cleanParams.clientOrderId = clientOrderIdAmend
- }
-
- Object.entries(rest).forEach(([key, value]) => {
- if (value !== undefined && value !== null && value !== '') {
- cleanParams[key] = value
- }
- })
-
return cleanParams
},
},
diff --git a/apps/sim/blocks/blocks/ketch.test.ts b/apps/sim/blocks/blocks/ketch.test.ts
new file mode 100644
index 00000000000..03c6dbaae40
--- /dev/null
+++ b/apps/sim/blocks/blocks/ketch.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from 'vitest'
+import { KetchBlock } from '@/blocks/blocks/ketch'
+
+const buildParams = KetchBlock.tools.config?.params
+if (!buildParams) throw new Error('KetchBlock has no params mapper')
+
+describe('KetchBlock', () => {
+ /**
+ * An agent tool call passes the operation only in `context`; a purposes map the
+ * model sends as JSON text must reach the tool as an object, like the canvas sends it.
+ */
+ it('parses a JSON-text purposes map on an agent tool call', () => {
+ const args = {
+ organizationCode: 'org',
+ propertyCode: 'web',
+ environmentCode: 'production',
+ identities: { email: 'a@example.com' },
+ purposes: '{"analytics":{"allowed":"granted"}}',
+ }
+
+ expect({ ...args, ...buildParams(args, { operation: 'set_consent' }) }.purposes).toEqual({
+ analytics: { allowed: 'granted' },
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/ketch.ts b/apps/sim/blocks/blocks/ketch.ts
index 47baebd7da1..6601d23589d 100644
--- a/apps/sim/blocks/blocks/ketch.ts
+++ b/apps/sim/blocks/blocks/ketch.ts
@@ -1,6 +1,7 @@
import { KetchIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
export const KetchBlock: BlockConfig = {
type: 'ketch',
@@ -186,7 +187,8 @@ export const KetchBlock: BlockConfig = {
],
config: {
tool: (params) => `ketch_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {
organizationCode: params.organizationCode,
propertyCode: params.propertyCode,
@@ -203,20 +205,20 @@ export const KetchBlock: BlockConfig = {
: params.identities
}
- if (params.operation === 'get_consent' && params.purposesFilter) {
+ if (operation === 'get_consent' && params.purposesFilter) {
result.purposes =
typeof params.purposesFilter === 'string'
? JSON.parse(params.purposesFilter)
: params.purposesFilter
}
- if (params.operation === 'set_consent' && params.purposes) {
+ if (operation === 'set_consent' && params.purposes) {
result.purposes =
typeof params.purposes === 'string' ? JSON.parse(params.purposes) : params.purposes
if (params.collectedAt) result.collectedAt = Number(params.collectedAt)
}
- if (params.operation === 'set_subscriptions') {
+ if (operation === 'set_subscriptions') {
if (params.topics) {
result.topics =
typeof params.topics === 'string' ? JSON.parse(params.topics) : params.topics
@@ -227,7 +229,7 @@ export const KetchBlock: BlockConfig = {
}
}
- if (params.operation === 'invoke_right') {
+ if (operation === 'invoke_right') {
if (params.rightCode) result.rightCode = params.rightCode
if (params.userData) {
result.userData =
diff --git a/apps/sim/blocks/blocks/knowledge.test.ts b/apps/sim/blocks/blocks/knowledge.test.ts
new file mode 100644
index 00000000000..280384bffb9
--- /dev/null
+++ b/apps/sim/blocks/blocks/knowledge.test.ts
@@ -0,0 +1,51 @@
+import { describe, expect, it } from 'vitest'
+import { KnowledgeBlock } from '@/blocks/blocks/knowledge'
+
+function mapToolCall(params: Record, operation: string) {
+ const mapper = KnowledgeBlock.tools.config?.params
+ if (!mapper) throw new Error('Knowledge block has no params mapper')
+ return mapper(params, { operation })
+}
+
+describe('Knowledge mapper on tool calls (operation only in context)', () => {
+ it('coerces a model-sent "false" to a boolean for update_chunk', () => {
+ const mapped = mapToolCall(
+ { knowledgeBaseId: 'kb-1', documentId: 'doc-1', chunkId: 'chunk-1', enabled: 'false' },
+ 'update_chunk'
+ )
+
+ expect(mapped.enabled).toBe(false)
+ })
+
+ it('forwards the stored status filter and search for list_chunks', () => {
+ const mapped = mapToolCall(
+ {
+ knowledgeBaseId: 'kb-1',
+ documentId: 'doc-1',
+ chunkSearch: 'pricing',
+ chunkEnabledFilter: 'false',
+ },
+ 'list_chunks'
+ )
+
+ expect(mapped).toMatchObject({ search: 'pricing', enabled: 'false' })
+ })
+
+ it('keeps the model status filter when the stored row holds the default "all"', () => {
+ const mapped = mapToolCall(
+ { knowledgeBaseId: 'kb-1', documentId: 'doc-1', chunkEnabledFilter: 'all', enabled: 'true' },
+ 'list_chunks'
+ )
+
+ expect(mapped.enabled).toBe('true')
+ })
+
+ it('sends the stored upsert document id as documentId', () => {
+ const mapped = mapToolCall(
+ { knowledgeBaseId: 'kb-1', upsertDocumentId: ' doc-9 ', name: 'Doc', content: 'Body' },
+ 'upsert_document'
+ )
+
+ expect(mapped.documentId).toBe('doc-9')
+ })
+})
diff --git a/apps/sim/blocks/blocks/knowledge.ts b/apps/sim/blocks/blocks/knowledge.ts
index 1c89a28c419..291988eddee 100644
--- a/apps/sim/blocks/blocks/knowledge.ts
+++ b/apps/sim/blocks/blocks/knowledge.ts
@@ -2,7 +2,7 @@ import { isPlainRecord } from '@sim/utils/object'
import { PackageSearchIcon } from '@/components/icons'
import { DEFAULT_RERANKER_MODEL, SUPPORTED_RERANKER_MODELS } from '@/lib/knowledge/reranker-models'
import type { BlockConfig } from '@/blocks/types'
-import { getCohereRerankerApiKeyCondition } from '@/blocks/utils'
+import { getCohereRerankerApiKeyCondition, mapperOperation, toolCallArg } from '@/blocks/utils'
/*
* Canonical basic/advanced pairs, shared by the card sentences below. Listing
@@ -448,8 +448,9 @@ export const KnowledgeBlock: BlockConfig = {
return 'knowledge_search'
}
},
- params: (params) => {
+ params: (params, context) => {
params = { ...params }
+ const operation = mapperOperation(params, context)
const knowledgeBaseId = params.knowledgeBaseId ? String(params.knowledgeBaseId).trim() : ''
if (!knowledgeBaseId) {
throw new Error('Knowledge base ID is required')
@@ -464,45 +465,53 @@ export const KnowledgeBlock: BlockConfig = {
'update_chunk',
'delete_chunk',
]
- if (docOps.includes(params.operation)) {
+ if (docOps.includes(operation)) {
const documentId = params.documentId ? String(params.documentId).trim() : ''
if (!documentId) {
- throw new Error(`Document ID is required for ${params.operation} operation`)
+ throw new Error(`Document ID is required for ${operation} operation`)
}
params.documentId = documentId
}
const chunkOps = ['update_chunk', 'delete_chunk']
- if (chunkOps.includes(params.operation)) {
+ if (chunkOps.includes(operation)) {
const chunkId = params.chunkId ? String(params.chunkId).trim() : ''
if (!chunkId) {
- throw new Error(`Chunk ID is required for ${params.operation} operation`)
+ throw new Error(`Chunk ID is required for ${operation} operation`)
}
params.chunkId = chunkId
}
const connectorOps = ['get_connector', 'trigger_sync']
- if (connectorOps.includes(params.operation)) {
+ if (connectorOps.includes(operation)) {
const connectorId = params.connectorId ? String(params.connectorId).trim() : ''
if (!connectorId) {
- throw new Error(`Connector ID is required for ${params.operation} operation`)
+ throw new Error(`Connector ID is required for ${operation} operation`)
}
params.connectorId = connectorId
}
// Map list_chunks sub-block fields to tool params
- if (params.operation === 'list_chunks') {
+ if (operation === 'list_chunks') {
if (params.chunkSearch) params.search = params.chunkSearch
- if (params.chunkEnabledFilter) params.enabled = params.chunkEnabledFilter
+ if (params.chunkEnabledFilter) {
+ const modelEnabled =
+ params.chunkEnabledFilter === 'all' ? toolCallArg(context, params.enabled) : undefined
+ /* The tool takes a string; a model may send the boolean `false`, which must survive. */
+ params.enabled =
+ modelEnabled === undefined || modelEnabled === null || modelEnabled === ''
+ ? params.chunkEnabledFilter
+ : String(modelEnabled)
+ }
}
// Map upsert sub-block field to tool param
- if (params.operation === 'upsert_document' && params.upsertDocumentId) {
+ if (operation === 'upsert_document' && params.upsertDocumentId) {
params.documentId = String(params.upsertDocumentId).trim()
}
if (
- (params.operation === 'create_document' || params.operation === 'upsert_document') &&
+ (operation === 'create_document' || operation === 'upsert_document') &&
typeof params.documentTags === 'string' &&
params.documentTags.trim().length > 0
) {
@@ -515,7 +524,7 @@ export const KnowledgeBlock: BlockConfig = {
}
// Convert enabled dropdown string to boolean for update_chunk
- if (params.operation === 'update_chunk' && typeof params.enabled === 'string') {
+ if (operation === 'update_chunk' && typeof params.enabled === 'string') {
params.enabled = params.enabled === 'true'
}
diff --git a/apps/sim/blocks/blocks/lambda.test.ts b/apps/sim/blocks/blocks/lambda.test.ts
index 2b6558ebb63..7ecf979d872 100644
--- a/apps/sim/blocks/blocks/lambda.test.ts
+++ b/apps/sim/blocks/blocks/lambda.test.ts
@@ -168,4 +168,22 @@ describe('LambdaBlock params mapping', () => {
})
).toThrow('filterPatterns must be a JSON array')
})
+
+ it('maps an agent tool call, where the operation arrives only in the context', () => {
+ const modelArgs = {
+ ...CONNECTION,
+ functionName: 'alpha',
+ eventSourceArn: 'arn:aws:sqs:us-east-1:1:queue',
+ batchSize: '10',
+ filterPatterns: [{ body: { status: ['open'] } }],
+ }
+
+ const mapped = toolConfig?.params?.(modelArgs, {
+ operation: 'create_event_source_mapping',
+ }) as Record
+
+ expect(mapped.batchSize).toBe(10)
+ expect(mapped.filterPatterns).toEqual(['{"body":{"status":["open"]}}'])
+ expect(mapped.functionName).toBe('alpha')
+ })
})
diff --git a/apps/sim/blocks/blocks/lambda.ts b/apps/sim/blocks/blocks/lambda.ts
index 1bebcaf688b..b5cadb0a155 100644
--- a/apps/sim/blocks/blocks/lambda.ts
+++ b/apps/sim/blocks/blocks/lambda.ts
@@ -2,7 +2,7 @@ import { getErrorMessage } from '@sim/utils/errors'
import { LambdaIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
type ParamKind = 'string' | 'number' | 'boolean' | 'json' | 'array' | 'jsonArray'
@@ -1957,11 +1957,11 @@ export const LambdaBlock: BlockConfig = {
}
return `lambda_${operation}`
},
- params: (params) => {
- const operation = String(params.operation ?? '')
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const owned = OPERATION_PARAMS[operation]
if (!owned) {
- throw new Error(`Invalid Lambda operation: ${params.operation}`)
+ throw new Error(`Invalid Lambda operation: ${operation}`)
}
const ownedNames = new Set(owned)
diff --git a/apps/sim/blocks/blocks/langsmith.test.ts b/apps/sim/blocks/blocks/langsmith.test.ts
new file mode 100644
index 00000000000..9ae7ff9d66e
--- /dev/null
+++ b/apps/sim/blocks/blocks/langsmith.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from 'vitest'
+import { LangsmithBlock } from '@/blocks/blocks/langsmith'
+
+const buildParams = LangsmithBlock.tools.config?.params
+if (!buildParams) throw new Error('LangsmithBlock has no params mapper')
+
+describe('LangsmithBlock', () => {
+ /**
+ * The model names the create-run outputs after the tool's `run_outputs` param, not the
+ * block's `outputs` field; the mapper must not overwrite them with the empty field.
+ */
+ it('keeps model run outputs on an agent create-run call', () => {
+ const args = { apiKey: 'key', name: 'run', run_type: 'chain', run_outputs: { answer: 42 } }
+
+ expect(
+ { ...args, ...buildParams(args, { operation: 'langsmith_create_run' }) }.run_outputs
+ ).toEqual({ answer: 42 })
+ })
+})
diff --git a/apps/sim/blocks/blocks/langsmith.ts b/apps/sim/blocks/blocks/langsmith.ts
index ac7b3bbc4f9..2602e11e7e8 100644
--- a/apps/sim/blocks/blocks/langsmith.ts
+++ b/apps/sim/blocks/blocks/langsmith.ts
@@ -1,7 +1,7 @@
import { toError } from '@sim/utils/errors'
import { LangsmithIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const LangsmithBlock: BlockConfig = {
type: 'langsmith',
@@ -315,7 +315,8 @@ Common patch fields: outputs, end_time, status, error`,
],
config: {
tool: (params) => params.operation,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const parseJsonValue = (value: unknown, label: string) => {
if (value === undefined || value === null || value === '') {
return undefined
@@ -332,7 +333,7 @@ Common patch fields: outputs, end_time, status, error`,
const emptyToUndefined = (value: unknown) => (value === '' ? undefined : value)
- if (params.operation === 'langsmith_create_runs_batch') {
+ if (operation === 'langsmith_create_runs_batch') {
const post = parseJsonValue(params.post, 'post runs')
const patch = parseJsonValue(params.patch, 'patch runs')
@@ -347,7 +348,7 @@ Common patch fields: outputs, end_time, status, error`,
}
}
- if (params.operation === 'langsmith_update_run') {
+ if (operation === 'langsmith_update_run') {
const name = emptyToUndefined(params.name)
const end_time = emptyToUndefined(params.end_time)
const outputs = parseJsonValue(params.outputs, 'outputs')
@@ -379,14 +380,14 @@ Common patch fields: outputs, end_time, status, error`,
}
}
- if (params.operation === 'langsmith_get_run') {
+ if (operation === 'langsmith_get_run') {
return {
apiKey: params.apiKey,
runId: params.runId,
}
}
- if (params.operation === 'langsmith_create_feedback') {
+ if (operation === 'langsmith_create_feedback') {
const parseScore = (value: unknown) => {
if (value === undefined || value === null || value === '') {
return undefined
@@ -418,7 +419,10 @@ Common patch fields: outputs, end_time, status, error`,
start_time: params.start_time,
end_time: params.end_time,
inputs: parseJsonValue(params.inputs, 'inputs'),
- run_outputs: parseJsonValue(params.outputs, 'outputs'),
+ run_outputs: parseJsonValue(
+ params.outputs || toolCallArg(context, params.run_outputs),
+ 'outputs'
+ ),
extra: parseJsonValue(params.extra, 'metadata'),
tags: parseJsonValue(params.tags, 'tags'),
parent_run_id: params.parent_run_id,
diff --git a/apps/sim/blocks/blocks/latex.test.ts b/apps/sim/blocks/blocks/latex.test.ts
new file mode 100644
index 00000000000..19a05f57653
--- /dev/null
+++ b/apps/sim/blocks/blocks/latex.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest'
+import { LatexBlock } from '@/blocks/blocks/latex'
+
+const mapParams = LatexBlock.tools.config?.params
+if (!mapParams) throw new Error('LatexBlock has no params mapper')
+
+describe('LatexBlock agent tool calls', () => {
+ it('forwards a search query typed into the tool row, which carries no operation in its params', () => {
+ expect(
+ mapParams({ packageQuery: 'chemistry' }, { operation: 'latex_search_packages' })
+ ).toEqual({ query: 'chemistry' })
+ })
+
+ it('keeps the model query and name when the tool row leaves the block fields blank', () => {
+ expect(
+ mapParams({ packageQuery: '', query: 'tikz' }, { operation: 'latex_search_packages' })
+ ).toEqual({ query: 'tikz' })
+ expect(mapParams({ name: ' amsmath ' }, { operation: 'latex_get_package' })).toEqual({
+ name: 'amsmath',
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/latex.ts b/apps/sim/blocks/blocks/latex.ts
index f47c343128a..323e29a92e3 100644
--- a/apps/sim/blocks/blocks/latex.ts
+++ b/apps/sim/blocks/blocks/latex.ts
@@ -1,6 +1,7 @@
import { LatexIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
export const LatexBlock: BlockConfig = {
type: 'latex',
@@ -158,9 +159,9 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
return 'latex_compile'
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
compiler,
fileName,
resources,
@@ -179,13 +180,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
if (operation === 'latex_search_packages') {
return {
- query: packageQuery,
+ query: toolCallArg(context, packageQuery || params.query) ?? packageQuery,
...maxResultsParam,
}
}
if (operation === 'latex_get_package') {
- const effectivePackageName = typeof packageName === 'string' ? packageName.trim() : ''
+ const requestedName = toolCallArg(context, packageName || params.name) ?? packageName
+ const effectivePackageName = typeof requestedName === 'string' ? requestedName.trim() : ''
if (!effectivePackageName) {
throw new Error('Package name is required.')
}
diff --git a/apps/sim/blocks/blocks/launchdarkly.test.ts b/apps/sim/blocks/blocks/launchdarkly.test.ts
new file mode 100644
index 00000000000..ed3237145e0
--- /dev/null
+++ b/apps/sim/blocks/blocks/launchdarkly.test.ts
@@ -0,0 +1,23 @@
+import { describe, expect, it } from 'vitest'
+import { LaunchDarklyBlock } from '@/blocks/blocks/launchdarkly'
+
+type Params = Record
+
+const toolCall = (args: Params, operation: string): Params =>
+ LaunchDarklyBlock.tools.config?.params?.(args as never, { operation }) as Params
+
+describe('LaunchDarkly agent tool calls', () => {
+ it('keeps the model name, key and boolean temporary flag on create_flag', () => {
+ const mapped = toolCall(
+ { projectKey: 'default', name: 'New checkout', key: 'new-checkout', temporary: true },
+ 'create_flag'
+ )
+ expect(mapped).toMatchObject({ name: 'New checkout', key: 'new-checkout', temporary: true })
+ })
+
+ it('keeps a boolean archive on update_flag', () => {
+ expect(
+ toolCall({ projectKey: 'default', flagKey: 'old-flag', archive: true }, 'update_flag').archive
+ ).toBe(true)
+ })
+})
diff --git a/apps/sim/blocks/blocks/launchdarkly.ts b/apps/sim/blocks/blocks/launchdarkly.ts
index 4c07a164470..30a888ad1f8 100644
--- a/apps/sim/blocks/blocks/launchdarkly.ts
+++ b/apps/sim/blocks/blocks/launchdarkly.ts
@@ -1,7 +1,7 @@
import { LaunchDarklyIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
export const LaunchDarklyBlock: BlockConfig = {
type: 'launchdarkly',
@@ -329,23 +329,24 @@ Return ONLY the resource specifier string - no explanations, no extra text.`,
const operation = params.operation || 'list_flags'
return `launchdarkly_${operation}`
},
- params: (params) => {
- const { operation, flagName, newFlagKey, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { flagName, newFlagKey, ...rest } = params
if (operation === 'create_flag') {
- rest.name = flagName
- rest.key = newFlagKey
+ rest.name = flagName ?? toolCallArg(context, params.name)
+ rest.key = newFlagKey ?? toolCallArg(context, params.key)
}
if (operation === 'toggle_flag') {
- rest.enabled = rest.enabled === 'true'
+ rest.enabled = rest.enabled === true || rest.enabled === 'true'
}
if (rest.temporary !== undefined) {
- rest.temporary = rest.temporary === 'true'
+ rest.temporary = rest.temporary === true || rest.temporary === 'true'
}
- if (rest.archive !== undefined) {
+ if (rest.archive !== undefined && typeof rest.archive !== 'boolean') {
if (rest.archive === 'true') rest.archive = true
else if (rest.archive === 'false') rest.archive = false
else rest.archive = undefined
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..731b5380c2a 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,55 @@ 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 +2377,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 +2387,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 +2427,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 +2449,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 +2471,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 +2493,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 +2524,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 +2575,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 +2610,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 +2624,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 +2797,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/linkedin.ts b/apps/sim/blocks/blocks/linkedin.ts
index 55ea31c45a0..5d0498b3bf4 100644
--- a/apps/sim/blocks/blocks/linkedin.ts
+++ b/apps/sim/blocks/blocks/linkedin.ts
@@ -2,6 +2,7 @@ import { LinkedInIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
export const LinkedInBlock: BlockConfig = {
type: 'linkedin',
@@ -103,8 +104,8 @@ export const LinkedInBlock: BlockConfig = {
return 'linkedin_share_post'
},
- params: (inputs) => {
- const operation = inputs.operation || 'share_post'
+ params: (inputs, context) => {
+ const operation = mapperOperation(inputs, context) || 'share_post'
const { oauthCredential, ...rest } = inputs
if (operation === 'get_profile') {
diff --git a/apps/sim/blocks/blocks/linq.test.ts b/apps/sim/blocks/blocks/linq.test.ts
new file mode 100644
index 00000000000..42604b97870
--- /dev/null
+++ b/apps/sim/blocks/blocks/linq.test.ts
@@ -0,0 +1,20 @@
+import { describe, expect, it } from 'vitest'
+import { LinqBlock } from '@/blocks/blocks/linq'
+
+type Params = Record
+
+const toolCall = (args: Params, operation: string): Params =>
+ LinqBlock.tools.config?.params?.(args as never, { operation }) as Params
+
+describe('Linq agent tool calls', () => {
+ it('unwraps a single picked file on create_attachment', () => {
+ const file = {
+ id: 'f1',
+ name: 'card.png',
+ key: 'workspace/ws/card.png',
+ size: 10,
+ type: 'image/png',
+ }
+ expect(toolCall({ file: [file] }, 'create_attachment').file).toEqual(file)
+ })
+})
diff --git a/apps/sim/blocks/blocks/linq.ts b/apps/sim/blocks/blocks/linq.ts
index 50f58eaf7ba..b9072c5d099 100644
--- a/apps/sim/blocks/blocks/linq.ts
+++ b/apps/sim/blocks/blocks/linq.ts
@@ -1,7 +1,7 @@
import { LinqIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { normalizeFileInput, withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, normalizeFileInput, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const CHAT_ID_OPS = [
@@ -781,9 +781,9 @@ export const LinqBlock: BlockConfig = {
],
config: {
tool: (params) => `linq_${params.operation || 'send_message'}`,
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
- operation,
senderFrom,
recipients,
messageText,
@@ -881,7 +881,6 @@ export const LinqBlock: BlockConfig = {
}
if (operation === 'react_to_message') {
- if (reactionOperation) rest.operation = reactionOperation
if (reactionType) rest.type = reactionType
if (reactionCustomEmoji) rest.customEmoji = reactionCustomEmoji
if (reactionPartIndex !== undefined && reactionPartIndex !== '') {
@@ -940,6 +939,11 @@ export const LinqBlock: BlockConfig = {
rest.limit = toFiniteNumber(limit, 'Limit')
}
+ // The react tool declares its own `operation` param: add or remove.
+ if (operation === 'react_to_message' && reactionOperation) {
+ return { ...rest, operation: reactionOperation }
+ }
+
return rest
},
},
diff --git a/apps/sim/blocks/blocks/logfire.ts b/apps/sim/blocks/blocks/logfire.ts
index 7c651b997ab..afe1544209a 100644
--- a/apps/sim/blocks/blocks/logfire.ts
+++ b/apps/sim/blocks/blocks/logfire.ts
@@ -2,7 +2,7 @@ import { Bug, ClipboardList, Clock, Database, File, Search, Server } from '@sim/
import { LogfireIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
const toBoolean = (value: unknown): boolean | undefined => {
if (value === true || value === 'true') return true
@@ -311,7 +311,7 @@ Return ONLY the IANA timezone string - no explanations or quotes.`,
],
config: {
tool: (params) => String(params.operation || 'logfire_search_records'),
- params: (params) => {
+ params: (params, context) => {
const baseParams = {
apiKey: params.apiKey,
region: params.region || 'auto',
@@ -324,7 +324,7 @@ Return ONLY the IANA timezone string - no explanations or quotes.`,
limit: toNumber(params.limit),
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'logfire_query':
return {
...baseParams,
diff --git a/apps/sim/blocks/blocks/logrocket.ts b/apps/sim/blocks/blocks/logrocket.ts
index 462782e64c5..1f48f274aef 100644
--- a/apps/sim/blocks/blocks/logrocket.ts
+++ b/apps/sim/blocks/blocks/logrocket.ts
@@ -1,5 +1,6 @@
import { LogRocketIcon } from '@/components/icons'
import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
/**
* A highlights request identifies its subject by email or user ID — either one
@@ -286,10 +287,10 @@ export const LogRocketBlock: BlockConfig = {
],
config: {
tool: (params) => `logrocket_${params.operation}`,
- params: (params) => {
+ params: (params, context) => {
const result: Record = {}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'request_highlights':
if (params.highlightsUserEmail) result.userEmail = params.highlightsUserEmail
if (params.highlightsUserId) result.userID = params.highlightsUserId
diff --git a/apps/sim/blocks/blocks/logs.test.ts b/apps/sim/blocks/blocks/logs.test.ts
index 3ecfb864333..44b0c1cf5a9 100644
--- a/apps/sim/blocks/blocks/logs.test.ts
+++ b/apps/sim/blocks/blocks/logs.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { LogsV2Block } from '@/blocks/blocks/logs'
+import { LogsBlock, LogsV2Block } from '@/blocks/blocks/logs'
function buildQueryParams(params: Record) {
return LogsV2Block.tools.config!.params!({ operation: 'query', ...params })
@@ -77,3 +77,25 @@ describe('LogsV2Block backwards compatibility', () => {
expect(JSON.stringify(params)).not.toContain('triggers')
})
})
+
+describe('LogsBlock agent tool calls', () => {
+ const mapParams = LogsBlock.tools.config?.params
+ if (!mapParams) throw new Error('LogsBlock has no params mapper')
+
+ it('sends the log id typed into the tool row instead of query filters', () => {
+ expect(mapParams({ logId: 'log-1' }, { operation: 'get_log' })).toEqual({ id: 'log-1' })
+ })
+
+ it('sends the execution id typed into the tool row instead of query filters', () => {
+ expect(mapParams({ executionIdLookup: 'exec-1' }, { operation: 'get_execution' })).toEqual({
+ executionId: 'exec-1',
+ })
+ })
+
+ it('keeps the model-supplied id when the tool row leaves the block field blank', () => {
+ expect(mapParams({ id: 'log-2' }, { operation: 'get_log' })).toEqual({ id: 'log-2' })
+ expect(mapParams({ executionId: 'exec-2' }, { operation: 'get_execution' })).toEqual({
+ executionId: 'exec-2',
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/logs.ts b/apps/sim/blocks/blocks/logs.ts
index 7970a8b0d03..8050abf9fac 100644
--- a/apps/sim/blocks/blocks/logs.ts
+++ b/apps/sim/blocks/blocks/logs.ts
@@ -1,5 +1,6 @@
import { Library } from '@sim/emcn/icons'
import type { BlockConfig } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
export const LogsBlock: BlockConfig = {
type: 'logs',
@@ -191,23 +192,25 @@ export const LogsBlock: BlockConfig = {
if (operation === 'get_execution') return 'logs_get_execution'
return 'logs_query'
},
- params: (params: Record) => {
- const operation = params.operation || 'query'
+ params: (params: Record, context) => {
+ const operation = mapperOperation(params, context) || 'query'
if (operation === 'get_log') {
- if (!params.logId) {
+ const logId = params.logId || toolCallArg(context, params.id)
+ if (!logId) {
throw new Error('Logs Block Error: Log ID is required for get_log operation')
}
- return { id: params.logId }
+ return { id: logId }
}
if (operation === 'get_execution') {
- if (!params.executionIdLookup) {
+ const executionId = params.executionIdLookup || toolCallArg(context, params.executionId)
+ if (!executionId) {
throw new Error(
'Logs Block Error: Execution ID is required for get_execution operation'
)
}
- return { executionId: params.executionIdLookup }
+ return { executionId }
}
const rawLimit =
@@ -551,8 +554,8 @@ export const LogsV2Block: BlockConfig = {
if (operation === 'get_run_details') return 'logs_get_run_details'
return 'logs_query_runs'
},
- params: (params: Record) => {
- const operation = params.operation || 'query'
+ params: (params: Record, context) => {
+ const operation = mapperOperation(params, context) || 'query'
if (operation === 'get_run_details') {
if (!params.runId) {
diff --git a/apps/sim/blocks/blocks/loops.ts b/apps/sim/blocks/blocks/loops.ts
index a957b6a8401..ec1fe28eff0 100644
--- a/apps/sim/blocks/blocks/loops.ts
+++ b/apps/sim/blocks/blocks/loops.ts
@@ -1,7 +1,7 @@
import { LoopsIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/** How a contact is identified — email or user id, whichever the user filled. */
@@ -510,8 +510,9 @@ Return ONLY the JSON object - no explanations, no extra text.`,
],
config: {
tool: (params) => `loops_${params.operation}`,
- params: (params) => {
- const { operation, apiKey } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { apiKey } = params
const result: Record = { apiKey }
switch (operation) {
@@ -571,8 +572,8 @@ Return ONLY the JSON object - no explanations, no extra text.`,
break
case 'create_contact_property':
- result.name = params.propertyName
- result.type = params.propertyType
+ result.name = params.propertyName ?? toolCallArg(context, params.name)
+ result.type = params.propertyType ?? toolCallArg(context, params.type)
break
case 'list_contact_properties':
diff --git a/apps/sim/blocks/blocks/mailgun.test.ts b/apps/sim/blocks/blocks/mailgun.test.ts
new file mode 100644
index 00000000000..93f46b9ed03
--- /dev/null
+++ b/apps/sim/blocks/blocks/mailgun.test.ts
@@ -0,0 +1,131 @@
+/**
+ * Tool calls pass the operation only in context and supply model arguments under the tool's param
+ * names, so the add-member mapping must run there without overwriting what the model sent. An Agent
+ * tool row never stores Member Email or Member Name (no tool param matches them); the block-field
+ * case covers surfaces that pass raw block params with a context operation.
+ */
+import { describe, expect, it } from 'vitest'
+import { MailgunV2Block } from '@/blocks/blocks/mailgun'
+import type { BlockToolParamsContext } from '@/blocks/types'
+import { mailgunAddListMemberTool } from '@/tools/mailgun/add_list_member'
+import { mailgunGetMailingListTool } from '@/tools/mailgun/get_mailing_list'
+import type { ToolConfig } from '@/tools/types'
+import { validateRequiredParametersAfterMerge } from '@/tools/utils'
+
+function mapParams(
+ inputs: Record,
+ context?: BlockToolParamsContext
+): Record {
+ const mapped = MailgunV2Block.tools.config?.params?.(inputs, context) ?? {}
+ return { ...inputs, ...mapped }
+}
+
+function requestUrl(tool: ToolConfig, params: Record): string {
+ const url = tool.request.url
+ return typeof url === 'function' ? url(params) : url
+}
+
+function formFields(
+ params: Record,
+ tool: ToolConfig = mailgunAddListMemberTool
+): Record {
+ const build = tool.request.body
+ if (typeof build !== 'function') throw new Error('add_list_member has no request body')
+ const { body } = build(params) as { body: FormData }
+ return Object.fromEntries(body.entries())
+}
+
+describe('Mailgun block add_list_member mapping', () => {
+ it('adds the member the model named to the list the model named', () => {
+ const params = mapParams(
+ { apiKey: 'key', listAddress: 'news@mg.example.com', address: 'alice@example.com' },
+ { operation: 'add_list_member' }
+ )
+ expect(requestUrl(mailgunAddListMemberTool, params)).toBe(
+ 'https://api.mailgun.net/v3/lists/news@mg.example.com/members'
+ )
+ expect(formFields(params).address).toBe('alice@example.com')
+ })
+
+ it('sends block-field Member Email and Name instead of the list address on a tool call', () => {
+ const params = mapParams(
+ {
+ apiKey: 'key',
+ listAddress: 'news@mg.example.com',
+ address: 'news@mg.example.com',
+ memberAddress: 'bob@example.com',
+ memberName: 'Bob',
+ },
+ { operation: 'add_list_member' }
+ )
+ expect(formFields(params)).toMatchObject({ address: 'bob@example.com', name: 'Bob' })
+ })
+
+ it('adds the member even when the model names the list address as the member', () => {
+ const params = mapParams(
+ { apiKey: 'key', listAddress: 'news@mg.example.com', address: 'news@mg.example.com' },
+ { operation: 'add_list_member', pinnedParams: new Set(['apiKey']) }
+ )
+ expect(formFields(params).address).toBe('news@mg.example.com')
+ })
+
+ it('never adds the row-saved List Address to its own list as a member', () => {
+ const params = mapParams(
+ { apiKey: 'key', address: 'news@mg.example.com' },
+ { operation: 'add_list_member', pinnedParams: new Set(['apiKey', 'address']) }
+ )
+ expect(requestUrl(mailgunAddListMemberTool, params)).toBe(
+ 'https://api.mailgun.net/v3/lists/news@mg.example.com/members'
+ )
+ expect(() =>
+ validateRequiredParametersAfterMerge(
+ 'mailgun_add_list_member',
+ mailgunAddListMemberTool,
+ params
+ )
+ ).toThrow('Address is required')
+ })
+
+ it.each([
+ ['a stored string', 'false', 'no'],
+ ['a model boolean', false, 'no'],
+ ['a model boolean', true, 'yes'],
+ ])('honors subscribed given as %s (%j) on a tool call', (_label, subscribed, expected) => {
+ const params = mapParams(
+ { apiKey: 'key', listAddress: 'l@mg.example.com', address: 'a@x.com', subscribed },
+ { operation: 'add_list_member' }
+ )
+ expect(formFields(params).subscribed).toBe(expected)
+ })
+
+ it('maps the canvas List Address and Member Email as before', () => {
+ const params = mapParams({
+ apiKey: 'key',
+ operation: 'add_list_member',
+ address: 'news@mg.example.com',
+ memberAddress: 'carol@example.com',
+ subscribed: 'false',
+ })
+ expect(requestUrl(mailgunAddListMemberTool, params)).toBe(
+ 'https://api.mailgun.net/v3/lists/news@mg.example.com/members'
+ )
+ expect(formFields(params)).toMatchObject({ address: 'carol@example.com', subscribed: 'no' })
+ })
+})
+
+describe('Mailgun list address path segment', () => {
+ it('rejects a list address that would escape its path segment', () => {
+ expect(() =>
+ requestUrl(mailgunGetMailingListTool, {
+ apiKey: 'key',
+ address: 'x@mg.example.com/../../domains',
+ })
+ ).toThrow(/path separator/)
+ })
+
+ it('keeps a query delimiter inside the segment', () => {
+ expect(
+ requestUrl(mailgunGetMailingListTool, { apiKey: 'key', address: 'news+a@mg.example.com?x=1' })
+ ).toBe('https://api.mailgun.net/v3/lists/news+a@mg.example.com%3Fx=1')
+ })
+})
diff --git a/apps/sim/blocks/blocks/mailgun.ts b/apps/sim/blocks/blocks/mailgun.ts
index 58f90b9cb72..7c4f64ea5f7 100644
--- a/apps/sim/blocks/blocks/mailgun.ts
+++ b/apps/sim/blocks/blocks/mailgun.ts
@@ -1,7 +1,13 @@
import { MailgunIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import {
+ isToolCall,
+ mapperOperation,
+ parseOptionalBooleanInput,
+ toolCallArg,
+ withSavedCredential,
+} from '@/blocks/utils'
export const MailgunBlock: BlockConfig = {
type: 'mailgun',
@@ -395,17 +401,25 @@ Return ONLY the JSON object - no explanations or markdown.`,
],
config: {
tool: (params) => `mailgun_${params.operation}`,
- params: (params) => {
- const { operation, memberAddress, memberName, ...rest } = params
+ params: (params, context) => {
+ const { memberAddress, memberName, ...rest } = params
- // Handle special field mappings for add_list_member
- if (operation === 'add_list_member') {
+ if (mapperOperation(params, context) === 'add_list_member') {
+ /**
+ * The block's List Address field is stored under `address`, the tool's member param.
+ * On the canvas, and on a tool call whose row saved that field, `address` is the list;
+ * otherwise it is the member the model named.
+ */
+ const addressIsList =
+ !isToolCall(context) || Boolean(context?.pinnedParams?.has('address'))
return {
...rest,
- listAddress: params.address,
- address: memberAddress,
- name: memberName,
- subscribed: params.subscribed === 'true',
+ listAddress: addressIsList ? params.address : params.listAddress,
+ address: memberAddress || (addressIsList ? undefined : params.address),
+ name: memberName || toolCallArg(context, params.name),
+ subscribed: isToolCall(context)
+ ? parseOptionalBooleanInput(params.subscribed)
+ : params.subscribed === 'true',
}
}
@@ -518,7 +532,7 @@ export const MailgunBlockMeta = {
icon: MailgunIcon,
title: 'Mailgun domain verification monitor',
prompt:
- 'Create a scheduled workflow that checks the status of each Mailgun sending domain, flags any domain whose SPF, DKIM, or tracking records fall out of verification, and pages the on-call engineer in Slack with the exact records that need fixing.',
+ 'Create a scheduled workflow that checks the state of each Mailgun sending domain, flags any domain that is no longer active, and pages the on-call engineer in Slack with the domain name and its current state.',
modules: ['scheduled', 'agent', 'workflows'],
category: 'operations',
tags: ['monitoring', 'automation', 'enterprise'],
@@ -531,7 +545,7 @@ export const MailgunBlockMeta = {
description:
'Send a transactional email through a Mailgun sending domain to one or more recipients.',
content:
- '# Send Transactional Email\n\nDeliver an email through Mailgun.\n\n## Steps\n1. Confirm the verified sending domain to use, listing domains first if unsure.\n2. Compose the message with from, to, subject, and an HTML or text body.\n3. Send Message with those fields, adding CC, BCC, or attachments as needed.\n\n## Output\nConfirmation of acceptance with the Mailgun message ID and the recipients it was queued to.',
+ '# Send Transactional Email\n\nDeliver an email through Mailgun.\n\n## Steps\n1. Confirm the verified sending domain to use, listing domains first if unsure.\n2. Compose the message with from, to, subject, and an HTML or text body.\n3. Send Message with those fields, adding CC or BCC recipients and tags as needed.\n\n## Output\nConfirmation of acceptance with the Mailgun message ID and the recipients it was queued to.',
},
{
name: 'track-delivery-events',
diff --git a/apps/sim/blocks/blocks/manageengine-sdp.ts b/apps/sim/blocks/blocks/manageengine-sdp.ts
index d95924575f8..35f485fbf60 100644
--- a/apps/sim/blocks/blocks/manageengine-sdp.ts
+++ b/apps/sim/blocks/blocks/manageengine-sdp.ts
@@ -2,6 +2,7 @@ import { ManageEngineIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { isToolCall, mapperOperation } from '@/blocks/utils'
import { SDP_DATA_CENTER_BASES } from '@/tools/manageengine_sdp/data-centers'
/**
@@ -1055,14 +1056,12 @@ export const ManageEngineSdpBlock: BlockConfig = {
],
config: {
tool: (params) => `manageengine_sdp_${params.operation}`,
- params: (params) => {
- // The agent-tool path does not carry `operation` inside params - it is a
- // sibling of the tool call, used only to pick the tool - and there the
- // model addresses tool params by their real names. The tool is already
- // selected, so there is no cross-operation leak to guard against, while
- // running the scoping below WOULD overwrite the model's own values with
- // `undefined`.
- if (typeof params.operation !== 'string') return params
+ params: (params, context) => {
+ // On a tool call the model addresses tool params by their real names and
+ // the tool is already selected, so there is no cross-operation leak to
+ // guard against, while running the scoping below WOULD overwrite the
+ // model's own values with `undefined`.
+ if (isToolCall(context)) return params
// IMPORTANT: leaving a key out of the result does NOT keep it from the
// tool. Both call sites merge this return value on top of the original
@@ -1075,7 +1074,7 @@ export const ManageEngineSdpBlock: BlockConfig = {
// under an unrelated operation. Every module-prefixed subBlock below is
// therefore funnelled into the shared tool param name and every
// inactive module's value is explicitly cleared.
- const operation = params.operation
+ const operation = mapperOperation(params, context)
const {
// The five entity ids are destructured out and republished scoped
// below. Passing them through would send a problem id typed earlier to
diff --git a/apps/sim/blocks/blocks/mem0.test.ts b/apps/sim/blocks/blocks/mem0.test.ts
index 7620aba09fa..9757a8e62e7 100644
--- a/apps/sim/blocks/blocks/mem0.test.ts
+++ b/apps/sim/blocks/blocks/mem0.test.ts
@@ -29,4 +29,18 @@ describe('Mem0Block', () => {
})
).toThrow('Each message must have role user or assistant and non-empty content')
})
+
+ it('maps an agent search call, whose operation arrives only in context', () => {
+ const params = buildParams(
+ { apiKey: 'test-key', userId: 'alice', query: 'favorite tools', limit: 5 },
+ { operation: 'search' }
+ )
+
+ expect(params).toEqual({
+ apiKey: 'test-key',
+ userId: 'alice',
+ query: 'favorite tools',
+ limit: 5,
+ })
+ })
})
diff --git a/apps/sim/blocks/blocks/mem0.ts b/apps/sim/blocks/blocks/mem0.ts
index a50dabebff2..c321621cf4a 100644
--- a/apps/sim/blocks/blocks/mem0.ts
+++ b/apps/sim/blocks/blocks/mem0.ts
@@ -1,12 +1,22 @@
import { toError } from '@sim/utils/errors'
import { Mem0Icon } from '@/components/icons'
-import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import {
+ AuthMode,
+ type BlockConfig,
+ type BlockMeta,
+ type BlockToolParamsContext,
+ IntegrationType,
+} from '@/blocks/types'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
import { parseMem0Messages } from '@/tools/mem0/utils'
-function mem0ToolParams(params: Record, requireApiKey: boolean) {
+function mem0ToolParams(
+ params: Record,
+ requireApiKey: boolean,
+ context?: BlockToolParamsContext
+) {
const errors: string[] = []
- const operation = params.operation || 'add'
+ const operation = mapperOperation(params, context) || 'add'
if (requireApiKey && !params.apiKey) {
errors.push('API Key is required')
@@ -269,7 +279,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
return 'mem0_add_memories'
}
},
- params: (params) => mem0ToolParams(params, true),
+ params: (params, context) => mem0ToolParams(params, true, context),
},
},
inputs: {
@@ -403,6 +413,6 @@ export const Mem0V2Block: BlockConfig = {
...withSavedCredential(
Mem0Block,
{ id: 'credential', type: 'oauth-input', serviceId: 'mem0', title: 'Mem0 Credential' },
- { params: (params) => mem0ToolParams(params, false) }
+ { params: (params, context) => mem0ToolParams(params, false, context) }
),
}
diff --git a/apps/sim/blocks/blocks/memory.ts b/apps/sim/blocks/blocks/memory.ts
index 8858883156d..463d3bb0a9d 100644
--- a/apps/sim/blocks/blocks/memory.ts
+++ b/apps/sim/blocks/blocks/memory.ts
@@ -1,5 +1,6 @@
import { BrainIcon } from '@/components/icons'
import type { BlockConfig } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
export const MemoryBlock: BlockConfig = {
type: 'memory',
@@ -121,24 +122,25 @@ export const MemoryBlock: BlockConfig = {
return 'memory_add'
}
},
- params: (params: Record) => {
+ params: (params: Record, context) => {
+ const operation = mapperOperation(params, context)
const errors: string[] = []
- if (!params.operation) {
+ if (!operation) {
errors.push('Operation is required')
}
const conversationId = params.id || params.conversationId
- if (params.operation === 'add') {
+ if (operation === 'add') {
if (!conversationId) {
errors.push('Conversation ID is required for add operation')
}
}
- if (params.operation === 'get' || params.operation === 'delete') {
+ if (operation === 'get' || operation === 'delete') {
if (!conversationId) {
- errors.push(`Conversation ID is required for ${params.operation} operation`)
+ errors.push(`Conversation ID is required for ${operation} operation`)
}
}
@@ -148,7 +150,7 @@ export const MemoryBlock: BlockConfig = {
const baseResult: Record = {}
- if (params.operation === 'add') {
+ if (operation === 'add') {
return {
...baseResult,
conversationId: conversationId,
@@ -157,14 +159,14 @@ export const MemoryBlock: BlockConfig = {
}
}
- if (params.operation === 'get') {
+ if (operation === 'get') {
return {
...baseResult,
conversationId: conversationId,
}
}
- if (params.operation === 'delete') {
+ if (operation === 'delete') {
return {
...baseResult,
conversationId: conversationId,
diff --git a/apps/sim/blocks/blocks/microsoft_ad.test.ts b/apps/sim/blocks/blocks/microsoft_ad.test.ts
index 12f343f31a8..85d1be88a5e 100644
--- a/apps/sim/blocks/blocks/microsoft_ad.test.ts
+++ b/apps/sim/blocks/blocks/microsoft_ad.test.ts
@@ -84,10 +84,14 @@ describe('MicrosoftAdBlock', () => {
* the per-operation fields (`signInFilter`, `deviceSearch`, `membershipScope`) are never rendered.
*/
describe('MicrosoftAdBlock agent tool calls', () => {
- const agentCall = (operation: string, args: Record): Record => {
- const inputs = { ...args, operation }
- return { ...inputs, ...buildParams(inputs, { operation }) }
- }
+ /** A tool call carries the operation only in `context`, never in the merged params. */
+ const agentCall = (
+ operation: string,
+ args: Record
+ ): Record => ({
+ ...args,
+ ...buildParams(args, { operation }),
+ })
it('keeps the model filter on an operation with a dedicated filter field', () => {
const mapped = agentCall('list_sign_ins', { filter: 'status/errorCode eq 0' })
@@ -105,6 +109,21 @@ describe('MicrosoftAdBlock agent tool calls', () => {
)
})
+ it('forwards a dedicated filter saved on the tool row', () => {
+ const mapped = agentCall('list_sign_ins', { signInFilter: 'status/errorCode ne 0' })
+ expect(mapped.filter).toBe('status/errorCode ne 0')
+ })
+
+ it('keeps boolean group flags the model sends', () => {
+ const mapped = agentCall('create_group', {
+ displayName: 'Eng',
+ mailEnabled: true,
+ securityEnabled: false,
+ })
+ expect(mapped.mailEnabled).toBe(true)
+ expect(mapped.securityEnabled).toBe(false)
+ })
+
it('drops a shared filter left over on the canvas for an operation with its own field', () => {
const inputs = { operation: 'list_sign_ins', filter: 'stale' }
expect({ ...inputs, ...buildParams(inputs) }.filter).toBeUndefined()
diff --git a/apps/sim/blocks/blocks/microsoft_ad.ts b/apps/sim/blocks/blocks/microsoft_ad.ts
index 6e46d5e6bb6..2e5e0b07ba6 100644
--- a/apps/sim/blocks/blocks/microsoft_ad.ts
+++ b/apps/sim/blocks/blocks/microsoft_ad.ts
@@ -2,7 +2,15 @@ import { AzureIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { parseOptionalBooleanInput, toolCallArg } from '@/blocks/utils'
+import { mapperOperation, parseOptionalBooleanInput, toolCallArg } from '@/blocks/utils'
+
+/**
+ * A Yes/No dropdown value as a boolean: `'true'` is true and any other string (including a blank
+ * one) is false, while a boolean a model sent on a tool call passes through unchanged.
+ */
+function dropdownFlag(value: unknown): boolean {
+ return typeof value === 'boolean' ? value : value === 'true'
+}
/** Operations that act on a single user and therefore require the User ID field. */
const USER_ID_OPERATIONS = [
@@ -856,54 +864,55 @@ export const MicrosoftAdBlock: BlockConfig = {
config: {
tool: (params) => `microsoft_ad_${params.operation}`,
params: (params, context) => {
+ const operation = mapperOperation(params, context)
const result: Record = {}
const top = Number(params.top)
result.top = params.top && Number.isFinite(top) ? top : undefined
if (params.nextLink) result.nextLink = params.nextLink
const values = params as Record
result.filter =
- values[FILTER_FIELD_BY_OPERATION[params.operation]] ||
+ values[FILTER_FIELD_BY_OPERATION[operation]] ||
toolCallArg(context, params.filter) ||
undefined
result.search =
- values[SEARCH_FIELD_BY_OPERATION[params.operation]] ||
+ values[SEARCH_FIELD_BY_OPERATION[operation]] ||
toolCallArg(context, params.search) ||
undefined
- if (params.operation === 'get_user') {
+ if (operation === 'get_user') {
result.includeManager = params.includeManager === true || params.includeManager === 'true'
}
- if (params.operation === 'list_user_memberships') {
+ if (operation === 'list_user_memberships') {
result.transitive = params.membershipScope
? params.membershipScope === 'transitive'
: (parseOptionalBooleanInput(toolCallArg(context, params.transitive)) ?? false)
}
- if (params.operation === 'set_password') {
- result.forceChangePasswordNextSignIn = params.forceChangePasswordNextSignIn !== 'false'
- result.forceChangePasswordNextSignInWithMfa = params.forceChangePasswordNextSignInWithMfa
- ? params.forceChangePasswordNextSignInWithMfa === 'true'
- : undefined
+ if (operation === 'set_password') {
+ result.forceChangePasswordNextSignIn =
+ parseOptionalBooleanInput(params.forceChangePasswordNextSignIn) ?? true
+ result.forceChangePasswordNextSignInWithMfa = parseOptionalBooleanInput(
+ params.forceChangePasswordNextSignInWithMfa
+ )
}
- if (params.operation === 'update_user') {
- result.accountEnabled = params.accountEnabled
- ? params.accountEnabled === 'true'
- : undefined
- } else if (params.operation === 'create_user') {
+ if (operation === 'update_user') {
+ result.accountEnabled = parseOptionalBooleanInput(params.accountEnabled)
+ } else if (operation === 'create_user') {
result.accountEnabled = params.accountEnabledCreate
? params.accountEnabledCreate === 'true'
- : undefined
+ : parseOptionalBooleanInput(toolCallArg(context, params.accountEnabled))
}
- if (params.mailEnabled !== undefined) result.mailEnabled = params.mailEnabled === 'true'
+ if (params.mailEnabled !== undefined) result.mailEnabled = dropdownFlag(params.mailEnabled)
if (params.securityEnabled !== undefined)
- result.securityEnabled = params.securityEnabled === 'true'
+ result.securityEnabled = dropdownFlag(params.securityEnabled)
// Map group-specific fields to tool param names
if (params.groupDisplayName) result.displayName = params.groupDisplayName
if (params.groupMailNickname) result.mailNickname = params.groupMailNickname
if (params.groupDescription) result.description = params.groupDescription
if (params.groupTypes !== undefined) result.groupTypes = params.groupTypes
- if (params.operation === 'update_group') {
+ if (operation === 'update_group') {
result.visibility = params.visibility || undefined
- } else if (params.operation === 'create_group') {
- result.visibility = params.visibilityCreate || undefined
+ } else if (operation === 'create_group') {
+ result.visibility =
+ params.visibilityCreate || toolCallArg(context, params.visibility) || undefined
}
return result
},
diff --git a/apps/sim/blocks/blocks/microsoft_dataverse.test.ts b/apps/sim/blocks/blocks/microsoft_dataverse.test.ts
new file mode 100644
index 00000000000..8a87a87e509
--- /dev/null
+++ b/apps/sim/blocks/blocks/microsoft_dataverse.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from 'vitest'
+import { MicrosoftDataverseBlock } from '@/blocks/blocks/microsoft_dataverse'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/**
+ * The params the tool receives: both the canvas handler and the agent tool path spread the mapper's
+ * result over the inputs, so a key the mapper omits still reaches the tool raw.
+ */
+const forwarded = (
+ inputs: Record,
+ context?: BlockToolParamsContext
+): Record => ({
+ ...inputs,
+ ...MicrosoftDataverseBlock.tools.config.params(inputs, context),
+})
+
+describe('MicrosoftDataverseBlock params mapper', () => {
+ it('keeps a record-column select saved for another operation out of the metadata request', () => {
+ const mapped = forwarded({
+ operation: 'get_entity_metadata',
+ entityLogicalName: 'account',
+ select: 'name,accountid',
+ })
+ expect(mapped.select).toBeUndefined()
+ })
+
+ it('forwards the model select on a get_entity_metadata tool call', () => {
+ const mapped = forwarded(
+ { entityLogicalName: 'account', select: 'LogicalName,EntitySetName' },
+ { operation: 'get_entity_metadata' }
+ )
+ expect(mapped.select).toBe('LogicalName,EntitySetName')
+ })
+
+ it('forwards search entities saved on the tool row as the tool entities param', () => {
+ const searchEntities = '[{"Name":"account"}]'
+ const mapped = forwarded({ searchTerm: 'contoso', searchEntities }, { operation: 'search' })
+ expect(mapped.entities).toBe(searchEntities)
+ })
+})
diff --git a/apps/sim/blocks/blocks/microsoft_dataverse.ts b/apps/sim/blocks/blocks/microsoft_dataverse.ts
index d12ccbaa543..63f75cab1e6 100644
--- a/apps/sim/blocks/blocks/microsoft_dataverse.ts
+++ b/apps/sim/blocks/blocks/microsoft_dataverse.ts
@@ -3,7 +3,7 @@ import { MicrosoftDataverseIcon } 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 { mapperOperation, normalizeFileInput, toolCallArg } from '@/blocks/utils'
/** Canonical upload pair for the file column payload, basic then advanced. */
const FILE_FIELD = ['uploadFile', 'fileReference'] as const
@@ -642,8 +642,9 @@ Return ONLY the expand expression - no $expand= prefix, no explanations.`,
],
config: {
tool: (params) => `microsoft_dataverse_${params.operation}`,
- params: (params) => {
- const { credential, operation, file, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ const { credential, file, ...rest } = params
const cleanParams: Record = {
credential,
@@ -667,11 +668,10 @@ Return ONLY the expand expression - no $expand= prefix, no explanations.`,
rest.parameters = undefined
}
if (operation === 'get_entity_metadata') {
- if (rest.metadataSelect) {
- cleanParams.select = rest.metadataSelect
- }
- // The shared `select` subBlock belongs to list/get record operations - clear it so a
- // stale record-column $select can't override or fight the mapped metadataSelect value
+ // The shared `select` subBlock belongs to list/get record operations, so a stale
+ // record-column $select must not reach the metadata request; only a tool call's own
+ // `select` arg stands in for an empty metadataSelect.
+ cleanParams.select = rest.metadataSelect || toolCallArg(context, rest.select) || undefined
rest.select = undefined
}
// Always clean up mapped subBlock IDs so they don't leak through the loop below
diff --git a/apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts b/apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts
index 620abf93464..ac0577a9b2e 100644
--- a/apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts
+++ b/apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts
@@ -1,5 +1,9 @@
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import { MicrosoftDynamics365Block } from '@/blocks/blocks/microsoft_dynamics_365'
+import { getToolMetadata } from '@/tools/metadata'
+import { microsoftDynamics365ListRecordsTool } from '@/tools/microsoft_dynamics_365/list_records'
+import { microsoftDynamics365UpdateRecordTool } from '@/tools/microsoft_dynamics_365/update_record'
+import { getSubBlocksForToolInput } from '@/tools/params'
const BASE_PARAMS = {
credential: 'credential-1',
@@ -330,6 +334,16 @@ describe('MicrosoftDynamics365Block', () => {
).toThrow('Time spent must be at most 2147483647')
})
+ it('refuses to close an opportunity whose canvas Outcome is blank instead of assuming won', () => {
+ expect(() =>
+ mapParams({
+ operation: 'close_opportunity',
+ closeOpportunityId: '11111111-1111-4111-8111-111111111111',
+ opportunityOutcome: '',
+ })
+ ).toThrow('Outcome')
+ })
+
it('supports an optional opportunity subject and enforces close-description limits', () => {
expect(
mapParams({
@@ -378,3 +392,153 @@ describe('MicrosoftDynamics365Block', () => {
).toBeUndefined()
})
})
+
+/**
+ * Agent tool rows, Pi, and Human v2 pass the operation only in the mapper context. Params hold the
+ * stored row values merged with the model's args, which are keyed by the selected tool's param
+ * names. A tool row stores only fields tool-input renders, so block-only dropdowns such as
+ * `recordType` and `ownerType` are absent.
+ */
+describe('MicrosoftDynamics365Block tool-call mapping', () => {
+ const RECORD_ID = '11111111-1111-4111-8111-111111111111'
+ const OWNER_ID = 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa'
+
+ function mapToolCall(operation: string, params: Record) {
+ const mapper = MicrosoftDynamics365Block.tools.config?.params
+ if (!mapper) throw new Error('Dynamics 365 CRM block is missing its params mapper')
+ return mapper({ ...BASE_PARAMS, ...params }, { operation })
+ }
+
+ it('renders Owner Type and Owner ID on the List Owners and Assign Record tool rows', () => {
+ const rowTools = [microsoftDynamics365ListRecordsTool, microsoftDynamics365UpdateRecordTool]
+ vi.mocked(getToolMetadata).mockImplementationOnce(lookup).mockImplementationOnce(lookup)
+ function lookup(toolId: string) {
+ const tool = rowTools.find((candidate) => candidate.id === toolId)
+ return tool && { id: tool.id, params: tool.params }
+ }
+ const rowFields = (toolId: string, operation: string) =>
+ getSubBlocksForToolInput(
+ toolId,
+ 'microsoft_dynamics_365',
+ { operation },
+ {},
+ MicrosoftDynamics365Block
+ )?.subBlocks.map((subBlock) => subBlock.id)
+
+ expect(rowFields('microsoft_dynamics_365_list_records', 'list_owners')).toContain('ownerType')
+ expect(rowFields('microsoft_dynamics_365_update_record', 'assign_record')).toEqual(
+ expect.arrayContaining(['ownerType', 'ownerId'])
+ )
+ })
+
+ it('lists owners from the row-stored owner type on a tool call', () => {
+ expect(
+ mapToolCall('list_owners', { ownerType: 'team', entitySetName: 'accounts' })
+ ).toMatchObject({ entitySetName: 'teams' })
+ })
+
+ it('assigns the record the model names to the row-stored owner on a tool call', () => {
+ expect(
+ mapToolCall('assign_record', {
+ ownerType: 'team',
+ ownerId: OWNER_ID,
+ entitySetName: 'contacts',
+ recordId: RECORD_ID,
+ })
+ ).toEqual({
+ ...BASE_PARAMS,
+ entitySetName: 'contacts',
+ recordId: RECORD_ID,
+ data: { 'ownerid@odata.bind': `/teams(${OWNER_ID})` },
+ })
+ })
+
+ it('applies the stored resolution subject when the model sends only the case ID', () => {
+ expect(
+ mapToolCall('close_case', { caseSubject: 'Resolved by agent', caseId: RECORD_ID })
+ ).toEqual({ ...BASE_PARAMS, caseId: RECORD_ID, subject: 'Resolved by agent' })
+ expect(
+ mapToolCall('close_case', { caseId: RECORD_ID, subject: 'Model subject', timeSpent: 15 })
+ ).toEqual({ ...BASE_PARAMS, caseId: RECORD_ID, subject: 'Model subject', timeSpent: 15 })
+ })
+
+ it('keeps typed model list args over the stored count switch', () => {
+ expect(
+ mapToolCall('list_records', {
+ includeCount: false,
+ entitySetName: 'contacts',
+ select: 'fullname',
+ pageSize: 10,
+ count: true,
+ })
+ ).toEqual({
+ ...BASE_PARAMS,
+ entitySetName: 'contacts',
+ select: 'fullname',
+ pageSize: 10,
+ count: 'true',
+ })
+ })
+
+ it('closes the opportunity the model names with the outcome it chose', () => {
+ expect(
+ mapToolCall('close_opportunity', {
+ opportunityId: RECORD_ID,
+ outcome: 'lost',
+ statusReason: 4,
+ })
+ ).toEqual({ ...BASE_PARAMS, opportunityId: RECORD_ID, outcome: 'lost', statusReason: 4 })
+ })
+
+ it('refuses to close an opportunity when the model omits the outcome', () => {
+ expect(() => mapToolCall('close_opportunity', { opportunityId: RECORD_ID })).toThrow(
+ 'Outcome is required'
+ )
+ })
+
+ it('searches the model entities and numeric paging, else every CRM table', () => {
+ const entityList = [{ name: 'contact' }, { name: 'lead' }]
+ const entities = JSON.stringify(entityList)
+ expect(
+ mapToolCall('search_records', { searchTerm: 'Contoso', entities, top: 10, skip: 20 })
+ ).toMatchObject({ entities, top: 10, skip: 20, searchMode: 'any', searchType: 'simple' })
+ expect(
+ mapToolCall('search_records', { searchTerm: 'Contoso', entities: entityList })
+ ).toMatchObject({ entities })
+ const omitted = mapToolCall('search_records', { searchTerm: 'Contoso' })
+ expect(omitted).toMatchObject({ searchTerm: 'Contoso', top: 100 })
+ expect(omitted).not.toHaveProperty('entities')
+ })
+
+ it('leaves qualification switches the model omits for the tool to reject', () => {
+ const mapped = mapToolCall('qualify_lead', { leadId: RECORD_ID })
+ expect(mapped).toEqual({ ...BASE_PARAMS, leadId: RECORD_ID })
+ expect(mapped).not.toHaveProperty('createAccount')
+ expect(mapped).not.toHaveProperty('createContact')
+ expect(mapped).not.toHaveProperty('createOpportunity')
+ })
+
+ it('passes model qualification references when no stored values exist', () => {
+ expect(
+ mapToolCall('qualify_lead', {
+ leadId: RECORD_ID,
+ createAccount: false,
+ createContact: false,
+ createOpportunity: true,
+ statusReason: 3,
+ opportunityCustomerId: OWNER_ID,
+ opportunityCustomerType: 'contact',
+ qualifyOpportunityCustomerType: 'account',
+ })
+ ).toEqual({
+ ...BASE_PARAMS,
+ leadId: RECORD_ID,
+ createAccount: false,
+ createContact: false,
+ createOpportunity: true,
+ statusReason: 3,
+ opportunityCustomerId: OWNER_ID,
+ opportunityCustomerType: 'contact',
+ })
+ })
+})
diff --git a/apps/sim/blocks/blocks/microsoft_dynamics_365.ts b/apps/sim/blocks/blocks/microsoft_dynamics_365.ts
index ded79b02066..c9ae70ad8b1 100644
--- a/apps/sim/blocks/blocks/microsoft_dynamics_365.ts
+++ b/apps/sim/blocks/blocks/microsoft_dynamics_365.ts
@@ -1,11 +1,14 @@
import { MicrosoftDataverseIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
-import type { BlockConfig, BlockMeta } from '@/blocks/types'
+import type { BlockConfig, BlockMeta, BlockToolParamsContext } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
import {
+ isToolCall,
+ mapperOperation,
parseOptionalBooleanInput,
parseOptionalJsonInput,
parseOptionalNumberInput,
+ toolCallArg,
} from '@/blocks/utils'
const DATAVERSE_GUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
@@ -86,8 +89,20 @@ function optionalBoundedString(
return normalized
}
-function getListPaginationParams(params: Record) {
- const pageSize = parseOptionalNumberInput(params.maxResults, 'Max results', {
+function isUnset(value: unknown): boolean {
+ return value === undefined || value === null || value === ''
+}
+
+function firstSet(primary: unknown, fallback: unknown): unknown {
+ return isUnset(primary) ? fallback : primary
+}
+
+function getListPaginationParams(
+ params: Record,
+ context: BlockToolParamsContext | undefined
+) {
+ const pageSizeInput = firstSet(params.maxResults, toolCallArg(context, params.pageSize))
+ const pageSize = parseOptionalNumberInput(pageSizeInput, 'Max results', {
integer: true,
min: 1,
max: 100,
@@ -153,6 +168,37 @@ function getOwnerType(value: unknown) {
return OWNER_TYPES[ownerType as OwnerType]
}
+/**
+ * The entity set a record operation targets. On a tool call the model's required `entitySetName`
+ * wins (the tool validates it): `recordType` is not a tool param, so a tool row never shows it
+ * and any stored value is not the model's choice. The canvas reads only `recordType`.
+ */
+function getRecordEntitySetName(
+ params: Record,
+ context: BlockToolParamsContext | undefined
+): string {
+ return (
+ optionalString(toolCallArg(context, params.entitySetName)) ??
+ getRecordType(params.recordType).entitySetName
+ )
+}
+
+/**
+ * The tables a search covers. The canvas searches its selected `recordType`. A tool call sends the
+ * model's `entities` (a JSON string, or an array it typed directly), else leaves it unset so the
+ * tool searches every supported CRM table, matching the tool's documented default.
+ */
+function getSearchEntities(
+ params: Record,
+ context: BlockToolParamsContext | undefined
+): string | undefined {
+ if (!isToolCall(context)) {
+ return JSON.stringify([{ name: getRecordType(params.recordType).logicalName }])
+ }
+ if (Array.isArray(params.entities)) return JSON.stringify(params.entities)
+ return optionalString(params.entities)
+}
+
function getCommonParams(params: Record) {
return {
credential: requiredString(params.credential, 'Microsoft account'),
@@ -501,6 +547,7 @@ export const MicrosoftDynamics365Block: BlockConfig = {
{ label: 'Team', id: 'team' },
],
value: () => 'user',
+ paramVisibility: 'user-only',
condition: { field: 'operation', value: ['list_owners', 'assign_record'] },
required: { field: 'operation', value: ['list_owners', 'assign_record'] },
},
@@ -509,6 +556,7 @@ export const MicrosoftDynamics365Block: BlockConfig = {
title: 'Owner ID',
type: 'short-input',
placeholder: 'User or team GUID',
+ paramVisibility: 'user-only',
condition: { field: 'operation', value: 'assign_record' },
required: { field: 'operation', value: 'assign_record' },
},
@@ -748,69 +796,72 @@ export const MicrosoftDynamics365Block: BlockConfig = {
throw new Error(`Unsupported Dynamics 365 CRM operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
const common = getCommonParams(params)
+ const operation = mapperOperation(params, context)
- switch (params.operation) {
+ switch (operation) {
case 'list_records': {
- const recordType = getRecordType(params.recordType)
const includeCount = parseBooleanWithDefault(
- params.includeCount,
+ firstSet(toolCallArg(context, params.count), params.includeCount),
'Include total count',
false
)
+ const select = optionalString(
+ firstSet(params.listSelect, toolCallArg(context, params.select))
+ )
+ const filter = optionalString(
+ firstSet(params.listFilter, toolCallArg(context, params.filter))
+ )
+ const orderBy = optionalString(
+ firstSet(params.listOrderBy, toolCallArg(context, params.orderBy))
+ )
+ const expand = optionalString(
+ firstSet(params.recordExpand, toolCallArg(context, params.expand))
+ )
return {
...common,
- entitySetName: recordType.entitySetName,
- ...(optionalString(params.listSelect) && {
- select: optionalString(params.listSelect),
- }),
- ...(optionalString(params.listFilter) && {
- filter: optionalString(params.listFilter),
- }),
- ...(optionalString(params.listOrderBy) && {
- orderBy: optionalString(params.listOrderBy),
- }),
- ...(optionalString(params.recordExpand) && {
- expand: optionalString(params.recordExpand),
- }),
- ...getListPaginationParams(params),
+ entitySetName: getRecordEntitySetName(params, context),
+ ...(select && { select }),
+ ...(filter && { filter }),
+ ...(orderBy && { orderBy }),
+ ...(expand && { expand }),
+ ...getListPaginationParams(params, context),
count: includeCount ? 'true' : 'false',
}
}
case 'get_record': {
- const recordType = getRecordType(params.recordType)
+ const select = optionalString(
+ firstSet(params.listSelect, toolCallArg(context, params.select))
+ )
+ const expand = optionalString(
+ firstSet(params.recordExpand, toolCallArg(context, params.expand))
+ )
return {
...common,
- entitySetName: recordType.entitySetName,
+ entitySetName: getRecordEntitySetName(params, context),
recordId: normalizeDataverseGuid(
requiredString(params.recordId, 'Record ID'),
'Record ID'
),
- ...(optionalString(params.listSelect) && {
- select: optionalString(params.listSelect),
- }),
- ...(optionalString(params.recordExpand) && {
- expand: optionalString(params.recordExpand),
- }),
+ ...(select && { select }),
+ ...(expand && { expand }),
}
}
case 'create_record': {
- const recordType = getRecordType(params.recordType)
return {
...common,
- entitySetName: recordType.entitySetName,
+ entitySetName: getRecordEntitySetName(params, context),
data: parseRequiredRecord(params.data),
}
}
case 'update_record': {
- const recordType = getRecordType(params.recordType)
return {
...common,
- entitySetName: recordType.entitySetName,
+ entitySetName: getRecordEntitySetName(params, context),
recordId: normalizeDataverseGuid(
requiredString(params.recordId, 'Record ID'),
'Record ID'
@@ -820,35 +871,38 @@ export const MicrosoftDynamics365Block: BlockConfig = {
}
case 'search_records': {
- const recordType = getRecordType(params.recordType)
+ const entities = getSearchEntities(params, context)
const top =
- parseOptionalNumberInput(params.maxResults, 'Max results', {
- integer: true,
- min: 1,
- max: 100,
- }) ?? 100
- const skip = parseOptionalNumberInput(params.searchSkip, 'Search offset', {
- integer: true,
- min: 0,
- max: 2_147_483_647,
- })
+ parseOptionalNumberInput(
+ firstSet(params.maxResults, toolCallArg(context, params.top)),
+ 'Max results',
+ { integer: true, min: 1, max: 100 }
+ ) ?? 100
+ const skip = parseOptionalNumberInput(
+ firstSet(params.searchSkip, toolCallArg(context, params.skip)),
+ 'Search offset',
+ { integer: true, min: 0, max: 2_147_483_647 }
+ )
+ const filter = optionalString(
+ firstSet(params.searchFilter, toolCallArg(context, params.filter))
+ )
+ const facets = optionalString(
+ firstSet(params.searchFacets, toolCallArg(context, params.facets))
+ )
+ const orderBy = optionalString(
+ firstSet(params.searchOrderBy, toolCallArg(context, params.orderBy))
+ )
return {
...common,
searchTerm: requiredString(params.searchTerm, 'Search term', 100),
- entities: JSON.stringify([{ name: recordType.logicalName }]),
+ ...(entities && { entities }),
top,
...(skip !== undefined && { skip }),
- ...(optionalString(params.searchFilter) && {
- filter: optionalString(params.searchFilter),
- }),
- ...(optionalString(params.searchFacets) && {
- facets: optionalString(params.searchFacets),
- }),
- ...(optionalString(params.searchOrderBy) && {
- orderBy: optionalString(params.searchOrderBy),
- }),
- searchMode: requiredString(params.searchMode ?? 'any', 'Search mode'),
- searchType: requiredString(params.searchType ?? 'simple', 'Query type'),
+ ...(filter && { filter }),
+ ...(facets && { facets }),
+ ...(orderBy && { orderBy }),
+ searchMode: requiredString(params.searchMode || 'any', 'Search mode'),
+ searchType: requiredString(params.searchType || 'simple', 'Query type'),
}
}
@@ -859,12 +913,11 @@ export const MicrosoftDynamics365Block: BlockConfig = {
entitySetName: ownerType.entitySetName,
select: ownerType.select,
filter: ownerType.filter,
- ...getListPaginationParams(params),
+ ...getListPaginationParams(params, context),
}
}
case 'assign_record': {
- const recordType = getRecordType(params.recordType)
const ownerType = getOwnerType(params.ownerType)
const ownerId = normalizeDataverseGuid(
requiredString(params.ownerId, 'Owner ID'),
@@ -872,7 +925,7 @@ export const MicrosoftDynamics365Block: BlockConfig = {
)
return {
...common,
- entitySetName: recordType.entitySetName,
+ entitySetName: getRecordEntitySetName(params, context),
recordId: normalizeDataverseGuid(
requiredString(params.recordId, 'Record ID'),
'Record ID'
@@ -884,45 +937,68 @@ export const MicrosoftDynamics365Block: BlockConfig = {
}
case 'qualify_lead': {
- const createOpportunity = parseBooleanWithDefault(
+ const qualifySwitch = (value: unknown, label: string, defaultValue: boolean) =>
+ isToolCall(context) && isUnset(value)
+ ? undefined
+ : parseBooleanWithDefault(value, label, defaultValue)
+ const createAccount = qualifySwitch(params.createAccount, 'Create account', true)
+ const createContact = qualifySwitch(params.createContact, 'Create contact', true)
+ const createOpportunity = qualifySwitch(
params.createOpportunity,
'Create opportunity',
false
)
const statusReason = parseOptionalNumberInput(
- params.qualifyStatusReason,
+ firstSet(params.qualifyStatusReason, toolCallArg(context, params.statusReason)),
'Qualified status reason',
{ integer: true, min: -2_147_483_648, max: 2_147_483_647 }
)
- const opportunityCurrencyId = createOpportunity
- ? optionalString(params.qualifyOpportunityCurrencyId)
- : undefined
- const opportunityCustomerId = createOpportunity
- ? optionalString(params.qualifyOpportunityCustomerId)
- : undefined
- const sourceCampaignId = createOpportunity
- ? optionalString(params.qualifySourceCampaignId)
- : undefined
- const processInstanceId = createOpportunity
- ? optionalString(params.qualifyProcessInstanceId)
- : undefined
- const processInstanceEntityType = createOpportunity
- ? optionalString(params.qualifyProcessInstanceEntityType)
- : undefined
+ const opportunityField = (dedicated: unknown, toolParam: unknown) =>
+ createOpportunity
+ ? optionalString(firstSet(dedicated, toolCallArg(context, toolParam)))
+ : undefined
+ const opportunityCurrencyId = opportunityField(
+ params.qualifyOpportunityCurrencyId,
+ params.opportunityCurrencyId
+ )
+ const opportunityCustomerId = opportunityField(
+ params.qualifyOpportunityCustomerId,
+ params.opportunityCustomerId
+ )
+ const sourceCampaignId = opportunityField(
+ params.qualifySourceCampaignId,
+ params.sourceCampaignId
+ )
+ const processInstanceId = opportunityField(
+ params.qualifyProcessInstanceId,
+ params.processInstanceId
+ )
+ const processInstanceEntityType = opportunityField(
+ params.qualifyProcessInstanceEntityType,
+ params.processInstanceEntityType
+ )
if (Boolean(processInstanceId) !== Boolean(processInstanceEntityType)) {
throw new Error(
'Process instance ID and process instance table must be provided together'
)
}
const opportunityCustomerType = opportunityCustomerId
- ? requiredString(params.qualifyOpportunityCustomerType, 'Opportunity customer type')
+ ? requiredString(
+ optionalString(params.qualifyOpportunityCustomerId)
+ ? params.qualifyOpportunityCustomerType
+ : firstSet(
+ toolCallArg(context, params.opportunityCustomerType),
+ params.qualifyOpportunityCustomerType
+ ),
+ 'Opportunity customer type'
+ )
: undefined
return {
...common,
leadId: requiredString(params.leadId, 'Lead ID'),
- createAccount: parseBooleanWithDefault(params.createAccount, 'Create account', true),
- createContact: parseBooleanWithDefault(params.createContact, 'Create contact', true),
- createOpportunity,
+ ...(createAccount !== undefined && { createAccount }),
+ ...(createContact !== undefined && { createContact }),
+ ...(createOpportunity !== undefined && { createOpportunity }),
...(statusReason !== undefined && { statusReason }),
...(opportunityCurrencyId && { opportunityCurrencyId }),
...(opportunityCustomerId && {
@@ -939,20 +1015,30 @@ export const MicrosoftDynamics365Block: BlockConfig = {
case 'close_opportunity': {
const statusReason = parseOptionalNumberInput(
- params.opportunityStatusReason,
+ firstSet(params.opportunityStatusReason, toolCallArg(context, params.statusReason)),
'Opportunity status reason',
{ integer: true, min: -2_147_483_648, max: 2_147_483_647 }
)
- const subject = optionalBoundedString(params.opportunitySubject, 'Close subject', 200)
+ const subject = optionalBoundedString(
+ firstSet(params.opportunitySubject, toolCallArg(context, params.subject)),
+ 'Close subject',
+ 200
+ )
const description = optionalBoundedString(
- params.opportunityDescription,
+ firstSet(params.opportunityDescription, toolCallArg(context, params.description)),
'Close notes',
2_000
)
return {
...common,
- opportunityId: requiredString(params.closeOpportunityId, 'Opportunity ID'),
- outcome: requiredString(params.opportunityOutcome ?? 'won', 'Outcome'),
+ opportunityId: requiredString(
+ firstSet(params.closeOpportunityId, toolCallArg(context, params.opportunityId)),
+ 'Opportunity ID'
+ ),
+ outcome: requiredString(
+ isToolCall(context) ? params.outcome : (params.opportunityOutcome ?? 'won'),
+ 'Outcome'
+ ),
...(subject && { subject }),
...(description && { description }),
...(statusReason !== undefined && { statusReason }),
@@ -960,25 +1046,29 @@ export const MicrosoftDynamics365Block: BlockConfig = {
}
case 'close_case': {
- const timeSpent = parseOptionalNumberInput(params.caseTimeSpent, 'Time spent', {
- integer: true,
- min: 0,
- max: 2_147_483_647,
- })
+ const timeSpent = parseOptionalNumberInput(
+ firstSet(params.caseTimeSpent, toolCallArg(context, params.timeSpent)),
+ 'Time spent',
+ { integer: true, min: 0, max: 2_147_483_647 }
+ )
const statusReason = parseOptionalNumberInput(
- params.caseStatusReason,
+ firstSet(params.caseStatusReason, toolCallArg(context, params.statusReason)),
'Case status reason',
{ integer: true, min: -2_147_483_648, max: 2_147_483_647 }
)
const description = optionalBoundedString(
- params.caseDescription,
+ firstSet(params.caseDescription, toolCallArg(context, params.description)),
'Resolution notes',
100_000
)
return {
...common,
caseId: requiredString(params.caseId, 'Case ID'),
- subject: requiredString(params.caseSubject, 'Resolution subject', 200),
+ subject: requiredString(
+ firstSet(params.caseSubject, toolCallArg(context, params.subject)),
+ 'Resolution subject',
+ 200
+ ),
...(description && { description }),
...(timeSpent !== undefined && { timeSpent }),
...(statusReason !== undefined && { statusReason }),
@@ -986,7 +1076,7 @@ export const MicrosoftDynamics365Block: BlockConfig = {
}
default:
- throw new Error(`Unsupported Dynamics 365 CRM operation: ${params.operation}`)
+ throw new Error(`Unsupported Dynamics 365 CRM operation: ${operation}`)
}
},
},
diff --git a/apps/sim/blocks/blocks/microsoft_excel.ts b/apps/sim/blocks/blocks/microsoft_excel.ts
index c4e6be972d7..0168fc10ee8 100644
--- a/apps/sim/blocks/blocks/microsoft_excel.ts
+++ b/apps/sim/blocks/blocks/microsoft_excel.ts
@@ -2,7 +2,7 @@ import { MicrosoftExcelIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { createVersionedToolSelector } from '@/blocks/utils'
+import { createVersionedToolSelector, isToolCall, mapperOperation } from '@/blocks/utils'
/** Maps the read/write operation to its `_v2` tool id, falling back to read on unknown ops. */
const versionedReadWriteSelector = createVersionedToolSelector>({
@@ -66,7 +66,10 @@ function optionalNumber(value: unknown): number | undefined {
return num
}
-/** Normalizes stored agent inputs when the selected operation is carried outside the parameter map. */
+/**
+ * Normalizes tool-call params (a stored tool row merged with model args keyed by the tool's own
+ * param names) and canvas inputs that carry no operation, without the per-operation validation.
+ */
function normalizeExcelAgentParams(params: Record, separateSheet: boolean) {
const result: Record = { ...params }
for (const field of ['index', 'top', 'skip', 'position', 'fontSize', 'sortColumn']) {
@@ -702,8 +705,9 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
throw new Error(`Invalid Microsoft Excel operation: ${params.operation}`)
}
},
- params: (params) => {
- if (!params.operation) return normalizeExcelAgentParams(params, false)
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ if (isToolCall(context) || !operation) return normalizeExcelAgentParams(params, false)
const {
oauthCredential,
values,
@@ -712,7 +716,6 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
worksheetName,
driveId,
range,
- operation,
applyTo,
fillColor,
fontBold,
@@ -1845,8 +1848,9 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
return versionedReadWriteSelector(params)
}
},
- params: (params) => {
- if (!params.operation) return normalizeExcelAgentParams(params, true)
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ if (isToolCall(context) || !operation) return normalizeExcelAgentParams(params, true)
const {
oauthCredential,
values,
@@ -1856,7 +1860,6 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
driveId,
siteId: _siteId,
fileSource: _fileSource,
- operation,
applyTo,
fillColor,
fontBold,
diff --git a/apps/sim/blocks/blocks/microsoft_planner.test.ts b/apps/sim/blocks/blocks/microsoft_planner.test.ts
new file mode 100644
index 00000000000..4481f936c1d
--- /dev/null
+++ b/apps/sim/blocks/blocks/microsoft_planner.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from 'vitest'
+import { MicrosoftPlannerBlock } from '@/blocks/blocks/microsoft_planner'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** What the tool receives: the mapper's result spread over its own input, as both callers merge it. */
+const forwarded = (inputs: Record, context?: BlockToolParamsContext) => ({
+ ...inputs,
+ ...(MicrosoftPlannerBlock.tools.config?.params?.(inputs, context) ?? {}),
+})
+
+describe('MicrosoftPlannerBlock tool-call params', () => {
+ it('keeps the model-supplied task id on an update', () => {
+ const result = forwarded(
+ { oauthCredential: 'cred', taskId: 'task-1', etag: 'W/"1"', title: 'Renamed' },
+ { operation: 'update_task' }
+ )
+
+ expect(result.taskId).toBe('task-1')
+ })
+
+ it('keeps the model-supplied plan title', () => {
+ const result = forwarded(
+ { oauthCredential: 'cred', groupId: 'group-1', title: 'Q3 plan' },
+ { operation: 'create_plan' }
+ )
+
+ expect(result.title).toBe('Q3 plan')
+ })
+
+ it('maps the stored update-task picker and forwards an object checklist', () => {
+ const checklist = { 'item-1': { title: 'Review', isChecked: false } }
+ const result = forwarded(
+ { oauthCredential: 'cred', updateTaskId: ' task-2 ', etag: 'W/"2"', checklist },
+ { operation: 'update_task_details' }
+ )
+
+ expect(result.taskId).toBe('task-2')
+ expect(result.checklist).toEqual(checklist)
+ })
+})
diff --git a/apps/sim/blocks/blocks/microsoft_planner.ts b/apps/sim/blocks/blocks/microsoft_planner.ts
index b5fead93b20..0beeee4ff5a 100644
--- a/apps/sim/blocks/blocks/microsoft_planner.ts
+++ b/apps/sim/blocks/blocks/microsoft_planner.ts
@@ -2,6 +2,7 @@ import { MicrosoftPlannerIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
interface MicrosoftPlannerBlockParams {
oauthCredential: string
@@ -571,10 +572,10 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
throw new Error(`Invalid Microsoft Planner operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
oauthCredential,
- operation,
groupId,
planId,
readTaskId, // Canonical param from taskSelector (basic) or manualReadTaskId (advanced) for read_task
@@ -606,7 +607,10 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
}
const effectiveReadTaskId = readTaskId ? String(readTaskId).trim() : ''
- const effectiveUpdateTaskId = updateTaskId ? String(updateTaskId).trim() : ''
+ const effectiveUpdateTaskId =
+ (updateTaskId ? String(updateTaskId).trim() : '') ||
+ toolCallArg(context, rest.taskId) ||
+ ''
const effectiveBucketId = (bucketIdForRead || bucketId || '').trim()
if (operation === 'list_plans') {
@@ -624,7 +628,7 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
return {
...baseParams,
groupId: groupId?.trim(),
- title: planTitle?.trim(),
+ title: planTitle?.trim() || toolCallArg(context, title),
}
}
@@ -633,7 +637,7 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
...baseParams,
planId: planId?.trim(),
etag: etag?.trim(),
- title: planTitle?.trim(),
+ title: planTitle?.trim() || toolCallArg(context, title),
}
}
@@ -650,10 +654,10 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
planId: planId?.trim(),
etag: etag?.trim(),
}
- if (categoryDescriptions?.trim()) {
+ if (typeof categoryDescriptions === 'string' && categoryDescriptions.trim()) {
updatePlanDetailsParams.categoryDescriptions = categoryDescriptions.trim()
}
- if (sharedWith?.trim()) {
+ if (typeof sharedWith === 'string' && sharedWith.trim()) {
updatePlanDetailsParams.sharedWith = sharedWith.trim()
}
return updatePlanDetailsParams
@@ -813,10 +817,10 @@ Return ONLY the comma-separated category keys - no explanations, no extra text.`
if (description?.trim()) {
updateDetailsParams.description = description.trim()
}
- if (checklist?.trim()) {
+ if (typeof checklist === 'string' && checklist.trim()) {
updateDetailsParams.checklist = checklist.trim()
}
- if (references?.trim()) {
+ if (typeof references === 'string' && references.trim()) {
updateDetailsParams.references = references.trim()
}
if (previewType?.trim()) {
diff --git a/apps/sim/blocks/blocks/microsoft_teams.test.ts b/apps/sim/blocks/blocks/microsoft_teams.test.ts
new file mode 100644
index 00000000000..e8d31d52933
--- /dev/null
+++ b/apps/sim/blocks/blocks/microsoft_teams.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest'
+import { MicrosoftTeamsBlock } from '@/blocks/blocks/microsoft_teams'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** What the tool receives: the mapper's result spread over its own input, as both callers merge it. */
+const forwarded = (inputs: Record, context?: BlockToolParamsContext) => ({
+ ...inputs,
+ ...(MicrosoftTeamsBlock.tools.config?.params?.(inputs, context) ?? {}),
+})
+
+describe('MicrosoftTeamsBlock tool-call params', () => {
+ it('sends a single attached file as the file list the tool expects', () => {
+ const file = {
+ name: 'report.pdf',
+ key: 'workspace/report.pdf',
+ size: 10,
+ type: 'application/pdf',
+ }
+ const result = forwarded(
+ { oauthCredential: 'cred', chatId: 'chat-1', content: 'See attached', files: file },
+ { operation: 'write_chat' }
+ )
+
+ expect(result.files).toEqual([file])
+ })
+})
diff --git a/apps/sim/blocks/blocks/microsoft_teams.ts b/apps/sim/blocks/blocks/microsoft_teams.ts
index 978da9e3382..22ac8c149ab 100644
--- a/apps/sim/blocks/blocks/microsoft_teams.ts
+++ b/apps/sim/blocks/blocks/microsoft_teams.ts
@@ -2,7 +2,7 @@ import { MicrosoftTeamsIcon } 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 { mapperOperation, normalizeFileInput } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/**
@@ -514,10 +514,10 @@ export const MicrosoftTeamsBlock: BlockConfig = {
return 'microsoft_teams_read_chat'
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
oauthCredential,
- operation,
teamId, // Canonical param from teamSelector (basic) or manualTeamId (advanced)
chatId, // Canonical param from chatSelector (basic) or manualChatId (advanced)
channelId, // Canonical param from channelSelector (basic) or manualChannelId (advanced)
diff --git a/apps/sim/blocks/blocks/microsoft_word.test.ts b/apps/sim/blocks/blocks/microsoft_word.test.ts
new file mode 100644
index 00000000000..db445e7b0d7
--- /dev/null
+++ b/apps/sim/blocks/blocks/microsoft_word.test.ts
@@ -0,0 +1,36 @@
+import { describe, expect, it } from 'vitest'
+import { MicrosoftWordBlock } from '@/blocks/blocks/microsoft_word'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** What the tool receives: the mapper's result spread over its own input, as both callers merge it. */
+const forwarded = (inputs: Record, context?: BlockToolParamsContext) => ({
+ ...inputs,
+ ...(MicrosoftWordBlock.tools.config?.params?.(inputs, context) ?? {}),
+})
+
+describe('MicrosoftWordBlock tool-call params', () => {
+ it('appends the content the model passes under the tool param name', () => {
+ const result = forwarded(
+ { oauthCredential: 'cred', documentId: 'doc-1', content: 'More text' },
+ { operation: 'append' }
+ )
+
+ expect(result.content).toBe('More text')
+ })
+
+ it('keeps the model-supplied folder and coerces matchCase when creating from a template', () => {
+ const result = forwarded(
+ {
+ oauthCredential: 'cred',
+ templateDocumentId: 'tpl-1',
+ name: 'Offer',
+ folderId: 'folder-1',
+ matchCase: 'true',
+ },
+ { operation: 'create_from_template' }
+ )
+
+ expect(result.folderId).toBe('folder-1')
+ expect(result.matchCase).toBe(true)
+ })
+})
diff --git a/apps/sim/blocks/blocks/microsoft_word.ts b/apps/sim/blocks/blocks/microsoft_word.ts
index b746ca48e5a..003154c8bab 100644
--- a/apps/sim/blocks/blocks/microsoft_word.ts
+++ b/apps/sim/blocks/blocks/microsoft_word.ts
@@ -2,6 +2,7 @@ import { MicrosoftWordIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
const DOCUMENT_FIELD = ['documentSelector', 'manualDocumentId'] as const
@@ -399,10 +400,10 @@ export const MicrosoftWordBlock: BlockConfig = {
throw new Error(`Invalid Microsoft Word operation: ${params.operation}`)
}
},
- params: (params) => {
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const {
oauthCredential,
- operation,
documentId,
templateDocumentId,
replacements,
@@ -422,6 +423,7 @@ export const MicrosoftWordBlock: BlockConfig = {
} = params
const base = { oauthCredential, driveId: optionalString(driveId) }
+ const modelFolderId = toolCallArg(context, optionalString(params.folderId))
switch (operation) {
case 'create':
@@ -429,7 +431,7 @@ export const MicrosoftWordBlock: BlockConfig = {
...base,
name: requireString(name, 'Document name'),
content: optionalString(content),
- folderId: optionalString(createFolderId),
+ folderId: optionalString(createFolderId) ?? modelFolderId,
}
case 'create_from_template':
return {
@@ -438,7 +440,7 @@ export const MicrosoftWordBlock: BlockConfig = {
name: requireString(name, 'Document name'),
replacements: optionalJson(replacements),
matchCase: optionalBoolean(matchCase) ?? false,
- folderId: optionalString(createFolderId),
+ folderId: optionalString(createFolderId) ?? modelFolderId,
}
case 'read':
return { ...base, documentId: requireString(documentId, 'Document') }
@@ -452,7 +454,10 @@ export const MicrosoftWordBlock: BlockConfig = {
return {
...base,
documentId: requireString(documentId, 'Document'),
- content: requireString(appendContent, 'Content to append'),
+ content: requireString(
+ optionalString(appendContent) ?? toolCallArg(context, content),
+ 'Content to append'
+ ),
}
case 'replace_text':
return {
@@ -466,7 +471,7 @@ export const MicrosoftWordBlock: BlockConfig = {
return {
...base,
query: optionalString(query),
- folderId: optionalString(listFolderId),
+ folderId: optionalString(listFolderId) ?? modelFolderId,
pageSize: optionalNumber(pageSize),
pageToken: optionalString(pageToken),
}
diff --git a/apps/sim/blocks/blocks/mintlify.test.ts b/apps/sim/blocks/blocks/mintlify.test.ts
index 95ac6a5a0ad..4d6eefaf63c 100644
--- a/apps/sim/blocks/blocks/mintlify.test.ts
+++ b/apps/sim/blocks/blocks/mintlify.test.ts
@@ -1,13 +1,17 @@
import { describe, expect, it } from 'vitest'
import { MintlifyBlock } from '@/blocks/blocks/mintlify'
+const mapper = MintlifyBlock.tools.config?.params
+if (!mapper) throw new Error('MintlifyBlock has no params mapper')
+const blockParams = mapper
+
/**
* The executor merges `tools.config.params` on top of the raw inputs, so every
* assertion runs against the merged result rather than the transform's return
* value alone.
*/
function resolveParams(inputs: Record) {
- return { ...inputs, ...MintlifyBlock.tools.config.params!(inputs) }
+ return { ...inputs, ...blockParams(inputs) }
}
describe('MintlifyBlock', () => {
@@ -50,4 +54,21 @@ describe('MintlifyBlock', () => {
expect(result.limit).toBeUndefined()
})
})
+
+ describe('agent tool calls', () => {
+ it('coerces numbers and keeps tool-named args when the operation arrives only in context', () => {
+ const args = { projectId: 'proj_1', source: 'contextual', status: 'pending', limit: '50' }
+ const result = {
+ ...args,
+ ...blockParams(args, { operation: 'get_feedback' }),
+ }
+
+ expect(result).toEqual({
+ projectId: 'proj_1',
+ source: 'contextual',
+ status: 'pending',
+ limit: 50,
+ })
+ })
+ })
})
diff --git a/apps/sim/blocks/blocks/mintlify.ts b/apps/sim/blocks/blocks/mintlify.ts
index 646e9c75019..9f5ba6d655b 100644
--- a/apps/sim/blocks/blocks/mintlify.ts
+++ b/apps/sim/blocks/blocks/mintlify.ts
@@ -1,12 +1,15 @@
import { MintlifyIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { isToolCall, mapperOperation } from '@/blocks/utils'
/**
- * SubBlock IDs each operation may forward to its tool. Anything outside the
- * selected operation's list is explicitly cleared, because the executor merges
- * `tools.config.params` on top of the raw inputs and a retained advanced-mode
- * value would otherwise leak across operations.
+ * SubBlock IDs each operation may forward to its tool. On the canvas anything
+ * outside the selected operation's list is explicitly cleared, because the
+ * executor merges `tools.config.params` on top of the raw inputs and a retained
+ * advanced-mode value would otherwise leak across operations. A tool call's
+ * params are the stored row plus the model's arguments, keyed by the tool's own
+ * param names (`path`, `source`, `status`), so nothing is cleared there.
*/
const OPERATION_PARAMS: Record = {
trigger_update: ['projectId'],
@@ -566,20 +569,16 @@ Return ONLY the JSON array.`,
],
config: {
tool: (params: Record) => `mintlify_${params.operation}`,
- params: (params: Record) => {
- const { operation } = params
- // On the agent-tool path `operation` is a sibling of the tool call rather
- // than a member of params, so clearing anything here would erase the
- // model's own arguments.
- if (typeof operation !== 'string') return {}
-
- const allowed = OPERATION_PARAMS[operation]
+ params: (params: Record, context) => {
+ const allowed = OPERATION_PARAMS[mapperOperation(params, context)]
if (!allowed) return {}
const result: Record = {}
- for (const key of Object.keys(params)) {
- if (key === 'operation' || key === 'apiKey') continue
- result[key] = undefined
+ if (!isToolCall(context)) {
+ for (const key of Object.keys(params)) {
+ if (key === 'operation' || key === 'apiKey') continue
+ result[key] = undefined
+ }
}
for (const key of allowed) {
@@ -588,8 +587,7 @@ Return ONLY the JSON array.`,
if (NUMERIC_PARAMS.has(key)) {
const numeric = Number(value)
- if (!Number.isFinite(numeric)) continue
- result[key] = numeric
+ result[key] = Number.isFinite(numeric) ? numeric : undefined
continue
}
diff --git a/apps/sim/blocks/blocks/modal.test.ts b/apps/sim/blocks/blocks/modal.test.ts
index 5ef7fcfad21..d8fea6a8268 100644
--- a/apps/sim/blocks/blocks/modal.test.ts
+++ b/apps/sim/blocks/blocks/modal.test.ts
@@ -50,4 +50,21 @@ describe('ModalBlock', () => {
expect(params).not.toHaveProperty('temperature')
expect(params).not.toHaveProperty('topP')
})
+
+ it('coerces sampling controls on an agent tool call, where the operation arrives only in the context', () => {
+ const params = buildParams(
+ { model: 'Qwen/Qwen3.5-4B', content: 'hello', maxTokens: '256', temperature: 0.2 },
+ { operation: 'chat_completion' }
+ )
+
+ expect(params).toMatchObject({ maxTokens: 256, temperature: 0.2 })
+ })
+
+ it("keeps the model's function URL on an agent tool call", () => {
+ const modelArgs = { url: 'https://ws--app-fn.modal.run', method: 'GET' }
+
+ const params = { ...modelArgs, ...buildParams(modelArgs, { operation: 'call_function' }) }
+
+ expect(params.url).toBe('https://ws--app-fn.modal.run')
+ })
})
diff --git a/apps/sim/blocks/blocks/modal.ts b/apps/sim/blocks/blocks/modal.ts
index 507c7996f95..c1a917aeed3 100644
--- a/apps/sim/blocks/blocks/modal.ts
+++ b/apps/sim/blocks/blocks/modal.ts
@@ -1,6 +1,7 @@
import { ModalIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { MODAL_SHARED_INFERENCE_URL } from '@/tools/modal/utils'
/** Operations that talk to a Modal Endpoint's OpenAI-compatible `/v1` API. */
@@ -199,14 +200,14 @@ export const ModalBlock: BlockConfig = {
access: ['modal_call_function', 'modal_chat_completion', 'modal_list_models'],
config: {
tool: (params) => `modal_${params.operation}`,
- params: (params) => {
- const { operation, tokenId, tokenSecret, ...rest } = params
+ params: (params, context) => {
+ const { tokenId, tokenSecret, ...rest } = params
const baseParams: Record = { tokenId, tokenSecret }
- switch (operation) {
+ switch (mapperOperation(params, context)) {
case 'call_function':
- baseParams.url = rest.functionUrl
+ baseParams.url = rest.functionUrl ?? toolCallArg(context, rest.url)
if (rest.method) baseParams.method = rest.method
if (rest.requestBody !== undefined && rest.requestBody !== '') {
baseParams.body = rest.requestBody
diff --git a/apps/sim/blocks/blocks/monaco.ts b/apps/sim/blocks/blocks/monaco.ts
index aa3af55c992..9e46f1d72e9 100644
--- a/apps/sim/blocks/blocks/monaco.ts
+++ b/apps/sim/blocks/blocks/monaco.ts
@@ -2,6 +2,7 @@ import { toBooleanFromInput } from '@sim/utils/coerce'
import { MonacoIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
+import { mapperOperation } from '@/blocks/utils'
type FieldKind = 'string' | 'number' | 'boolean' | 'value'
@@ -1431,7 +1432,7 @@ export const MonacoBlock: BlockConfig = {
* subBlock has a different id falls back to the model's value.
*/
params: (params, context) => {
- const operation = context?.operation ?? params.operation
+ const operation = mapperOperation(params, context)
const result: Record = {
operation: undefined,
credential: undefined,
diff --git a/apps/sim/blocks/blocks/monday.ts b/apps/sim/blocks/blocks/monday.ts
index e349eb610c6..f0e44840152 100644
--- a/apps/sim/blocks/blocks/monday.ts
+++ b/apps/sim/blocks/blocks/monday.ts
@@ -2,7 +2,7 @@ import { MondayIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { toolCallArg } from '@/blocks/utils'
+import { mapperOperation, toolCallArg } from '@/blocks/utils'
import { getTrigger } from '@/triggers'
const BOARD_OPS = [
@@ -525,9 +525,7 @@ export const MondayBlock: BlockConfig = {
const baseParams: Record = {
oauthCredential: params.oauthCredential,
}
- /** Agent tool calls carry the stored operation only on `context`, not in `params`. */
- const rawOperation = params.operation ?? context?.operation
- const op = typeof rawOperation === 'string' ? rawOperation.trim() : 'list_boards'
+ const op = mapperOperation(params, context).trim() || 'list_boards'
switch (op) {
case 'list_boards':
diff --git a/apps/sim/blocks/blocks/netsuite.test.ts b/apps/sim/blocks/blocks/netsuite.test.ts
new file mode 100644
index 00000000000..5a4e6dc75af
--- /dev/null
+++ b/apps/sim/blocks/blocks/netsuite.test.ts
@@ -0,0 +1,27 @@
+import { describe, expect, it } from 'vitest'
+import { NetSuiteBlock } from '@/blocks/blocks/netsuite'
+
+const blockParams = NetSuiteBlock.tools.config?.params
+if (!blockParams) throw new Error('NetSuiteBlock has no params mapper')
+
+describe('NetSuiteBlock', () => {
+ it('parses a JSON body on an agent tool call, whose operation arrives only in context', () => {
+ const args = { recordType: 'customer', body: '{"companyName":"Acme"}' }
+ const result = {
+ ...args,
+ ...blockParams(args, { operation: 'netsuite_create_record' }),
+ }
+
+ expect(result.body).toEqual({ companyName: 'Acme' })
+ })
+
+ it('keeps the model task ID on an agent async status call', () => {
+ const args = { jobId: '42', view: 'task', taskId: '7' }
+ const result = {
+ ...args,
+ ...blockParams(args, { operation: 'netsuite_get_async_status' }),
+ }
+
+ expect(result.taskId).toBe('7')
+ })
+})
diff --git a/apps/sim/blocks/blocks/netsuite.ts b/apps/sim/blocks/blocks/netsuite.ts
index 7801ad87d9b..d4048b05e56 100644
--- a/apps/sim/blocks/blocks/netsuite.ts
+++ b/apps/sim/blocks/blocks/netsuite.ts
@@ -1,7 +1,7 @@
import { NetSuiteIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { parseOptionalNumberInput } from '@/blocks/utils'
+import { mapperOperation, parseOptionalNumberInput, toolCallArg } from '@/blocks/utils'
const RECORD_TYPE_OPERATIONS = [
'netsuite_list_records',
@@ -95,10 +95,6 @@ const BATCH_WRITE_OPERATIONS = [
'netsuite_batch_upsert_records',
]
-function usesOperation(operation: unknown, operations: readonly string[]): boolean {
- return typeof operation === 'string' && operations.includes(operation)
-}
-
function optionalBoolean(value: unknown): boolean | undefined {
if (value === true || value === 'true') return true
if (value === false || value === 'false') return false
@@ -844,35 +840,36 @@ Return ONLY the SuiteQL query - no explanations, no markdown, no extra text.`,
],
config: {
tool: (params) => params.operation,
- params: (params) => {
- if (typeof params.operation !== 'string') return {}
- const { operation, resultTaskId, statusTaskId, ...rest } = params
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
+ if (!operation) return {}
+ const { resultTaskId, statusTaskId, ...rest } = params
const taskId =
operation === 'netsuite_get_async_status'
- ? statusTaskId
+ ? (statusTaskId ?? toolCallArg(context, rest.taskId))
: operation === 'netsuite_get_async_result'
- ? resultTaskId
+ ? (resultTaskId ?? toolCallArg(context, rest.taskId))
: undefined
return {
...rest,
- body: usesOperation(operation, BODY_OPERATIONS)
+ body: BODY_OPERATIONS.includes(operation)
? parseJson(rest.body, 'Record fields')
: undefined,
- items: usesOperation(operation, BATCH_WRITE_OPERATIONS)
+ items: BATCH_WRITE_OPERATIONS.includes(operation)
? parseJson(rest.items, 'Records')
: undefined,
- limit: usesOperation(operation, PAGING_OPERATIONS)
+ limit: PAGING_OPERATIONS.includes(operation)
? parseOptionalNumberInput(rest.limit, 'Limit', {
integer: true,
min: 1,
max: 1_000,
})
: undefined,
- offset: usesOperation(operation, PAGING_OPERATIONS)
+ offset: PAGING_OPERATIONS.includes(operation)
? parseOptionalNumberInput(rest.offset, 'Offset', { integer: true, min: 0 })
: undefined,
- expand: usesOperation(operation, RECORD_QUERY_OPERATIONS) ? rest.expand : undefined,
- expandSubResources: usesOperation(operation, RECORD_QUERY_OPERATIONS)
+ expand: RECORD_QUERY_OPERATIONS.includes(operation) ? rest.expand : undefined,
+ expandSubResources: RECORD_QUERY_OPERATIONS.includes(operation)
? optionalBoolean(rest.expandSubResources)
: undefined,
roleId:
diff --git a/apps/sim/blocks/blocks/new_relic.ts b/apps/sim/blocks/blocks/new_relic.ts
index 18783044c72..7e7f4a2e6ef 100644
--- a/apps/sim/blocks/blocks/new_relic.ts
+++ b/apps/sim/blocks/blocks/new_relic.ts
@@ -2,7 +2,7 @@ import { getErrorMessage } from '@sim/utils/errors'
import { NewRelicIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, withSavedCredential } from '@/blocks/utils'
import type { NewRelicCustomAttributes } from '@/tools/new_relic/types'
import { NEW_RELIC_REGIONS } from '@/tools/new_relic/utils'
@@ -285,13 +285,13 @@ Return ONLY the numeric timestamp - no explanations, no extra text.`,
],
config: {
tool: (params) => String(params.operation || 'new_relic_nrql_query'),
- params: (params) => {
+ params: (params, context) => {
const baseParams = {
apiKey: params.apiKey,
region: params.region || 'us',
}
- switch (params.operation) {
+ switch (mapperOperation(params, context)) {
case 'new_relic_nrql_query':
return {
...baseParams,
diff --git a/apps/sim/blocks/blocks/notion.ts b/apps/sim/blocks/blocks/notion.ts
index 39744ee29c6..d9f45810388 100644
--- a/apps/sim/blocks/blocks/notion.ts
+++ b/apps/sim/blocks/blocks/notion.ts
@@ -3,7 +3,11 @@ import { toError } from '@sim/utils/errors'
import { NotionIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { createVersionedToolSelector, parseOptionalJsonInput } from '@/blocks/utils'
+import {
+ createVersionedToolSelector,
+ mapperOperation,
+ parseOptionalJsonInput,
+} from '@/blocks/utils'
import { getTrigger } from '@/triggers'
/**
@@ -625,7 +629,6 @@ export const NotionBlock: BlockConfig = {
params: (params, context) => {
const {
oauthCredential,
- operation: storedOperation,
properties,
filter,
sorts,
@@ -637,7 +640,7 @@ export const NotionBlock: BlockConfig = {
commentContent,
...rest
} = params
- const operation = storedOperation ?? context?.operation
+ const operation = mapperOperation(params, context)
// Parse properties from JSON string for create/add operations
let parsedProperties
diff --git a/apps/sim/blocks/blocks/okta.test.ts b/apps/sim/blocks/blocks/okta.test.ts
index 1788e5e0c67..97816403c7c 100644
--- a/apps/sim/blocks/blocks/okta.test.ts
+++ b/apps/sim/blocks/blocks/okta.test.ts
@@ -68,6 +68,53 @@ describe('Okta block params transform', () => {
})
})
+/**
+ * Mirrors `providers/utils.ts` on an Agent tool call: the model's args arrive
+ * keyed by the tool's param names, the operation only in the context, and the
+ * mapper's result is spread over the merged params.
+ */
+function agentCall(operation: string, modelArgs: Record): Record {
+ const transform = OktaBlock.tools.config?.params
+ if (!transform) throw new Error('Okta block has no params transform')
+ const args = { apiKey: 'token', domain: 'dev-1.okta.com', ...modelArgs }
+ return { ...args, ...transform(args, { operation }) }
+}
+
+describe('Okta params transform on an agent tool call', () => {
+ it('keeps the cursor the model sends for the next page', () => {
+ expect(agentCall('okta_get_logs', { after: 'cursor-2' }).after).toBe('cursor-2')
+ expect(agentCall('okta_list_groups', { after: 'cursor-3' }).after).toBe('cursor-3')
+ })
+
+ it('keeps sendEmail false on a password reset so the link comes back instead of an email', () => {
+ expect(agentCall('okta_reset_password', { userId: '00u1', sendEmail: false }).sendEmail).toBe(
+ false
+ )
+ })
+
+ it('keeps sendEmail on a deactivation, which the canvas reads from its own switch', () => {
+ expect(agentCall('okta_deactivate_user', { userId: '00u1', sendEmail: true }).sendEmail).toBe(
+ true
+ )
+ })
+
+ it('keeps the activate flag on a factor enrollment', () => {
+ expect(
+ agentCall('okta_enroll_factor', {
+ userId: '00u1',
+ factorType: 'sms',
+ provider: 'OKTA',
+ phoneNumber: '+14155550123',
+ activate: true,
+ }).activate
+ ).toBe(true)
+ })
+
+ it('keeps the keyword on a group rule listing', () => {
+ expect(agentCall('okta_list_group_rules', { search: 'Engineering' }).search).toBe('Engineering')
+ })
+})
+
/** Block state for a block created after the split: every current id present. */
function modernBlockState(overrides: Record): BlockState {
const subBlocks: Record = {}
diff --git a/apps/sim/blocks/blocks/okta.ts b/apps/sim/blocks/blocks/okta.ts
index e9324f8336c..6df7cda7f51 100644
--- a/apps/sim/blocks/blocks/okta.ts
+++ b/apps/sim/blocks/blocks/okta.ts
@@ -1,7 +1,7 @@
import { OktaIcon } from '@/components/icons'
import type { BlockConfig, BlockMeta } from '@/blocks/types'
import { AuthMode, IntegrationType } from '@/blocks/types'
-import { withSavedCredential } from '@/blocks/utils'
+import { mapperOperation, toolCallArg, withSavedCredential } from '@/blocks/utils'
/**
* Coerces a numeric subBlock value, dropping anything that is not a real number.
@@ -32,6 +32,7 @@ const CURSOR_FIELD_BY_OPERATION: Record = {
okta_list_users: 'after',
okta_list_groups: 'groupsAfter',
okta_list_group_members: 'groupMembersAfter',
+ okta_list_user_groups: 'userGroupsAfter',
okta_get_logs: 'logsAfter',
okta_list_apps: 'appsAfter',
okta_list_app_users: 'appUsersAfter',
@@ -83,6 +84,11 @@ export const OktaBlock: BlockConfig = {
okta_deactivate_user: [{ text: 'Deactivate user', field: 'userId', core: true }],
okta_suspend_user: [{ text: 'Suspend user', field: 'userId', core: true }],
okta_unsuspend_user: [{ text: 'Unsuspend user', field: 'userId', core: true }],
+ okta_unlock_user: [{ text: 'Unlock user', field: 'userId', core: true }],
+ okta_list_user_groups: [
+ { text: 'List the groups of user', field: 'userId', core: true },
+ { text: ', up to', field: 'limit' },
+ ],
okta_reset_password: [{ text: 'Reset the password of user', field: 'userId', core: true }],
okta_delete_user: [{ text: 'Permanently delete user', field: 'userId', core: true }],
okta_list_groups: [
@@ -214,6 +220,7 @@ export const OktaBlock: BlockConfig = {
{ label: 'Deactivate User', id: 'okta_deactivate_user' },
{ label: 'Suspend User', id: 'okta_suspend_user' },
{ label: 'Unsuspend User', id: 'okta_unsuspend_user' },
+ { label: 'Unlock User', id: 'okta_unlock_user' },
{ label: 'Reset Password', id: 'okta_reset_password' },
{ label: 'Delete User', id: 'okta_delete_user' },
{ label: 'List Groups', id: 'okta_list_groups' },
@@ -224,6 +231,7 @@ export const OktaBlock: BlockConfig = {
{ label: 'Add User to Group', id: 'okta_add_user_to_group' },
{ label: 'Remove User from Group', id: 'okta_remove_user_from_group' },
{ label: 'List Group Members', id: 'okta_list_group_members' },
+ { label: 'List User Groups', id: 'okta_list_user_groups' },
{ label: 'List Group Rules', id: 'okta_list_group_rules' },
{ label: 'Get Group Rule', id: 'okta_get_group_rule' },
{ label: 'Create Group Rule', id: 'okta_create_group_rule' },
@@ -330,7 +338,7 @@ export const OktaBlock: BlockConfig = {
id: 'userId',
title: 'User ID',
type: 'short-input',
- placeholder: 'User ID or login (email)',
+ placeholder: 'Okta user ID (some operations also accept a login)',
condition: {
field: 'operation',
value: [
@@ -340,6 +348,8 @@ export const OktaBlock: BlockConfig = {
'okta_deactivate_user',
'okta_suspend_user',
'okta_unsuspend_user',
+ 'okta_unlock_user',
+ 'okta_list_user_groups',
'okta_reset_password',
'okta_delete_user',
'okta_add_user_to_group',
@@ -366,6 +376,8 @@ export const OktaBlock: BlockConfig = {
'okta_deactivate_user',
'okta_suspend_user',
'okta_unsuspend_user',
+ 'okta_unlock_user',
+ 'okta_list_user_groups',
'okta_reset_password',
'okta_delete_user',
'okta_add_user_to_group',
@@ -639,6 +651,7 @@ export const OktaBlock: BlockConfig = {
title: 'Factor Type',
type: 'dropdown',
options: [
+ { label: 'Select a factor type', id: '' },
{ label: 'SMS', id: 'sms' },
{ label: 'Voice Call', id: 'call' },
{ label: 'Email', id: 'email' },
@@ -656,6 +669,7 @@ export const OktaBlock: BlockConfig = {
title: 'Factor Provider',
type: 'dropdown',
options: [
+ { label: 'Select a provider', id: '' },
{ label: 'Okta', id: 'OKTA' },
{ label: 'Google', id: 'GOOGLE' },
{ label: 'FIDO', id: 'FIDO' },
@@ -805,6 +819,7 @@ export const OktaBlock: BlockConfig = {
title: 'Role Type',
type: 'dropdown',
options: [
+ { label: 'Select a role', id: '' },
{ label: 'Super Admin', id: 'SUPER_ADMIN' },
{ label: 'Org Admin', id: 'ORG_ADMIN' },
{ label: 'App Admin', id: 'APP_ADMIN' },
@@ -903,6 +918,7 @@ export const OktaBlock: BlockConfig = {
title: 'Sort Order',
type: 'dropdown',
options: [
+ { label: 'Default (ascending)', id: '' },
{ label: 'Ascending', id: 'ASCENDING' },
{ label: 'Descending', id: 'DESCENDING' },
],
@@ -921,6 +937,7 @@ export const OktaBlock: BlockConfig = {
'okta_list_users',
'okta_list_groups',
'okta_list_group_members',
+ 'okta_list_user_groups',
'okta_get_logs',
'okta_list_apps',
'okta_list_app_users',
@@ -963,6 +980,14 @@ export const OktaBlock: BlockConfig = {
condition: { field: 'operation', value: 'okta_list_group_members' },
mode: 'advanced',
},
+ {
+ id: 'userGroupsAfter',
+ title: 'Cursor',
+ type: 'short-input',
+ placeholder: 'nextCursor from a previous run',
+ condition: { field: 'operation', value: 'okta_list_user_groups' },
+ mode: 'advanced',
+ },
{
id: 'logsAfter',
title: 'Cursor',
@@ -1015,6 +1040,7 @@ export const OktaBlock: BlockConfig = {
'okta_deactivate_user',
'okta_suspend_user',
'okta_unsuspend_user',
+ 'okta_unlock_user',
'okta_reset_password',
'okta_delete_user',
'okta_list_groups',
@@ -1025,6 +1051,7 @@ export const OktaBlock: BlockConfig = {
'okta_add_user_to_group',
'okta_remove_user_from_group',
'okta_list_group_members',
+ 'okta_list_user_groups',
'okta_list_group_rules',
'okta_get_group_rule',
'okta_create_group_rule',
@@ -1066,8 +1093,8 @@ export const OktaBlock: BlockConfig = {
* (`update_user` is a POST merge) would overwrite the stored Okta value
* with an empty string rather than leaving it untouched.
*/
- params: (params) => {
- const operation = String(params.operation)
+ params: (params, context) => {
+ const operation = mapperOperation(params, context)
const cursorField = CURSOR_FIELD_BY_OPERATION[operation]
const result: Record = {
@@ -1080,8 +1107,9 @@ export const OktaBlock: BlockConfig = {
description: blankToUndefined(params.groupDescription),
/** Group rules get their own keyword field but the same wire param. */
search:
- params.operation === 'okta_list_group_rules'
- ? blankToUndefined(params.ruleSearch)
+ operation === 'okta_list_group_rules'
+ ? (blankToUndefined(params.ruleSearch) ??
+ toolCallArg(context, blankToUndefined(params.search)))
: blankToUndefined(params.search),
/**
* Keyed off the operation rather than `??`: both switches are advanced,
@@ -1091,14 +1119,19 @@ export const OktaBlock: BlockConfig = {
*/
sendEmail: SEND_EMAIL_DEFAULT_ON.has(operation)
? blankToUndefined(params.sendEmail)
- : blankToUndefined(params.sendDeactivationEmail),
+ : (blankToUndefined(params.sendDeactivationEmail) ??
+ toolCallArg(context, blankToUndefined(params.sendEmail))),
/** Same stale-advanced-value hazard: pick the toggle for this operation. */
activate:
operation === 'okta_enroll_factor'
- ? blankToUndefined(params.activateFactor)
+ ? (blankToUndefined(params.activateFactor) ??
+ toolCallArg(context, blankToUndefined(params.activate)))
: blankToUndefined(params.activate),
/** A cursor is only valid on the endpoint that minted it. */
- after: cursorField ? blankToUndefined(params[cursorField]) : undefined,
+ after: cursorField
+ ? (blankToUndefined(params[cursorField]) ??
+ toolCallArg(context, blankToUndefined(params.after)))
+ : undefined,
}
const mappedKeys = new Set([
@@ -1161,6 +1194,7 @@ export const OktaBlock: BlockConfig = {
after: { type: 'string', description: 'Cursor for the next page of users' },
groupsAfter: { type: 'string', description: 'Cursor for the next page of groups' },
groupMembersAfter: { type: 'string', description: 'Cursor for the next page of group members' },
+ userGroupsAfter: { type: 'string', description: 'Cursor for the next page of user groups' },
logsAfter: { type: 'string', description: 'Cursor for the next page of System Log events' },
appsAfter: { type: 'string', description: 'Cursor for the next page of applications' },
appUsersAfter: {
@@ -1268,6 +1302,7 @@ export const OktaBlock: BlockConfig = {
deactivated: { type: 'boolean', description: 'Whether user was deactivated' },
suspended: { type: 'boolean', description: 'Whether user was suspended' },
unsuspended: { type: 'boolean', description: 'Whether user was unsuspended' },
+ unlocked: { type: 'boolean', description: 'Whether user was unlocked' },
activated: {
type: 'string',
description:
diff --git a/apps/sim/blocks/blocks/onedrive.test.ts b/apps/sim/blocks/blocks/onedrive.test.ts
new file mode 100644
index 00000000000..cffffa79b13
--- /dev/null
+++ b/apps/sim/blocks/blocks/onedrive.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest'
+import { OneDriveBlock } from '@/blocks/blocks/onedrive'
+import type { BlockToolParamsContext } from '@/blocks/types'
+
+/** What the tool receives: the mapper's result spread over its own input, as both callers merge it. */
+const forwarded = (inputs: Record