Skip to content

Commit 8f9771b

Browse files
feat(custom-blocks): add deploy_custom_block copilot tool
1 parent 60bea92 commit 8f9771b

7 files changed

Lines changed: 872 additions & 23 deletions

File tree

apps/sim/lib/copilot/generated/tool-catalog-v1.ts

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface ToolCatalogEntry {
2323
| 'deploy'
2424
| 'deploy_api'
2525
| 'deploy_chat'
26+
| 'deploy_custom_block'
2627
| 'deploy_mcp'
2728
| 'diff_workflows'
2829
| 'download_to_workspace_file'
@@ -121,6 +122,7 @@ export interface ToolCatalogEntry {
121122
| 'deploy'
122123
| 'deploy_api'
123124
| 'deploy_chat'
125+
| 'deploy_custom_block'
124126
| 'deploy_mcp'
125127
| 'diff_workflows'
126128
| 'download_to_workspace_file'
@@ -536,7 +538,7 @@ export const Deploy: ToolCatalogEntry = {
536538
properties: {
537539
request: {
538540
description:
539-
'Detailed deployment instructions. Include deployment type (api/chat/mcp) and ALL user-specified options: identifier, title, description, authType, password, allowedEmails, welcomeMessage, outputConfigs (block outputs to display).',
541+
'Detailed deployment instructions. Include deployment type (api/chat/mcp/custom_block) and ALL user-specified options: identifier, title, description, authType, password, allowedEmails, welcomeMessage, outputConfigs (block outputs to display), and for custom blocks the block name, description, icon URL, and exposed outputs.',
540542
type: 'string',
541543
},
542544
},
@@ -772,6 +774,118 @@ export const DeployChat: ToolCatalogEntry = {
772774
requiredPermission: 'admin',
773775
}
774776

777+
export const DeployCustomBlock: ToolCatalogEntry = {
778+
id: 'deploy_custom_block',
779+
name: 'deploy_custom_block',
780+
route: 'sim',
781+
mode: 'async',
782+
parameters: {
783+
type: 'object',
784+
properties: {
785+
action: {
786+
type: 'string',
787+
description: 'Whether to publish (deploy) or unpublish (undeploy) the custom block',
788+
enum: ['deploy', 'undeploy'],
789+
default: 'deploy',
790+
},
791+
description: {
792+
type: 'string',
793+
description: 'Short description shown in the block picker, max 280 characters',
794+
},
795+
exposedOutputs: {
796+
type: 'array',
797+
description:
798+
"Outputs the block exposes, each mapping a child block output path to a friendly name (use get_block_outputs for valid paths). Omit to expose the terminal block's whole result",
799+
items: {
800+
type: 'object',
801+
properties: {
802+
blockId: { type: 'string', description: 'Block UUID inside the workflow' },
803+
name: { type: 'string', description: 'Friendly output name shown on the block' },
804+
path: {
805+
type: 'string',
806+
description:
807+
"Dot-path into that block's output (from get_block_outputs relativeOutputs)",
808+
},
809+
},
810+
required: ['blockId', 'path', 'name'],
811+
},
812+
},
813+
iconUrl: {
814+
type: 'string',
815+
description:
816+
'Optional icon image for the block: a workspace file VFS path (e.g. "files/icon.png", copied into public icon storage at publish) or an external image URL. Omit to use the organization\'s default icon',
817+
},
818+
inputs: {
819+
type: 'array',
820+
description:
821+
"Optional per-input placeholder overrides. Input names and types are derived from the workflow's input trigger and cannot be changed here",
822+
items: {
823+
type: 'object',
824+
properties: {
825+
id: { type: 'string', description: 'Stable id of the input trigger field' },
826+
placeholder: {
827+
type: 'string',
828+
description: "Placeholder text shown in the block's input field",
829+
},
830+
},
831+
required: ['id'],
832+
},
833+
},
834+
name: {
835+
type: 'string',
836+
description:
837+
'Display name for the block, max 60 characters (required on first publish; defaults to the existing block name when republishing)',
838+
},
839+
workflowId: { type: 'string', description: 'Workflow ID (defaults to active workflow)' },
840+
},
841+
},
842+
resultSchema: {
843+
type: 'object',
844+
properties: {
845+
action: {
846+
type: 'string',
847+
description: 'Action performed by the tool, such as "deploy" or "undeploy".',
848+
},
849+
blockId: { type: 'string', description: 'Custom block record ID.' },
850+
blockType: {
851+
type: 'string',
852+
description: 'Stable block type slug (custom_block_*) used in workflow state.',
853+
},
854+
deploymentConfig: {
855+
type: 'object',
856+
description:
857+
"Structured deployment configuration keyed by surface name. Includes the block's type, name, description, icon, derived input fields, and exposed outputs.",
858+
},
859+
deploymentStatus: {
860+
type: 'object',
861+
description:
862+
'Structured per-surface deployment status keyed by surface name, including customBlock and the underlying api surface when applicable.',
863+
},
864+
deploymentType: {
865+
type: 'string',
866+
description:
867+
'Deployment surface this result describes. For deploy_custom_block this is always "custom_block".',
868+
},
869+
isDeployed: {
870+
type: 'boolean',
871+
description: 'Whether the custom block is published after this tool call.',
872+
},
873+
name: { type: 'string', description: 'Display name of the custom block.' },
874+
removed: {
875+
type: 'boolean',
876+
description: 'Whether the custom block was unpublished during an undeploy action.',
877+
},
878+
updated: {
879+
type: 'boolean',
880+
description: 'Whether an existing custom block was updated instead of created.',
881+
},
882+
workflowId: { type: 'string', description: 'Workflow ID the custom block is bound to.' },
883+
},
884+
required: ['deploymentType', 'deploymentStatus'],
885+
},
886+
requiredPermission: 'admin',
887+
}
888+
775889
export const DeployMcp: ToolCatalogEntry = {
776890
id: 'deploy_mcp',
777891
name: 'deploy_mcp',
@@ -4581,6 +4695,7 @@ export const TOOL_CATALOG: Record<string, ToolCatalogEntry> = {
45814695
[Deploy.id]: Deploy,
45824696
[DeployApi.id]: DeployApi,
45834697
[DeployChat.id]: DeployChat,
4698+
[DeployCustomBlock.id]: DeployCustomBlock,
45844699
[DeployMcp.id]: DeployMcp,
45854700
[DiffWorkflows.id]: DiffWorkflows,
45864701
[DownloadToWorkspaceFile.id]: DownloadToWorkspaceFile,

apps/sim/lib/copilot/generated/tool-schemas-v1.ts

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
318318
properties: {
319319
request: {
320320
description:
321-
'Detailed deployment instructions. Include deployment type (api/chat/mcp) and ALL user-specified options: identifier, title, description, authType, password, allowedEmails, welcomeMessage, outputConfigs (block outputs to display).',
321+
'Detailed deployment instructions. Include deployment type (api/chat/mcp/custom_block) and ALL user-specified options: identifier, title, description, authType, password, allowedEmails, welcomeMessage, outputConfigs (block outputs to display), and for custom blocks the block name, description, icon URL, and exposed outputs.',
322322
type: 'string',
323323
},
324324
},
@@ -570,6 +570,133 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
570570
],
571571
},
572572
},
573+
deploy_custom_block: {
574+
parameters: {
575+
type: 'object',
576+
properties: {
577+
action: {
578+
type: 'string',
579+
description: 'Whether to publish (deploy) or unpublish (undeploy) the custom block',
580+
enum: ['deploy', 'undeploy'],
581+
default: 'deploy',
582+
},
583+
description: {
584+
type: 'string',
585+
description: 'Short description shown in the block picker, max 280 characters',
586+
},
587+
exposedOutputs: {
588+
type: 'array',
589+
description:
590+
"Outputs the block exposes, each mapping a child block output path to a friendly name (use get_block_outputs for valid paths). Omit to expose the terminal block's whole result",
591+
items: {
592+
type: 'object',
593+
properties: {
594+
blockId: {
595+
type: 'string',
596+
description: 'Block UUID inside the workflow',
597+
},
598+
name: {
599+
type: 'string',
600+
description: 'Friendly output name shown on the block',
601+
},
602+
path: {
603+
type: 'string',
604+
description:
605+
"Dot-path into that block's output (from get_block_outputs relativeOutputs)",
606+
},
607+
},
608+
required: ['blockId', 'path', 'name'],
609+
},
610+
},
611+
iconUrl: {
612+
type: 'string',
613+
description:
614+
'Optional icon image for the block: a workspace file VFS path (e.g. "files/icon.png", copied into public icon storage at publish) or an external image URL. Omit to use the organization\'s default icon',
615+
},
616+
inputs: {
617+
type: 'array',
618+
description:
619+
"Optional per-input placeholder overrides. Input names and types are derived from the workflow's input trigger and cannot be changed here",
620+
items: {
621+
type: 'object',
622+
properties: {
623+
id: {
624+
type: 'string',
625+
description: 'Stable id of the input trigger field',
626+
},
627+
placeholder: {
628+
type: 'string',
629+
description: "Placeholder text shown in the block's input field",
630+
},
631+
},
632+
required: ['id'],
633+
},
634+
},
635+
name: {
636+
type: 'string',
637+
description:
638+
'Display name for the block, max 60 characters (required on first publish; defaults to the existing block name when republishing)',
639+
},
640+
workflowId: {
641+
type: 'string',
642+
description: 'Workflow ID (defaults to active workflow)',
643+
},
644+
},
645+
},
646+
resultSchema: {
647+
type: 'object',
648+
properties: {
649+
action: {
650+
type: 'string',
651+
description: 'Action performed by the tool, such as "deploy" or "undeploy".',
652+
},
653+
blockId: {
654+
type: 'string',
655+
description: 'Custom block record ID.',
656+
},
657+
blockType: {
658+
type: 'string',
659+
description: 'Stable block type slug (custom_block_*) used in workflow state.',
660+
},
661+
deploymentConfig: {
662+
type: 'object',
663+
description:
664+
"Structured deployment configuration keyed by surface name. Includes the block's type, name, description, icon, derived input fields, and exposed outputs.",
665+
},
666+
deploymentStatus: {
667+
type: 'object',
668+
description:
669+
'Structured per-surface deployment status keyed by surface name, including customBlock and the underlying api surface when applicable.',
670+
},
671+
deploymentType: {
672+
type: 'string',
673+
description:
674+
'Deployment surface this result describes. For deploy_custom_block this is always "custom_block".',
675+
},
676+
isDeployed: {
677+
type: 'boolean',
678+
description: 'Whether the custom block is published after this tool call.',
679+
},
680+
name: {
681+
type: 'string',
682+
description: 'Display name of the custom block.',
683+
},
684+
removed: {
685+
type: 'boolean',
686+
description: 'Whether the custom block was unpublished during an undeploy action.',
687+
},
688+
updated: {
689+
type: 'boolean',
690+
description: 'Whether an existing custom block was updated instead of created.',
691+
},
692+
workflowId: {
693+
type: 'string',
694+
description: 'Workflow ID the custom block is bound to.',
695+
},
696+
},
697+
required: ['deploymentType', 'deploymentStatus'],
698+
},
699+
},
573700
deploy_mcp: {
574701
parameters: {
575702
type: 'object',

apps/sim/lib/copilot/tool-executor/register-handlers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
DeleteWorkspaceMcpServer,
99
DeployApi,
1010
DeployChat,
11+
DeployCustomBlock,
1112
DeployMcp,
1213
DiffWorkflows,
1314
FunctionExecute,
@@ -53,6 +54,7 @@ import {
5354
} from '@/lib/copilot/generated/tool-catalog-v1'
5455
import { createServerToolHandler } from '@/lib/copilot/tools/registry/server-tool-adapter'
5556
import { getRegisteredServerToolNames } from '@/lib/copilot/tools/server/router'
57+
import { executeDeployCustomBlock } from '../tools/handlers/deployment/custom-block'
5658
import {
5759
executeDeployApi,
5860
executeDeployChat,
@@ -156,6 +158,7 @@ function buildHandlerMap(): Record<string, ToolHandler> {
156158
[DeployApi.id]: h(executeDeployApi),
157159
[DeployChat.id]: h(executeDeployChat),
158160
[DeployMcp.id]: h(executeDeployMcp),
161+
[DeployCustomBlock.id]: h(executeDeployCustomBlock),
159162
[Redeploy.id]: h(executeRedeploy),
160163
[CheckDeploymentStatus.id]: h(executeCheckDeploymentStatus),
161164
[ListWorkspaceMcpServers.id]: h(executeListWorkspaceMcpServers),

0 commit comments

Comments
 (0)