Tool & Workflow Builder
Relevant source files
The following files were used as context for generating this wiki page:
- packages/web/src/lib/agent/registries/tool-registry.ts
- packages/web/src/lib/agent/skills/content/tool-building.md
- packages/web/src/lib/agent/skills/content/tool-editing.md
- packages/web/src/lib/agent/skills/content/superglue-concepts.md
- packages/core/api/tools.test.ts
- packages/web/src/lib/agent/agent-context.ts
The Tool & Workflow Builder manages the creation, configuration, and modification of superglue tools. A tool is a deterministic multi-step workflow that connects APIs, databases, and file servers using ordered steps and JavaScript-based transformations. Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:3-5, packages/web/src/lib/agent/skills/content/tool-building.md:46-60
Core Tool Architecture
A tool consists of an identifier, high-level instructions, and a sequence of execution steps. The execution pipeline follows a deterministic path where results from previous steps are aggregated into sourceData for use in subsequent steps. Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:7-9, packages/web/src/lib/agent/skills/content/superglue-concepts.md:16-24
Tool Configuration Object
| Field | Type | Description |
|---|---|---|
id | string | Unique kebab-case identifier (e.g., stripe-list-orders). |
instruction | string | 1-2 sentence summary of the tool's purpose. |
steps | Array | Ordered list of request or transform operations. |
outputTransform | string | JavaScript function to shape the final result. |
inputSchema | object | JSON Schema for payload validation and UI generation. |
outputSchema | object | Optional JSON Schema to enforce final output shape. |
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:98-140, packages/web/src/lib/agent/skills/content/tool-building.md:46-60
Step Definitions
Steps are atomic operations categorized as either request or transform. Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:11-14
- Request Steps: Interact with external systems (HTTP, SQL, Redis, SFTP). They require a
systemIdto resolve credentials via<<systemId_credKey>>variables. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:113-117, packages/web/src/lib/agent/skills/content/tool-building.md:130-136 - Transform Steps: Execute isolated JavaScript to manipulate data between requests. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:144-147
Build Process Flow
The build process involves gathering system documentation, testing endpoints, and validating the final tool structure. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:3-10
This diagram represents the mandatory "Build Recipe" sequence required to ensure deterministic tool execution. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:3-10, packages/web/src/lib/agent/registries/tool-registry.ts:145-160
Data Handling and Templates
Tools use a template variable syntax << >> to inject dynamic data into step configurations. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:114-116
- Credential Variables: Accessed via
<<systemId_credentialKey>>(e.g.,<<stripe_api_key>>). Sources: packages/web/src/lib/agent/skills/content/tool-building.md:114-116 - URL Variables:
<<systemId_url>>provides the base URL defined in the system. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:120-121 - SourceData Access: Previous step results are accessed via
sourceData.stepId.data. Sources: packages/web/src/lib/agent/skills/content/tool-building.md:33-35
Step Execution Strategy
Execution is routed based on the URL protocol defined in the step config. Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:28-36
| Protocol | URL Scheme |
|---|---|
| HTTP/HTTPS | http://, https:// |
| PostgreSQL | postgres://, postgresql:// |
| MSSQL | mssql://, sqlserver:// |
| Redis | redis://, rediss:// |
| FTP/SFTP | ftp://, sftp:// |
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:28-36
Tool Modification (Tool Editing)
Modifications to existing tools are performed using RFC 6902 JSON Patch operations via the edit_tool function. Sources: packages/web/src/lib/agent/skills/content/tool-editing.md:3-5, packages/web/src/lib/agent/registries/tool-registry.ts:365-375
Sequence for Tool Editing
Editing involves a confirmation loop where changes are staged before persistence. Sources: packages/web/src/lib/agent/skills/content/tool-editing.md:55-63
The sequence shows how sequential patches are validated and applied to the tool configuration. Sources: packages/web/src/lib/agent/registries/tool-registry.ts:400-450, packages/web/src/lib/agent/skills/content/tool-editing.md:55-63
Supported Patch Operations
- add: Creates a field or appends to an array (path:
/steps/-). - remove: Deletes a field or array element.
- replace: Updates an existing value (fails if path is missing).
- move/copy: Relocates or duplicates config sections.
Sources: packages/web/src/lib/agent/skills/content/tool-editing.md:9-20, packages/web/src/lib/agent/skills/content/tool-editing.md:38-53
Validation Logic
The system enforces strict structural rules before a tool is built or saved. Sources: packages/core/api/tools.test.ts:44-90
- Unique ID: The tool must have a valid kebab-case string identifier.
- Instruction: A human-friendly description is mandatory for the main tool and each step.
- Step Config: Every step must contain a
configobject. - Request URLs: All request-type steps must have a non-empty string URL.
- Modify Flag: Steps that perform write operations (POST, PUT, DELETE) must set
modify: true.
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:162-175, packages/web/src/lib/agent/skills/content/tool-building.md:41-44, packages/core/api/tools.test.ts:44-90
Summary
The Tool & Workflow Builder provides a framework for creating deterministic integrations. By combining atomic request and transform steps with JavaScript-based output shaping, it allows for complex multi-system orchestration. The use of JSON Patch for editing ensures that modifications are granular and subject to user approval before being persisted. Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:3-5, packages/web/src/lib/agent/skills/content/tool-editing.md:55-60