CREATE TOOL Statement in Confluent Cloud for Apache Flink

Confluent Cloud for Apache Flink® enables creating tool resources that can be used by AI agents. Tools can be either user-defined functions or external tools accessed by using connection resources. For more information, see Call Tools in AI Workflows.

Syntax

CREATE TOOL [IF NOT EXISTS] [[catalog.]database.]tool_name
[
  USING FUNCTION <function_identifier>
|
  USING CONNECTION <connection_identifier>
]
[COMMENT <comment_string>]
WITH (<option_list>)

Description

Create a new tool resource that can be referenced by AI agents. Tools can be either Flink user-defined functions or external MCP servers accessed by using connections.

Tool Types

Function Tools

Tools that wrap Flink user-defined functions:

CREATE TOOL convert_to_celsius_tool
USING FUNCTION convert_to_celsius
WITH (
  'type' = 'function',
  'description' = 'This function can be used by model to convert degree to celsius'
);

Connection Tools

Tools that access external MCP servers by using connections:

CREATE TOOL mcp_server
USING CONNECTION mcp_connection
WITH (
  'type' = 'mcp_server',
  'allowed_tools' = 'tool1,tool2',
  'request_timeout' = '30'
);

MCP tool options

  • type: Tool type (‘function’ or ‘mcp_server’) (Required)
  • description: Human-readable description (Optional)
  • allowed_tools: Comma-separated list of allowed tools (MCP only) (Optional)
  • request_timeout: Request timeout for external tools (Optional, default: ‘30’)

Examples

Create a function tool:

CREATE FUNCTION convert_to_celsius
USING JAR 'celsius.jar'
COMMENT 'function to convert degree to celsius';

CREATE TOOL convert_to_celsius_tool
USING FUNCTION convert_to_celsius
WITH (
  'type' = 'function',
  'description' = 'Convert temperature from Fahrenheit to Celsius'
);

Create an MCP tool:

CREATE CONNECTION mcp_connection
WITH (
  'type' = 'mcp_server',
  'api-key' = '<your-api-key>',
  'endpoint' = 'https://mcp.example.com',
);

CREATE TOOL mcp_server
USING CONNECTION mcp_connection
WITH (
  'type' = 'mcp_server',
  'allowed_tools' = 'weather_api,calculator',
  'request_timeout' = '60'
);