AI tools consolidated from 60+ to 10 families
The instance AI agent now operates with a leaner tool surface — 60+ individual tools condensed into 10 action families. The change cuts schema token overhead and improves tool selection accuracy for the LLM orchestrator.
The AI builder was drowning in tools. Sixty-plus individual tool files sat in the codebase, each handling one operation: list-workflows, get-workflow, delete-workflow, publish-workflow, and so on. When the orchestrator agent made decisions, it faced a menu of roughly 45 tools per turn — too much surface area for reliable selection, and a heavy payload of schema tokens sent to the model with every request.
A refactor consolidates these tools into 10 family tools. Instead of separate tools, related operations live together: a single workflows tool handles list, get, publish, unpublish, version management, and more; executions covers run, debug, stop, and inspection; credentials manages the full lifecycle. The pattern uses Zod discriminated unions on an action field — when the agent calls the tool, a switch routes to the right handler. Surface-aware factories (createAllTools, createOrchestratorDomainTools) control which actions are available per agent role: the builder gets full access, the orchestrator gets a restricted subset.
The payoff is concrete: fewer tokens sent to the model, fewer decisions the model must make, and a simpler mental model for the agents. The LLM orchestrator now chooses from ~10 tools instead of ~45. Schema token overhead drops. Meanwhile, 57 individual tool files and their associated dead code (including the unused and InstanceAiFilesystemService interface) are removed, netting roughly 1,500 lines deleted across 91 files.
The frontend updates to match: tool labels, result rendering, canvas preview, and resource extraction all learned to resolve family + action pairs instead of flat tool names. Playwright test fixtures were updated to reflect the new tool call shapes. A bug was also fixed — the templates tool was missing from createOrchestratorDomainTools(), leaving the orchestrator unable to look up workflow patterns during planning.
View Original GitHub Description
Summary
Consolidates 60+ individual AI tools into 10 family tools using a discriminated union on the action field. Instead of each operation living in its own tool (list-workflows, get-workflow, delete-workflow, …), related operations are grouped into a single tool that routes by action.
Why: The LLM orchestrator was choosing from ~45 tools per turn. Fewer, well-scoped tools improve selection accuracy and cut schema token overhead.
Tool families
| Family tool | Example actions | Notes |
|---|---|---|
workflows | list, get, setup, publish, restore-version, … | Builder gets all actions; orchestrator excludes get-as-code |
executions | list, get, run, debug, stop | — |
credentials | list, get, delete, setup, test | — |
data-tables | list, schema, query, create, insert-rows, … | Orchestrator gets read-only subset |
workspace | list-projects, list-tags, create-folder, … | — |
research | web-search, fetch-url | Replaces standalone web-research tools |
nodes | list, search, describe, type-definition, … | Orchestrator gets explore-resources only |
templates | search-structures, search-parameters, best-practices | All agents (orchestrator + builder) |
task-control | update-checklist, cancel-task, correct-task | Orchestrator only |
What changed
- Backend — 10 new family tool files replace 57 individual tool files. Each uses
z.discriminatedUnionfor input validation. Surface-aware factories (createAllTools,createOrchestratorDomainTools) control which actions are available per agent role. Orchestration tool prompts updated to reference the new names. - Frontend — Icon mapping, tool labels, result rendering, canvas preview, resource extraction, render hints, and i18n all updated to resolve family + action pairs.
- Tests — 198 new tests covering all 10 family tools; old per-tool test files removed.
- Dead code cleanup — Removed
filesystem.tool.ts, its tests, and theInstanceAiFilesystemServiceinterface + associated types (FileEntry,FileContent,FileSearchMatch,FileSearchResult). These became unreachable afterLocalFilesystemProviderwas removed — the only live filesystem path now goes through the gateway MCP server viacreateToolsFromLocalMcpServer(). Also removed thefilesystemServicefield fromInstanceAiContextand the fallback branches in bothcreateAllToolsandcreateOrchestratorDomainTools. - Bug fix — Added
templatestool tocreateOrchestratorDomainTools(). It was only given to sub-agents/builders, preventing the orchestrator from looking up workflow patterns and best practices during planning.
Net: ~1500 lines removed across 91 files.
Review / Merge checklist
- PR title and summary are descriptive. (conventions)
- Docs updated or follow-up ticket created.
- Tests included.
- PR Labeled with
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported) - I have seen this code, I have run this code, and I take responsibility for this code.