Skip to content

improvement(workflow-mcp): single-source MCP tool params, deploy status, chip styling#5029

Open
waleedlatif1 wants to merge 7 commits into
stagingfrom
worktree-mcp-deploy-ux
Open

improvement(workflow-mcp): single-source MCP tool params, deploy status, chip styling#5029
waleedlatif1 wants to merge 7 commits into
stagingfrom
worktree-mcp-deploy-ux

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Make the start block's input format the single source of truth for MCP tool parameter descriptions — the deploy modal now writes them back collaboratively, so they persist with the workflow and survive redeploys (fixes descriptions getting wiped on workflow edits)
  • Derive the tool parameter schema from the deployed workflow rather than the draft, so a saved tool can never advertise params the running workflow doesn't have
  • Add a Live / Update deployment status badge to the MCP tab, mirroring the A2A tab, so drift between the tool and the deployed workflow is visible and actionable
  • Swap the legacy Textarea for ChipTextarea on the tool Description (it predated ChipTextarea and was never migrated)
  • Extract the duplicated isDefaultDescription helper (copy-pasted across the MCP, A2A, and API-info surfaces) into one shared util

Context

The MCP tab had three competing sources of truth for parameter descriptions (start block, a private modal overlay, and the saved tool schema) that silently overwrote each other. The result: descriptions wiped on every redeploy, and a "Save Tool" that could push a param set different from what the deployed workflow actually runs. This collapses everything to one rule: the MCP tool always mirrors the deployed workflow.

Type of Change

  • Bug fix
  • Improvement

Testing

Tested manually; typecheck, lint, and `check:api-validation` pass.

Follow-up (not in this PR)

  • The copilot `deploy_mcp` tool still sets parameter descriptions directly on the tool rather than on the start block, so copilot-set descriptions could still be regenerated on redeploy. Aligning it is a separate change on a different surface.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…us, chip styling

- Make the start block input format the single source of truth for MCP tool
  parameter descriptions; the deploy modal writes them back collaboratively so
  they persist with the workflow and survive redeploys (fixes descriptions
  getting wiped on workflow edits)
- Derive the tool parameter schema from the deployed workflow instead of the
  draft, so a saved tool can never advertise params the running workflow lacks
- Add a Live / Update deployment status badge to the MCP tab, mirroring A2A
- Swap the legacy Textarea for ChipTextarea on the tool Description
- Extract the duplicated isDefaultDescription helper into one shared util
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 13, 2026 8:55pm

Request Review

@cursor

cursor Bot commented Jun 13, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
MCP save and copilot deploy paths now mutate draft workflow input format and rely on redeploy for schema sync; collaborative edits affect shared editor state but behavior is covered by new tests for the copilot path.

Overview
MCP deploy now treats the start block input format as the source of truth for parameter descriptions: edits write through collaboratively to that subblock, Save Tool no longer pushes a client-built parameterSchema (only name/description/server membership), and legacy descriptions from an existing tool schema are shown until the start block has values. The MCP tab footer gains Live / Update deployment badges (like A2A) when the workflow is exposed on a server.

Shared isDefaultDescription replaces duplicated placeholder-description checks in MCP, A2A, and API info modals. Tool description uses ChipTextarea instead of Textarea.

Copilot deploy_mcp persists parameterDescriptions onto the draft start block (load → save → socket notify), with new Vitest coverage. notifyWorkflowUpdated is extracted to lib/workflows/notify-socket and reused from copilot workflow mutations and edit-workflow.

Reviewed by Cursor Bugbot for commit a425646. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR collapses three competing sources of truth for MCP tool parameter descriptions into one: the start block's inputFormat subblock. The deploy modal now writes descriptions back to the start block collaboratively on every keystroke, the copilot deploy_mcp handler persists them server-side before schema generation, and the tool schema is derived from the deployed workflow rather than the draft.

  • Single-source descriptions: parameterDescriptions state removed from McpDeploy; replaced by real-time collaborativeSetSubblockValue writes via a new updateFieldDescription callback; legacyParameterDescriptions provides a one-time display fallback for tools saved before the migration.
  • Shared utilities: isDefaultDescription (previously copy-pasted across MCP, A2A, and API-info surfaces) extracted to deploy-modal/lib/default-description.ts; notifyWorkflowUpdated (previously inlined in three server-side handlers) extracted to lib/workflows/notify-socket.ts.
  • Live/Update-deployment badge: McpDeploy now reports onExposedChange to the parent modal, which shows a Live / Update deployment status chip in the MCP tab footer, mirroring the existing A2A tab behaviour.

Confidence Score: 5/5

Safe to merge — changes are well-scoped DRY refactors with a clearly established server-side mutation pattern and targeted test coverage for the new description-persistence path.

The server-side persistParameterDescriptionsToStartBlock follows the same load→mutate→save→notify pattern already used by edit-workflow and other copilot handlers, and its WorkflowState construction correctly includes all required fields (TypeScript confirmed at compile time). The collaborative UI path is a straightforward swap from local state to subblock-store writes, guarded by the same pickRawInputFormat fallback logic that was already reviewed and fixed in the previous round. No new required-field types, DB schema changes, or auth boundaries are touched.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/lib/default-description.ts New shared utility extracting the isDefaultDescription predicate, now also trimming workflowName before comparing (minor but correct improvement over the per-file originals)
apps/sim/lib/workflows/notify-socket.ts New shared utility consolidating the notifyWorkflowUpdated fire-and-forget fetch; removes three identical copies from mutations.ts, edit-workflow/index.ts, and deploy.ts
apps/sim/lib/copilot/tools/handlers/deployment/deploy.ts Adds persistParameterDescriptionsToStartBlock to write copilot-supplied descriptions onto the draft start block before creating/updating the tool; follows the established load→mutate→save→notify pattern; correctly no-ops when nothing changes
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/mcp/mcp.tsx Major rework: removes parameterDescriptions state, replaces with real-time collaborative writes via updateFieldDescription + legacyParameterDescriptions fallback for pre-migration tools; swaps Textarea→ChipTextarea; adds onExposedChange reporting
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx Adds mcpToolExposed state wired to McpDeploy.onExposedChange; shows Live/Update-deployment badge in MCP tab footer when the workflow is exposed on at least one server
apps/sim/lib/copilot/tools/handlers/deployment/deploy.test.ts New test file covering persistParameterDescriptionsToStartBlock: persists when descriptions change, no-ops when already matching, no-ops when field doesn't exist, and skips load/save when no descriptions supplied

Sequence Diagram

sequenceDiagram
    participant UI as MCP Deploy Panel
    participant CH as collaborativeSetSubblockValue
    participant RT as Realtime Socket
    participant DB as Normalized Tables (DB)
    participant CP as Copilot deploy_mcp handler

    Note over UI,RT: UI path — description edited in panel
    UI->>CH: updateFieldDescription(fieldName, value)
    CH->>RT: broadcast inputFormat update
    RT-->>DB: persist subblock value

    Note over CP,DB: Copilot path — deploy_mcp tool call
    CP->>DB: getDeployedWorkflowInputFormat(workflowId)
    DB-->>CP: deployed input fields
    CP->>DB: loadWorkflowFromNormalizedTables(workflowId)
    DB-->>CP: draft WorkflowState
    CP->>CP: map descriptions onto start block fields
    CP->>DB: saveWorkflowToNormalizedTables(workflowId, nextState)
    CP->>RT: notifyWorkflowUpdated(workflowId)
    CP->>CP: generateParameterSchema(inputFormat, descriptions)
    CP->>DB: performCreateWorkflowMcpTool / performUpdateWorkflowMcpTool
Loading

Reviews (7): Last reviewed commit: "fix(workflow-mcp): surface legacy tool p..." | Re-trigger Greptile

…aram descriptions

updateFieldDescription read only from the subblock store, but the display memo
falls back to the block's persisted inputFormat when the store entry is empty.
For workflows whose fields are hydrated from block defaults, editing a
description would have written [] and wiped every input field. Extract a shared
resolveInputFormatFields helper used by both the memo and the writer, and guard
against ever persisting an empty list.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fdc2679. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 17f6a0a. Configure here.

… descriptions

Map over the raw input-format array instead of the normalized one so editing a
parameter description no longer drops unnamed/in-progress fields from the start
block.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 34312fd. Configure here.

…le on the start block

Align the copilot deploy_mcp tool with the UI's single-source model: per-parameter
descriptions are now persisted onto the workflow's draft start block input format
(their durable home) so a later redeploy regenerates the tool schema from them
instead of wiping them. The tool schema is still set directly so descriptions take
effect immediately without a redeploy; both paths converge on the next deploy.

Also consolidate the duplicated socket-notify into a shared notifyWorkflowUpdated
helper used by the deploy handler, the workflow mutation handlers, and edit-workflow.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c44cddf. Configure here.

Adds deploy.test.ts (the handler previously had no test) covering: descriptions
written to the draft start block + socket notify, no-op when none supplied, no-op
when unchanged, and ignoring descriptions for fields absent from the start block.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

…y fallback

Tools saved before descriptions moved to the start block store them only on the
tool schema. Show those as a fallback when the start block field has none, so they
stay visible; editing one writes through to the start block (migrating it durably).
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a425646. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant