AI Agent1 input → 2 outputs
AI Tool
Defines a custom tool that the AI Agent can call, and coordinates between the AI and the tool's execution flow.
Inputs
Outputs
- Output 1 - To Next Node (AI Agent)
- Output 2 - To Tool Flow (when AI calls tool)
Details
The Tool Adapter is the bridge between the AI Agent and custom tool implementations. It:
- Registers a tool definition with the AI (via output 1)
- When AI calls the tool, routes the request to your flow (output 2)
- Coordinates with Tool Terminate to return results to the AI
Tool Definition
- Tool ID
- Unique identifier (letters, numbers, underscores, hyphens). AI uses this to call the tool.
- Description
- Tell the AI what this tool does. Be specific—AI uses this to decide when to call it.
- Parameters
- Define what arguments the AI should provide:
- name: Parameter identifier
- type: string, number, boolean, object, array
- description: Help AI understand what value to provide
- required: Whether this parameter is mandatory
Tool Settings
- Timeout
- Max milliseconds to wait for tool execution. Default: 30000 (30 seconds)
- Validation Code
- JavaScript to validate tool input before execution:
if (!input.patientId) { return { valid: false, error: 'patientId required' }; } return { valid: true };
Examples
FHIR Search Tool:
Tool ID: search_patient
Description: Search for patients by name or MRN
Parameters:
- name: searchTerm (string, required)
"The patient name or MRN to search for"
Appointment Booking Tool:
Tool ID: book_appointment Description: Schedule an appointment for a patient Parameters: - patientId (string, required) - dateTime (string, required) - providerId (string, required) - reason (string, optional)
Flow Pattern
[AI Model] → [Tool Adapter]
↓ output 1 → continues to AI Agent
↓ output 2 → [Your Tool Flow] → [Tool Terminate]
Best Practices
- Write clear, specific tool descriptions
- Mark only truly required parameters as required
- Validate inputs to prevent errors downstream
- Always end tool flows with Tool Terminate