Unity Catalog function tools with HTTP connection
To connect agents to external services, Databricks recommends MCP Services or the Unity Catalog connections proxy. UC function tools that wrap http_request remain supported but are no longer the recommended approach.
You can create a Unity Catalog function that wraps http_request() to call external services. This approach is useful for SQL-based tool definitions.
Requirements
A Unity Catalog HTTP connection for the external service. Reference it by name in the http_request() function's conn parameter.
Create a function tool with http_request()
The following example creates a Unity Catalog function tool that posts a message to Slack:
CREATE OR REPLACE FUNCTION main.default.slack_post_message(
text STRING COMMENT 'message content'
)
RETURNS STRING
COMMENT 'Sends a Slack message by passing in the message and returns the response received from the external service.'
RETURN (http_request(
conn => 'test_sql_slack',
method => 'POST',
path => '/api/chat.postMessage',
json => to_json(named_struct(
'channel', "C032G2DAH3",
'text', text
))
)).text
See CREATE FUNCTION (SQL, Python, Scala, and Java).
SQL access with http_request is blocked for the User-to-Machine Per User and Dynamic Client Registration connection types. Use the Python Databricks SDK instead.