Overview

The Define Tool node creates tool definitions that enable LLMs to interact with external functions, APIs, and services. Each node defines a single tool with its JSON schema and Python implementation code. Multiple Define Tool nodes can be chained together to build a comprehensive toolkit for the Call LLM with Tools node.

A key architectural feature of HyperFlow is its canonical tool definition format - a universal schema that works across all LLM providers. You define tools once using HyperFlow's standard format, and the system automatically translates these definitions into the specific formats required by each LLM service (OpenAI's function calling, Anthropic's tool use, Google's function declarations, etc.). This ensures true portability and eliminates the need to rewrite tool definitions when switching between LLM providers.

Node Specification

Core Properties

Property Value
Node Type Tool Definition
Category Tools

Parameters

Parameter Type Options Default Required Description
Tool definition JSON - Weather example Yes JSON schema defining the tool's interface, parameters, and usage
Tool Python code Code - Empty Yes Python implementation that executes when the tool is called

Input Ports

Port Type Accepts Required Description
Tools Tools Tool definitions No Upstream tool definitions to accumulate with

Output Ports

Port Type Description
Tools Tools Accumulated list of tool definitions including this tool

Process Flow Exits

Exit Condition Description
Main exit Always Continues to next node after adding tool definition

Tool Definition Schema

Important: This is HyperFlow's canonical tool definition format - a fixed schema that must be followed exactly. HyperFlow automatically converts this universal format into the specific schemas required by each LLM service (OpenAI, Anthropic, Google, etc.), ensuring your tool definitions work seamlessly across all supported LLM providers without modification.

The JSON tool definition follows this structure:

{
  "name": "tool_name",
  "description": "Clear description of what the tool does",
  "parameters": {
    "param1": {
      "type": "string",
      "description": "Parameter description",
      "required": true
    },
    "param2": {
      "type": "number",
      "description": "Optional parameter",
      "required": false
    }
  },
  "return_value": {
    "type": "object"
  },
  "tool_call": {
    "tool": "tool_name",
    "parameters": {
      "param1": "<value>"
    }
  },
  "examples": [
    {
      "user_input": "Example query",
      "tool_call": {
        "tool": "tool_name",
        "parameters": {
          "param1": "example_value"
        }
      },
      "expected_output": {
        "result": "example output"
      }
    }
  ]
}

Schema Fields

Field Required Description
name Yes Unique identifier for the tool
description Yes Clear explanation helping LLMs understand when to use this tool
parameters Yes Object defining input parameters with types and descriptions
return_value No Expected return type specification
tool_call No Template showing how to invoke the tool
examples No Array of example invocations with expected outputs