Skip to content

Tools

Tools extend Kindflow's capabilities by allowing you to define custom logic and integrate with your existing systems.

Overview

Tools act as bridges between Kindflow and your business infrastructure. They enable your intelligent assistant to perform actions beyond simple conversation - from accessing databases to calling external APIs.

What Are Tools?

Tools are custom integrations that allow you to:

  • Connect with external APIs and services
  • Implement custom business logic
  • Access your internal systems and databases
  • Perform calculations and data transformations
  • Execute specialized functions unique to your business

Why Use Tools?

  • Extensibility: Add capabilities specific to your business needs
  • Integration: Connect with your existing technology stack
  • Automation: Execute actions, not just provide information
  • Customization: Build solutions tailored to your workflows
  • Power: Unlock advanced functionality within your intelligent assistant

How Tools Work

You define what each Tool does and when it should be used. Your intelligent assistant can then call these Tools during customer interactions to perform actions, retrieve data, or integrate with your systems.

Types of Tools

  • API Integrations: Connect to external services and APIs
  • Database Tools: Query and update your databases
  • Custom Logic: Implement specialized business logic
  • Data Processing: Transform and analyze data
  • System Actions: Perform operations in your systems

Tool Structure

A tool consists of:

  • Name: Identifier following JavaScript variable naming (letters, numbers, underscore, dollar sign)
  • Description: Explains what the tool does and when to use it
  • JavaScript Code: The executable logic
  • Inputs: Parameters the tool receives when executed
  • Status: Draft, published, or archived

Tool Inputs

Tools can receive data through two input types:

Conversation Inputs

Extracted from the ongoing conversation context. The system uses the instructions you provide to extract the value from user messages.

Properties:

  • Name: Variable name in your code
  • Data Type: Type of value (see Data Types below)
  • Instructions: Guides the system on how to extract this value from conversation
  • Required: Whether this input must be provided
  • Default Value: Optional fallback value
  • Choices: For enum type, defines allowed values

Example:

Name: customerEmail
Data Type: string
Instructions: "Extract the customer's email address from the conversation"
Required: Yes

Metadata Inputs

Extracted from conversation metadata (system-level information).

Properties:

  • Name: Variable name in your code
  • Metadata Key: The key to fetch from conversation metadata

Example:

Name: userId
Metadata Key: user_id

Data Types

string

Text values. Default type for most inputs.

Example: Customer name, email address, product ID

number

Numeric values including decimals.

Example: Price (19.99), temperature (98.6)

integer

Whole numbers only.

Example: Quantity (5), age (25)

boolean

True or false values.

Example: Is premium customer, has warranty

enum

Predefined set of choices. User must select from the provided options.

Example: Order status (pending, shipped, delivered)

When using enum, specify comma-separated choices: pending, shipped, delivered

Creating a Tool

  1. Navigate to the Tools page
  2. Click "Create Tool"
  3. Enter a name (e.g., calculateShipping, validateOrder)
  4. Provide a clear description for when to use this tool
  5. Click "Create Tool"

Important: The description helps the system decide when to invoke this tool, so be specific about its purpose and use cases.

Writing Tool Code

Tools are written in JavaScript. The code should:

  • Accept inputs as parameters
  • Perform the required logic
  • Return a result

Example:

javascript
function calculateShipping(weight, destination) {
    const baseRate = 5.0;
    const perKgRate = 2.5;

    let rate = baseRate + weight * perKgRate;

    if (destination === "international") {
        rate *= 1.5;
    }

    return {
        shippingCost: rate,
        estimatedDays: destination === "international" ? 7 : 3,
    };
}

Adding Inputs

  1. Open the tool
  2. In the "Tool Inputs" section, click "Add Input"
  3. Select input source (Conversation or Metadata)
  4. Configure the input:
    • For Conversation: Set name, data type, instructions, required flag, default value
    • For Metadata: Set name and metadata key
  5. Click "Add Input"

Inputs are accessible in your code as parameters.

Testing Tools

Before publishing, test your tool:

  1. Add test values for each input in the "Tool Inputs" section
  2. Click "Run Tool"
  3. Review the execution result or error
  4. Adjust code and inputs as needed

Testing helps verify your tool works correctly with different input combinations.

Publishing a Tool

Draft tools are not available for use. To activate a tool:

  1. Open the tool
  2. Ensure the code is complete and tested
  3. Click "Publish"
  4. The tool status changes to "published" and becomes available

Published tools can be invoked in AOPs using /use @toolname.

Managing Tools

Editing a Tool

  1. Open the tool from the list
  2. Make changes to code, inputs, or metadata
  3. Click "Save" to update
  4. Re-test if you modified the logic

Archiving a Tool

  1. Open the tool
  2. Click "Archive"
  3. The tool becomes inactive but remains accessible

Deleting a Tool

  1. Open the tool
  2. Click "Delete"
  3. Confirm deletion

Warning: Deletion is permanent. Tools referenced in active AOPs will fail if deleted.

Best Practices

  • Clear Naming: Use descriptive names that indicate the tool's purpose
  • Specific Instructions: For conversation inputs, write clear extraction instructions
  • Error Handling: Handle edge cases in your JavaScript code
  • Test Thoroughly: Test with various input combinations before publishing
  • Keep Focused: Each tool should do one thing well
  • Document Purpose: Write detailed descriptions to help with tool selection

Next Steps