Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
SKY-8781 preserve login credential keys on MCP workflow updates (#5479)
Marc Kelechava1ecde880aba6
diff --git a/fern/openapi/skyvern_openapi.json b/fern/openapi/skyvern_openapi.jsonindex 5a64fddc3..ecd0b6de5 100644--- a/fern/openapi/skyvern_openapi.json+++ b/fern/openapi/skyvern_openapi.json@@ -3970,6 +3970,599 @@},"x-fern-sdk-method-name": "run_sdk_action"}+ },+ "/v1/schedules": {+ "get": {+ "tags": [+ "Schedules"+ ],+ "summary": "List all schedules for the organization",+ "operationId": "schedules_list_all",+ "parameters": [+ {+ "name": "page",+ "in": "query",+ "required": false,+ "schema": {+ "type": "integer",+ "minimum": 1,+ "default": 1,+ "title": "Page"+ }+ },+ {+ "name": "page_size",+ "in": "query",+ "required": false,+ "schema": {+ "type": "integer",+ "maximum": 100,+ "minimum": 1,+ "default": 10,+ "title": "Page Size"+ }+ },+ {+ "name": "status",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "enum": [+ "active",+ "paused"+ ],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Filter by status: 'active' or 'paused'",+ "title": "Status"+ },+ "description": "Filter by status: 'active' or 'paused'"+ },+ {+ "name": "search",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Search by workflow title or schedule name",+ "title": "Search"+ },+ "description": "Search by workflow title or schedule name"+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OrganizationScheduleListResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ }+ },+ "/v1/workflows/{workflow_permanent_id}/schedules": {+ "post": {+ "tags": [+ "Schedules"+ ],+ "summary": "Create a schedule for a workflow",+ "operationId": "schedules_create",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleUpsertRequest"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ },+ "get": {+ "tags": [+ "Schedules"+ ],+ "summary": "List schedules for a workflow",+ "operationId": "schedules_list",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleListResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ }+ },+ "/v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}": {+ "get": {+ "tags": [+ "Schedules"+ ],+ "summary": "Get a workflow schedule by id",+ "operationId": "schedules_get",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "workflow_schedule_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Schedule Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ },+ "put": {+ "tags": [+ "Schedules"+ ],+ "summary": "Update a workflow schedule",+ "operationId": "schedules_update",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "workflow_schedule_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Schedule Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleUpsertRequest"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ },+ "delete": {+ "tags": [+ "Schedules"+ ],+ "summary": "Delete a workflow schedule",+ "operationId": "schedules_delete",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "workflow_schedule_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Schedule Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/DeleteScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ }+ },+ "/v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}/enable": {+ "post": {+ "tags": [+ "Schedules"+ ],+ "summary": "Enable a workflow schedule",+ "operationId": "schedules_enable",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "workflow_schedule_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Schedule Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ }+ },+ "/v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}/disable": {+ "post": {+ "tags": [+ "Schedules"+ ],+ "summary": "Disable a workflow schedule",+ "operationId": "schedules_disable",+ "parameters": [+ {+ "name": "workflow_permanent_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Permanent Id"+ }+ },+ {+ "name": "workflow_schedule_id",+ "in": "path",+ "required": true,+ "schema": {+ "type": "string",+ "title": "Workflow Schedule Id"+ }+ },+ {+ "name": "x-api-key",+ "in": "header",+ "required": false,+ "schema": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",+ "title": "X-Api-Key"+ },+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."+ }+ ],+ "responses": {+ "200": {+ "description": "Successful Response",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/WorkflowScheduleResponse"+ }+ }+ }+ },+ "422": {+ "description": "Validation Error",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/HTTPValidationError"+ }+ }+ }+ }+ }+ }}},"components": {@@ -5983,7 +6576,7 @@"properties": {"file": {"type": "string",- "format": "binary",+ "contentMediaType": "application/octet-stream","title": "File"}},@@ -7554,6 +8147,19 @@"title": "CreditCardCredentialResponse","description": "Response model for credit card credentials — non-sensitive fields only.\n\nSECURITY: Must NEVER include full card number, CVV, expiration date, or card holder name."},+ "DeleteScheduleResponse": {+ "properties": {+ "ok": {+ "type": "boolean",+ "title": "Ok"+ }+ },+ "type": "object",+ "required": [+ "ok"+ ],+ "title": "DeleteScheduleResponse"+ },"DeployScriptRequest": {"properties": {"files": {@@ -12540,9 +13146,164 @@"title": "Parameter Type","default": "onepassword"},- "key": {- "type": "string",- "title": "Key"+ "key": {+ "type": "string",+ "title": "Key"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ },+ "onepassword_credential_parameter_id": {+ "type": "string",+ "title": "Onepassword Credential Parameter Id"+ },+ "workflow_id": {+ "type": "string",+ "title": "Workflow Id"+ },+ "vault_id": {+ "type": "string",+ "title": "Vault Id"+ },+ "item_id": {+ "type": "string",+ "title": "Item Id"+ },+ "created_at": {+ "type": "string",+ "format": "date-time",+ "title": "Created At"+ },+ "modified_at": {+ "type": "string",+ "format": "date-time",+ "title": "Modified At"+ },+ "deleted_at": {+ "anyOf": [+ {+ "type": "string",+ "format": "date-time"+ },+ {+ "type": "null"+ }+ ],+ "title": "Deleted At"+ }+ },+ "type": "object",+ "required": [+ "key",+ "onepassword_credential_parameter_id",+ "workflow_id",+ "vault_id",+ "item_id",+ "created_at",+ "modified_at"+ ],+ "title": "OnePasswordCredentialParameter"+ },+ "OnePasswordCredentialParameterYAML": {+ "properties": {+ "parameter_type": {+ "type": "string",+ "const": "onepassword",+ "title": "Parameter Type",+ "default": "onepassword"+ },+ "key": {+ "type": "string",+ "title": "Key"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ },+ "vault_id": {+ "type": "string",+ "title": "Vault Id"+ },+ "item_id": {+ "type": "string",+ "title": "Item Id"+ }+ },+ "type": "object",+ "required": [+ "key",+ "vault_id",+ "item_id"+ ],+ "title": "OnePasswordCredentialParameterYAML"+ },+ "OrganizationScheduleItem": {+ "properties": {+ "workflow_schedule_id": {+ "type": "string",+ "title": "Workflow Schedule Id"+ },+ "organization_id": {+ "type": "string",+ "title": "Organization Id"+ },+ "workflow_permanent_id": {+ "type": "string",+ "title": "Workflow Permanent Id"+ },+ "workflow_title": {+ "type": "string",+ "title": "Workflow Title"+ },+ "cron_expression": {+ "type": "string",+ "title": "Cron Expression"+ },+ "timezone": {+ "type": "string",+ "title": "Timezone"+ },+ "enabled": {+ "type": "boolean",+ "title": "Enabled"+ },+ "parameters": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Parameters"+ },+ "name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Name"},"description": {"anyOf": [@@ -12555,21 +13316,17 @@],"title": "Description"},- "onepassword_credential_parameter_id": {- "type": "string",- "title": "Onepassword Credential Parameter Id"- },- "workflow_id": {- "type": "string",- "title": "Workflow Id"- },- "vault_id": {- "type": "string",- "title": "Vault Id"- },- "item_id": {- "type": "string",- "title": "Item Id"+ "next_run": {+ "anyOf": [+ {+ "type": "string",+ "format": "date-time"+ },+ {+ "type": "null"+ }+ ],+ "title": "Next Run"},"created_at": {"type": "string",@@ -12580,71 +13337,53 @@"type": "string","format": "date-time","title": "Modified At"- },- "deleted_at": {- "anyOf": [- {- "type": "string",- "format": "date-time"- },- {- "type": "null"- }- ],- "title": "Deleted At"}},"type": "object","required": [- "key",- "onepassword_credential_parameter_id",- "workflow_id",- "vault_id",- "item_id",+ "workflow_schedule_id",+ "organization_id",+ "workflow_permanent_id",+ "workflow_title",+ "cron_expression",+ "timezone",+ "enabled","created_at","modified_at"],- "title": "OnePasswordCredentialParameter"+ "title": "OrganizationScheduleItem",+ "description": "Compact schedule projection for the org-wide list endpoint.\n\nIntentionally omits `backend_schedule_id` — the list view is for browsing\nschedules in the dashboard, not for managing the underlying execution-backend\nbinding. Callers that need the backend id should fetch the individual\nschedule via the per-workflow get endpoint."},- "OnePasswordCredentialParameterYAML": {+ "OrganizationScheduleListResponse": {"properties": {- "parameter_type": {- "type": "string",- "const": "onepassword",- "title": "Parameter Type",- "default": "onepassword"- },- "key": {- "type": "string",- "title": "Key"+ "schedules": {+ "items": {+ "$ref": "#/components/schemas/OrganizationScheduleItem"+ },+ "type": "array",+ "title": "Schedules"},- "description": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Description"+ "total_count": {+ "type": "integer",+ "title": "Total Count"},- "vault_id": {- "type": "string",- "title": "Vault Id"+ "page": {+ "type": "integer",+ "title": "Page"},- "item_id": {- "type": "string",- "title": "Item Id"+ "page_size": {+ "type": "integer",+ "title": "Page Size"}},"type": "object","required": [- "key",- "vault_id",- "item_id"+ "schedules",+ "total_count",+ "page",+ "page_size"],- "title": "OnePasswordCredentialParameterYAML"+ "title": "OrganizationScheduleListResponse"},"OutputParameter": {"properties": {@@ -14913,8 +15652,8 @@},"engine": {"$ref": "#/components/schemas/RunEngine",- "description": "\nThe engine that powers the agent task. The default value is `skyvern-2.0`, the latest Skyvern agent that performs pretty well with complex and multi-step tasks. `skyvern-1.0` is good for simple tasks like filling a form, or searching for information on Google. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.\n",- "default": "skyvern-2.0"+ "description": "\nThe engine that powers the agent task. The default value is `skyvern-1.0`, which is good for simple tasks like filling a form, or searching for information on Google. `skyvern-2.0` is the latest Skyvern agent that performs well with complex and multi-step tasks. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.\n",+ "default": "skyvern-1.0"},"title": {"anyOf": [@@ -19896,6 +20635,206 @@"title": "WorkflowRunTriggerType","description": "How a workflow run was initiated.\n\n- manual: User clicked \"Run\" in the UI\n- api: Direct API call to the run endpoint\n- scheduled: Triggered by a cron schedule\n- webhook: Triggered by an external system via the webhook endpoint"},+ "WorkflowSchedule": {+ "properties": {+ "workflow_schedule_id": {+ "type": "string",+ "title": "Workflow Schedule Id"+ },+ "organization_id": {+ "type": "string",+ "title": "Organization Id"+ },+ "workflow_permanent_id": {+ "type": "string",+ "title": "Workflow Permanent Id"+ },+ "cron_expression": {+ "type": "string",+ "title": "Cron Expression"+ },+ "timezone": {+ "type": "string",+ "title": "Timezone"+ },+ "enabled": {+ "type": "boolean",+ "title": "Enabled"+ },+ "parameters": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Parameters"+ },+ "temporal_schedule_id": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Temporal Schedule Id"+ },+ "name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Name"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ },+ "created_at": {+ "type": "string",+ "format": "date-time",+ "title": "Created At"+ },+ "modified_at": {+ "type": "string",+ "format": "date-time",+ "title": "Modified At"+ },+ "deleted_at": {+ "anyOf": [+ {+ "type": "string",+ "format": "date-time"+ },+ {+ "type": "null"+ }+ ],+ "title": "Deleted At"+ }+ },+ "type": "object",+ "required": [+ "workflow_schedule_id",+ "organization_id",+ "workflow_permanent_id",+ "cron_expression",+ "timezone",+ "enabled",+ "created_at",+ "modified_at"+ ],+ "title": "WorkflowSchedule"+ },+ "WorkflowScheduleListResponse": {+ "properties": {+ "schedules": {+ "items": {+ "$ref": "#/components/schemas/WorkflowSchedule"+ },+ "type": "array",+ "title": "Schedules"+ }+ },+ "type": "object",+ "required": [+ "schedules"+ ],+ "title": "WorkflowScheduleListResponse"+ },+ "WorkflowScheduleResponse": {+ "properties": {+ "schedule": {+ "$ref": "#/components/schemas/WorkflowSchedule"+ },+ "next_runs": {+ "items": {+ "type": "string",+ "format": "date-time"+ },+ "type": "array",+ "title": "Next Runs"+ }+ },+ "type": "object",+ "required": [+ "schedule"+ ],+ "title": "WorkflowScheduleResponse"+ },+ "WorkflowScheduleUpsertRequest": {+ "properties": {+ "cron_expression": {+ "type": "string",+ "title": "Cron Expression"+ },+ "timezone": {+ "type": "string",+ "title": "Timezone"+ },+ "enabled": {+ "type": "boolean",+ "title": "Enabled",+ "default": true+ },+ "parameters": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Parameters"+ },+ "name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Name"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description"+ }+ },+ "type": "object",+ "required": [+ "cron_expression",+ "timezone"+ ],+ "title": "WorkflowScheduleUpsertRequest"+ },"WorkflowStatus": {"type": "string","enum": [diff --git a/skyvern/cli/mcp_tools/workflow.py b/skyvern/cli/mcp_tools/workflow.pyindex c4977a287..18fec0fa7 100644--- a/skyvern/cli/mcp_tools/workflow.py+++ b/skyvern/cli/mcp_tools/workflow.py@@ -19,7 +19,7 @@ from pydantic import Fieldfrom skyvern.client.errors import BadRequestError, NotFoundErrorfrom skyvern.client.types import WorkflowCreateYamlRequest-from skyvern.forge.sdk.workflow.models.parameter import ParameterType+from skyvern.forge.sdk.workflow.models.parameter import ParameterType, WorkflowParameterTypefrom skyvern.schemas.runs import ProxyLocationfrom skyvern.schemas.workflows import WorkflowCreateYAMLRequest as WorkflowCreateYAMLRequestSchema@@ -607,9 +607,13 @@ async def _inject_workflow_update_proxy_default(definition: str, fmt: str, workf# Parameter types that are auto-managed (credentials and secrets set via the UI) and should# always be preserved from the existing workflow during MCP updates, regardless of what the-# caller sends. These should NEVER be modifiable via MCP — only via the UI credential picker.+# caller sends. These should NEVER be modifiable via MCP — only via the UI credential picker.# Derived from the enum to stay in sync when new secret types are added._AUTO_MANAGED_PARAMETER_TYPES = frozenset(pt.value for pt in ParameterType if pt.is_secret_or_credential())+_PROTECTED_WORKFLOW_PARAMETER_TYPES = frozenset(pt.value for pt in WorkflowParameterType if pt.is_credential_type())+# Login-capable credential types — subset of protected params that carry username/password data.+# Derived from the enum to stay in sync when new login-capable types are added.+_LOGIN_CREDENTIAL_PARAMETER_TYPES = frozenset(pt.value for pt in ParameterType if pt.is_login_credential())# Runtime-only fields returned by GET /api/v1/workflows/{id} that must be stripped before# re-injecting parameters into a YAML/JSON definition. Uses a suffix-based deny-list so@@ -629,6 +633,43 @@ def _strip_runtime_fields(param: dict[str, Any]) -> dict[str, Any]:}+def _is_protected_update_parameter(param: Any) -> bool:+ """Return True when *param* should be preserved from the existing workflow.++ This includes:+ - Secret/credential parameter types managed directly by the UI.+ - Workflow input parameters whose type is `credential_id`, where the+ selected credential lives in `default_value`.+ """+ if not isinstance(param, dict):+ return False++ key = param.get("key")+ parameter_type = param.get("parameter_type")+ if not key or not parameter_type:+ return False+ if parameter_type in _AUTO_MANAGED_PARAMETER_TYPES:+ return True+ return (+ parameter_type == ParameterType.WORKFLOW.value+ and param.get("workflow_parameter_type") in _PROTECTED_WORKFLOW_PARAMETER_TYPES+ )+++def _is_login_credential_reference(param: dict[str, Any]) -> bool:+ """Return True when *param* represents a credential reference usable by login blocks."""++ parameter_type = param.get("parameter_type")+ if not parameter_type:+ return False+ if parameter_type in _LOGIN_CREDENTIAL_PARAMETER_TYPES:+ return True+ return (+ parameter_type == ParameterType.WORKFLOW.value+ and param.get("workflow_parameter_type") in _PROTECTED_WORKFLOW_PARAMETER_TYPES+ )++def _iter_blocks_flat(blocks: list[dict[str, Any]]) -> list[dict[str, Any]]:"""Return all block dicts from a block list, recursing into for_loop nested blocks."""result: list[dict[str, Any]] = []@@ -643,11 +684,11 @@ def _iter_blocks_flat(blocks: list[dict[str, Any]]) -> list[dict[str, Any]]:async def _inject_workflow_update_parameters(definition: str, fmt: str, workflow_id: str) -> str:- """Preserve auto-managed parameters (credentials/secrets) during MCP workflow updates.+ """Preserve protected credential/secret parameters during MCP workflow updates.- Credential parameters should NEVER be modifiable via MCP — the existing workflow's- values always win. This function:- 1. Always replaces auto-managed parameters with the existing workflow's versions+ Credential references should NEVER be modifiable via MCP — the existing workflow's+ values always win. This function:+ 1. Always replaces protected parameters with the existing workflow's versions(even if the caller includes them — they may have stale/wrong data).2. Injects credential parameter_keys into blocks using type-based matching(login blocks always get ALL credential keys) with label-based fallback@@ -673,28 +714,25 @@ async def _inject_workflow_update_parameters(definition: str, fmt: str, workflowmodified = False- # --- Step 1: Always replace auto-managed parameters with existing values ---- # Credential/secret parameters should NEVER be modifiable via MCP — the existing- # workflow's values always win, even if the caller includes them with different data.- # This means callers cannot swap credential references or remove credential params- # via MCP; those operations must go through the UI credential picker.- auto_managed_keys: set[str] = set()+ # --- Step 1: Always replace protected parameters with existing values ---+ # Credential/secret parameters — including workflow inputs of type credential_id —+ # should NEVER be modifiable via MCP. The existing workflow's values always win,+ # even if the caller includes them with different data. This means callers cannot+ # swap credential references or remove credential params via MCP; those operations+ # must go through the UI credential picker.+ protected_keys: set[str] = set()for param in existing_params:- if not isinstance(param, dict):- continue- if param.get("parameter_type") in _AUTO_MANAGED_PARAMETER_TYPES and param.get("key"):- auto_managed_keys.add(param["key"])+ if _is_protected_update_parameter(param):+ protected_keys.add(param["key"])- if auto_managed_keys:- # Remove any auto-managed params the caller may have included (may have stale data)- update_params = [p for p in update_params if not (isinstance(p, dict) and p.get("key") in auto_managed_keys)]- # Inject all auto-managed params from the existing workflow, stripping runtime-only+ if protected_keys:+ # Remove any protected params the caller may have included (may have stale data)+ update_params = [p for p in update_params if not (isinstance(p, dict) and p.get("key") in protected_keys)]+ # Inject all protected params from the existing workflow, stripping runtime-only# fields that come from the GET API response (e.g. *_parameter_id, workflow_id,# created_at, modified_at, deleted_at) to keep the definition YAML-clean.for param in existing_params:- if not isinstance(param, dict):- continue- if param.get("parameter_type") in _AUTO_MANAGED_PARAMETER_TYPES and param.get("key"):+ if _is_protected_update_parameter(param):update_params.append(_strip_runtime_fields(param))modified = Truewf_def["parameters"] = update_params@@ -707,11 +745,11 @@ async def _inject_workflow_update_parameters(definition: str, fmt: str, workflow# credential injection; non-login secret refs are rare and still work when labels match.all_cred_keys: set[str] = set()login_cred_keys: set[str] = set()- for p in existing_params:- if isinstance(p, dict) and p.get("parameter_type") in _AUTO_MANAGED_PARAMETER_TYPES and p.get("key"):- all_cred_keys.add(p["key"])- if p.get("parameter_type") == "credential":- login_cred_keys.add(p["key"])+ for param in existing_params:+ if _is_protected_update_parameter(param):+ all_cred_keys.add(param["key"])+ if _is_login_credential_reference(param):+ login_cred_keys.add(param["key"])if all_cred_keys:existing_blocks: list[dict[str, Any]] = existing_wf_def.get("blocks", [])diff --git a/skyvern/forge/sdk/workflow/models/parameter.py b/skyvern/forge/sdk/workflow/models/parameter.pyindex e12e650ab..8bac9d821 100644--- a/skyvern/forge/sdk/workflow/models/parameter.py+++ b/skyvern/forge/sdk/workflow/models/parameter.py@@ -47,6 +47,15 @@ class ParameterType(StrEnum):ParameterType.AZURE_SECRET,]+ def is_login_credential(self) -> bool:+ """Return True for credential types that carry login (username/password) data."""+ return self in [+ ParameterType.CREDENTIAL,+ ParameterType.ONEPASSWORD,+ ParameterType.AZURE_VAULT_CREDENTIAL,+ ParameterType.BITWARDEN_LOGIN_CREDENTIAL,+ ]+class Parameter(BaseModel, abc.ABC):# TODO (kerem): Should we also have organization_id here?diff --git a/tests/unit/test_mcp_workflow_tools.py b/tests/unit/test_mcp_workflow_tools.pyindex d1aa3d856..c34eacd81 100644--- a/tests/unit/test_mcp_workflow_tools.py+++ b/tests/unit/test_mcp_workflow_tools.py@@ -1613,3 +1613,415 @@ async def test_workflow_update_strips_runtime_fields_from_credential_params(assert "created_at" not in cred_dictassert "modified_at" not in cred_dictassert "deleted_at" not in cred_dict+++async def test_workflow_update_preserves_workflow_credential_id_params_and_injects_login_keys(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Workflow parameters with `credential_id` type should be preserved like direct credential params."""++ fake_client = SimpleNamespace(update_workflow=AsyncMock(return_value=_fake_workflow_response()))+ monkeypatch.setattr(workflow_tools, "get_skyvern", lambda: fake_client)++ async def fake_get_workflow_by_id(workflow_id: str, version: int | None = None) -> dict[str, object]:+ return {+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "workflow",+ "key": "my_creds",+ "workflow_parameter_type": "credential_id",+ "default_value": "cred_abc123",+ "workflow_parameter_id": "wp_runtime_123",+ "workflow_id": "wpid_runtime_456",+ "created_at": "2025-01-01T00:00:00Z",+ "modified_at": "2025-06-15T12:00:00Z",+ "deleted_at": None,+ },+ {+ "parameter_type": "workflow",+ "key": "url_input",+ "workflow_parameter_type": "string",+ "default_value": "https://example.com",+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "login_block",+ "parameter_keys": ["my_creds"],+ }+ ],+ },+ }++ monkeypatch.setattr(workflow_tools, "_get_workflow_by_id", fake_get_workflow_by_id)++ definition = {+ "title": "Updated workflow",+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "workflow",+ "key": "url_input",+ "workflow_parameter_type": "string",+ "default_value": "https://new-url.com",+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "login",+ "parameter_keys": [],+ "navigation_goal": "Login to the site",+ }+ ],+ },+ }++ result = await workflow_tools.skyvern_workflow_update(+ workflow_id="wpid_test",+ definition=json.dumps(definition),+ format="json",+ )++ assert result["ok"] is True++ sent_def = fake_client.update_workflow.await_args.kwargs["json_definition"]+ params = sent_def.workflow_definition.parameters+ workflow_cred_params = [+ p+ for p in params+ if getattr(p, "parameter_type", None) == "workflow"+ and str(getattr(p, "workflow_parameter_type", None)) == "credential_id"+ ]+ assert len(workflow_cred_params) == 1++ workflow_cred = workflow_cred_params[0]+ assert getattr(workflow_cred, "key", None) == "my_creds"+ assert getattr(workflow_cred, "default_value", None) == "cred_abc123"++ workflow_cred_dict = workflow_cred.dict() if hasattr(workflow_cred, "dict") else workflow_cred.__dict__+ assert "workflow_parameter_id" not in workflow_cred_dict+ assert "workflow_id" not in workflow_cred_dict+ assert "created_at" not in workflow_cred_dict+ assert "modified_at" not in workflow_cred_dict+ assert "deleted_at" not in workflow_cred_dict++ workflow_params = [p for p in params if getattr(p, "parameter_type", None) == "workflow"]+ url_param = next(p for p in workflow_params if getattr(p, "key", None) == "url_input")+ assert getattr(url_param, "default_value", None) == "https://new-url.com"++ blocks = sent_def.workflow_definition.blocks+ login_block = next(b for b in blocks if getattr(b, "block_type", None) == "login")+ pkeys = getattr(login_block, "parameter_keys", [])+ assert "my_creds" in pkeys+++async def test_workflow_update_always_replaces_wrong_workflow_credential_id_default(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Credential-id workflow params should keep the existing default credential on MCP updates."""++ fake_client = SimpleNamespace(update_workflow=AsyncMock(return_value=_fake_workflow_response()))+ monkeypatch.setattr(workflow_tools, "get_skyvern", lambda: fake_client)++ async def fake_get_workflow_by_id(workflow_id: str, version: int | None = None) -> dict[str, object]:+ return {+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "workflow",+ "key": "my_creds",+ "workflow_parameter_type": "credential_id",+ "default_value": "cred_CORRECT",+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "login_block",+ "parameter_keys": ["my_creds"],+ }+ ],+ },+ }++ monkeypatch.setattr(workflow_tools, "_get_workflow_by_id", fake_get_workflow_by_id)++ definition = {+ "title": "Updated workflow",+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "workflow",+ "key": "my_creds",+ "workflow_parameter_type": "credential_id",+ "default_value": "cred_WRONG_STALE",+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "login_block",+ "parameter_keys": ["my_creds"],+ "navigation_goal": "Login",+ }+ ],+ },+ }++ result = await workflow_tools.skyvern_workflow_update(+ workflow_id="wpid_test",+ definition=json.dumps(definition),+ format="json",+ )++ assert result["ok"] is True++ sent_def = fake_client.update_workflow.await_args.kwargs["json_definition"]+ params = sent_def.workflow_definition.parameters+ workflow_cred_params = [+ p+ for p in params+ if getattr(p, "parameter_type", None) == "workflow"+ and str(getattr(p, "workflow_parameter_type", None)) == "credential_id"+ ]+ assert len(workflow_cred_params) == 1+ assert getattr(workflow_cred_params[0], "default_value", None) == "cred_CORRECT"+++async def test_workflow_update_injects_onepassword_key_into_login_block_parameter_keys(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Login blocks should keep external credential keys like onepassword after MCP edits."""++ fake_client = SimpleNamespace(update_workflow=AsyncMock(return_value=_fake_workflow_response()))+ monkeypatch.setattr(workflow_tools, "get_skyvern", lambda: fake_client)++ async def fake_get_workflow_by_id(workflow_id: str, version: int | None = None) -> dict[str, object]:+ return {+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "onepassword",+ "key": "site_login_cred",+ "vault_id": "vault_123",+ "item_id": "item_456",+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "Login_cont",+ "parameter_keys": ["site_login_cred"],+ "navigation_goal": "Login",+ }+ ],+ },+ }++ monkeypatch.setattr(workflow_tools, "_get_workflow_by_id", fake_get_workflow_by_id)++ definition = {+ "title": "Updated workflow",+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [],+ "blocks": [+ {+ "block_type": "login",+ "label": "Login_cont_renamed",+ "parameter_keys": [],+ "navigation_goal": "Log in to the site",+ }+ ],+ },+ }++ result = await workflow_tools.skyvern_workflow_update(+ workflow_id="wpid_test",+ definition=json.dumps(definition),+ format="json",+ )++ assert result["ok"] is True++ sent_def = fake_client.update_workflow.await_args.kwargs["json_definition"]++ params = sent_def.workflow_definition.parameters+ onepassword_params = [p for p in params if getattr(p, "parameter_type", None) == "onepassword"]+ assert len(onepassword_params) == 1+ assert getattr(onepassword_params[0], "key", None) == "site_login_cred"+ assert getattr(onepassword_params[0], "vault_id", None) == "vault_123"+ assert getattr(onepassword_params[0], "item_id", None) == "item_456"++ blocks = sent_def.workflow_definition.blocks+ login_block = next(b for b in blocks if getattr(b, "block_type", None) == "login")+ pkeys = getattr(login_block, "parameter_keys", [])+ assert "site_login_cred" in pkeys+++async def test_workflow_update_injects_bitwarden_login_key_into_login_block_parameter_keys(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Login blocks should keep bitwarden_login_credential keys after MCP edits."""++ fake_client = SimpleNamespace(update_workflow=AsyncMock(return_value=_fake_workflow_response()))+ monkeypatch.setattr(workflow_tools, "get_skyvern", lambda: fake_client)++ async def fake_get_workflow_by_id(workflow_id: str, version: int | None = None) -> dict[str, object]:+ return {+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "bitwarden_login_credential",+ "key": "portal_login",+ "bitwarden_login_credential_parameter_id": "blc_fake",+ "workflow_id": "w_fake",+ "bitwarden_client_id_aws_secret_key": "bw_client",+ "bitwarden_client_secret_aws_secret_key": "bw_secret",+ "bitwarden_master_password_aws_secret_key": "bw_master",+ "bitwarden_collection_id": "col_123",+ "url_filter": "https://portal.example.com",+ "created_at": "2026-01-01T00:00:00Z",+ "modified_at": "2026-01-01T00:00:00Z",+ "deleted_at": None,+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "Portal_Login",+ "parameter_keys": ["portal_login"],+ "navigation_goal": "Log in to the portal",+ }+ ],+ },+ }++ monkeypatch.setattr(workflow_tools, "_get_workflow_by_id", fake_get_workflow_by_id)++ definition = {+ "title": "Updated workflow",+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [],+ "blocks": [+ {+ "block_type": "login",+ "label": "Portal_Login_Renamed",+ "parameter_keys": [],+ "navigation_goal": "Log in to the portal - updated",+ }+ ],+ },+ }++ result = await workflow_tools.skyvern_workflow_update(+ workflow_id="wpid_test",+ definition=json.dumps(definition),+ format="json",+ )++ assert result["ok"] is True++ sent_def = fake_client.update_workflow.await_args.kwargs["json_definition"]++ params = sent_def.workflow_definition.parameters+ bw_params = [p for p in params if getattr(p, "parameter_type", None) == "bitwarden_login_credential"]+ assert len(bw_params) == 1+ assert getattr(bw_params[0], "key", None) == "portal_login"++ blocks = sent_def.workflow_definition.blocks+ login_block = next(b for b in blocks if getattr(b, "block_type", None) == "login")+ pkeys = getattr(login_block, "parameter_keys", [])+ assert "portal_login" in pkeys+++async def test_workflow_update_injects_azure_vault_key_into_login_block_parameter_keys(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Login blocks should keep azure_vault_credential keys after MCP edits."""++ fake_client = SimpleNamespace(update_workflow=AsyncMock(return_value=_fake_workflow_response()))+ monkeypatch.setattr(workflow_tools, "get_skyvern", lambda: fake_client)++ async def fake_get_workflow_by_id(workflow_id: str, version: int | None = None) -> dict[str, object]:+ return {+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [+ {+ "parameter_type": "azure_vault_credential",+ "key": "azure_creds",+ "azure_vault_credential_parameter_id": "avc_fake",+ "workflow_id": "w_fake",+ "vault_name": "my-vault",+ "username_key": "portal-user",+ "password_key": "portal-pass",+ "totp_secret_key": None,+ "created_at": "2026-01-01T00:00:00Z",+ "modified_at": "2026-01-01T00:00:00Z",+ "deleted_at": None,+ },+ ],+ "blocks": [+ {+ "block_type": "login",+ "label": "Azure_Login",+ "parameter_keys": ["azure_creds"],+ "navigation_goal": "Log in with Azure credentials",+ }+ ],+ },+ }++ monkeypatch.setattr(workflow_tools, "_get_workflow_by_id", fake_get_workflow_by_id)++ definition = {+ "title": "Updated workflow",+ "proxy_location": "RESIDENTIAL",+ "workflow_definition": {+ "parameters": [],+ "blocks": [+ {+ "block_type": "login",+ "label": "Azure_Login_Renamed",+ "parameter_keys": [],+ "navigation_goal": "Log in - updated",+ }+ ],+ },+ }++ result = await workflow_tools.skyvern_workflow_update(+ workflow_id="wpid_test",+ definition=json.dumps(definition),+ format="json",+ )++ assert result["ok"] is True++ sent_def = fake_client.update_workflow.await_args.kwargs["json_definition"]++ params = sent_def.workflow_definition.parameters+ az_params = [p for p in params if getattr(p, "parameter_type", None) == "azure_vault_credential"]+ assert len(az_params) == 1+ assert getattr(az_params[0], "key", None) == "azure_creds"++ blocks = sent_def.workflow_definition.blocks+ login_block = next(b for b in blocks if getattr(b, "block_type", None) == "login")+ pkeys = getattr(login_block, "parameter_keys", [])+ assert "azure_creds" in pkeys