refactor(web): migrate self builtin-tool calls to the typed studio-tools client#3933
Open
viktormarinho wants to merge 1 commit into
Open
refactor(web): migrate self builtin-tool calls to the typed studio-tools client#3933viktormarinho wants to merge 1 commit into
viktormarinho wants to merge 1 commit into
Conversation
…ols client
Convert 34 web hooks/components from the in-browser MCP self-client
(client.callTool({name, arguments}) + manual envelope unwrap) to the typed
studio.call(name, input) over REST. Behavior-preserving: same tool names,
arguments, React Query keys, optimistic updates and error handling — only the
transport call shape + the now-redundant structuredContent/isError unwrap
change. Net -674 lines.
Builds on the RestSelfClient backbone (#3932): self traffic already runs over
REST, so this adds compile-time type-safety (tool name + input/output inferred
from CORE_TOOLS schemas via ToolIO).
Left on RestSelfClient as a follow-up:
- generic mesh-sdk collection consumers whose React Query key is the client
instance (5 files skipped: github-repo-picker, import-from-deco-dialog,
tool-set-selector, add-connection-dialog, use-ai-providers).
- files whose tool output schema is looser than the UI's local types
(use-automations + automation-detail, use-monitor, ai-providers connect
dialogs, org-brand-context, sandbox-lifecycle) — need the tool output schemas
tightened before a clean typed migration.
Verified: bun run check (all workspaces), knip, lint, biome format. Adversarial
review of the diff (4 dimensions) clean after fixing one leftover unwrap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #3932 (the
RestSelfClientbackbone). Migrates 34 web hooks/components from the in-browser MCP self-client to the typedstudio-toolsclient:Behavior-preserving — same tool names, arguments, React Query keys, optimistic updates and error handling; only the transport-call shape + the now-redundant
structuredContent/isErrorenvelope unwrap change. Net −674 lines. Self traffic already ran over REST via the backbone; this adds compile-time type-safety (tool name + input/output inferred fromCORE_TOOLSviaToolIO).How it was done
A per-file migration (one agent per candidate, each only touching confirmed self calls) + a 4-dimension adversarial review of the diff. Then centrally verified.
Intentionally left for a follow-up (still on
RestSelfClient, working over REST)KEYS.collectionList(client, …)) — can't key on a typed call:github-repo-picker,import-from-deco-dialog,tool-set-selector,add-connection-dialog,use-ai-providers.use-automations(+automation-detail),use-monitor, ai-providers connect dialogs,org-brand-context,sandbox-lifecycle.Testing
bun run check(all workspaces),knip,lint, Biome format — all green.use-group-show-more).tools-rest.spec.tse2e; these call sites are behavior-preserving swaps over the same endpoint.🤖 Generated with Claude Code
Summary by cubic
Migrates self builtin-tool calls in the web app to the typed
studio-toolsclient over REST, replacinguseMCPClientcalls withuseStudioTools().call(...). Behavior is unchanged; adds compile-time typing and removes ~674 LOC.useStudioTools().call(name, input).structuredContent/isErrorenvelopes; standardized thrown-error handling while preserving tool names, args, React Query keys, and optimistic updates.RestSelfClientbackbone with I/O types inferred fromCORE_TOOLSviaToolIO. Follow-ups remain onRestSelfClientfor client-keyed collection consumers and files with looser tool output schemas (e.g.,use-automations,use-monitor, ai-provider connect dialogs,org-brand-context,sandbox-lifecycle).Written for commit f1644bb. Summary will update on new commits.