What you will be able to do
- Identify the parts of a Unity Catalog function that an agent sees as its tool contract: name, description and parameter schema
- Choose between candidate UC tools by functional fit: whether the tool performs the action the task asks for
- Check input compatibility (the agent has the value each parameter needs) and output compatibility (the return type is what the next step uses)
- Rule out a tool that fits the task but fails on execution requirements, such as missing EXECUTE permission or the wrong kind of compute
Key concept
Tool contract — An agent never reads a tool's code. It picks a tool and fills in the arguments using only the tool's name, its description and its parameter schema. For a Unity Catalog function, the function definition supplies all three: the registered name, the function COMMENT and the typed, commented parameters.
1.What an agent sees of a Unity Catalog function tool
A Unity Catalog function becomes an agent tool when you register it as catalog.schema.function_name and hand it to the agent, for example through UCFunctionToolkit(function_names=[...]) or the Unity Catalog functions MCP server. The model then decides whether to call the tool and what arguments to pass. It makes that decision from metadata alone. When you list an MCP server's tools, each one comes back as three things: tool.name, tool.description and tool.inputSchema. That is everything the model has to work with.
In a SQL function, each part of the contract has a fixed place. The function name is the tool's name. The COMMENT after RETURNS is the description. The parameter list, with each parameter's type and its own COMMENT, is the parameter schema. Databricks annotates its retriever example with both rules: the function COMMENT decides when the tool is called, and the parameter COMMENT decides how the agent writes the argument. The example below fills in all three. The description also says what the output can be used for next: the returned customer ID feeds other queries.
CREATE FUNCTION my_catalog.my_schema.lookup_customer_info(
customer_name_input STRING COMMENT 'Name of the customer whose info to look up'
)
RETURNS STRING
COMMENT 'Returns metadata about a particular customer, given the customer''s name, including the customer''s email and ID. The
customer ID can be used for other queries.'
RETURN SELECT CONCAT(
'Customer ID: ', customer_id, ', ',
'Customer Email: ', customer_email
)
FROM my_catalog.my_schema.customer_data
WHERE customer_name = customer_name_input
LIMIT 1;A Python function registered with DatabricksFunctionClient holds the same information in its signature and docstring. The type hints give the parameter types and the return type. The docstring states the purpose, describes each argument and says what the function returns.
def add_numbers(number_1: float, number_2: float) -> float:
"""Add two numbers.
Args:
number_1: The first number to add.
number_2: The second number to add.
Returns:
The sum of the two numbers.
"""
return number_1 + number_2When you are asked to pick a tool from a list, read it the way the model does. The name and description tell you what the tool is for. The parameter schema tells you what you must already have in order to call it. The return type tells you what you get back. When two descriptions overlap so much that the model keeps choosing the wrong one, the problem lies in overlapping tool descriptions, not in selection. Here, assume the descriptions are clear and the task is to pick the right tool.
Checkpoint 1 of 8· Fill the gap
This UC SQL function is given to an agent as a tool. Which keyword completes the parameter definition so that the agent gets text telling it how to fill in customer_name_input?
CREATE FUNCTION my_catalog.my_schema.lookup_customer_info(
customer_name_input STRING ? 'Name of the customer whose info to look up'
)
RETURNS STRING
COMMENT 'Returns metadata about a particular customer, given the customer''s name, including the customer''s email and ID. The
customer ID can be used for other queries.'
RETURN SELECT CONCAT(
'Customer ID: ', customer_id, ', ',
'Customer Email: ', customer_email
)
FROM my_catalog.my_schema.customer_data
WHERE customer_name = customer_name_input
LIMIT 1;In a UC SQL function, the parameter's own COMMENT becomes part of the tool's parameter schema, and the agent uses it to decide how to write the argument. The function-level COMMENT after RETURNS tells the agent when to call the tool. DESCRIPTION is the name of the field the model sees on an MCP tool, but it is not the SQL keyword. DEFAULT sets a default value and gives the model no guidance.
Source: docs.databricks.com2.Functional fit: does the tool do what the task asks
Start by ruling out every tool that performs a different action from the one requested, even if the action looks close. Suppose the task says "delete this record". A tool described as marking a record archived without removing it does not delete anything, so it is wrong no matter how safe archiving sounds. A tool that only returns a record's status reads the outcome without changing anything. That leaves the actual delete tool as the only one that meets the request. Functional fit is about the action the task asks for, not about which action you might prefer.
Lookup and search are also different functions, even when the tool names look alike. A tool described as looking up one item by its exact code is built for a task that supplies that code. A tool described as a text search over names and descriptions is built for a task that supplies free-form words. If the task gives an exact identifier, the exact-lookup tool is the functional fit. The text search might still find the item if the code happens to appear in a description, but nothing guarantees that, and the result comes back as a list of candidates rather than the one item asked for. The order in which tools were registered has no bearing on which one fits.
The same reasoning applies across the Databricks tool types, not only between individual functions. A UC function is the right tool when the query is known in advance and only its inputs change. When the agent has to write SQL itself, the Databricks SQL MCP server fits. For open-ended business questions, Databricks recommends Genie One, which resolves business terms through Genie Ontology.
| Your agent needs to | Use |
|---|---|
| Answer business questions across the workspace | Genie One MCP |
| Query one curated Genie Agent from Python | AI Bridge tools |
| Write and run SQL | Databricks SQL MCP |
| Run a predefined query with parameters | Unity Catalog function tools |
Checkpoint 2 of 8· Check yourself
A support agent runs the same customer-data query on every request. The only thing that changes is the customer name the user gives. Which tool type fits this task?
The query is known in advance and only its input changes, so it belongs in a UC function. The agent then supplies only the parameter value. Making the agent write the SQL through the Databricks SQL MCP server rebuilds logic that already exists. Genie One and AI Bridge are for open-ended business questions, not for a fixed lookup.
“Create a structured retrieval tool using Unity Catalog SQL functions when the query is known ahead of time and the agent provides the parameters.”Source: docs.databricks.com
Checkpoint 3 of 8· Exam question
A retail assistant agent receives the request "Find the product with SKU SKU-99231." Two similarly named Unity Catalog tools are registered: - search_products_by_sku(sku: str) -> dict — looks up a single product by exact SKU code - search_products_by_keyword(query: str) -> list[dict] — performs a text search across product names and descriptions Which tool should the agent invoke?
Correct answer: A — search_products_by_sku, because the task supplies an exact SKU code, which matches this tool's required input type and purpose
- A. Correct. The task provides an exact SKU value, and search_products_by_sku's parameter and description are purpose-built for that exact-match input, making it the correct functional and input/output fit.
- B. Incorrect. Relying on a keyword search to incidentally match a SKU is unreliable and not the tool's intended purpose; a dedicated exact-match tool exists and should be preferred.
- C. Incorrect. Registration order in Unity Catalog has no bearing on which tool is functionally appropriate for a given task.
- D. Incorrect. Returning more results is not inherently more useful; the task asks for one specific product, so a tool returning a single matching dict is the better output match.
3.Input and output compatibility
Input compatibility asks whether the agent can fill every required parameter with a value it actually has. Tool-call arguments are values the model generates from the user's input. If the task supplies a region name, a tool that takes a region string can be called right away. A tool that needs a ticket ID cannot, because the agent would first need another call just to get the IDs. Types matter as well as presence: sku: str described as an exact code expects the code itself, while query: str described as a text search expects search words.
Output compatibility asks whether the return value is what the next step uses, with no extra work in between. If a widget shows one number, a tool that returns an int is the match. A tool that returns a list of full records produces the same number only after the agent counts the list, and every one of those records passes through the agent's context first. Large results also carry a practical risk. Databricks warns that SQL clients can cap the rows or bytes a function returns, so a large result can arrive truncated, which would make the count wrong. The same applies to downstream checks. If the next step branches on a boolean, a tool that returns bool feeds it directly. A tool that returns None gives it nothing to check, and a status lookup adds a second call.
| Tool | Required input | Returns | Fits a step that needs |
|---|---|---|---|
| databricks_docs_vector_search | query STRING | TABLE of page_content and metadata | Relevant documentation chunks with a doc_uri |
| list_volume_files | none (directory is optional) | Text list of [file] and [dir] entries with sizes | Finding which file to read |
| read_volume_file | file_path (required) | The file's text | The contents of one known file |
The volume tools show how input compatibility determines the order of calls. read_volume_file requires a file_path. If the user asks "summarise the Q4 report" without giving the path, the agent first calls list_volume_files, which needs no input, to find the path, and only then calls read_volume_file. For MCP tools, check the output shape before relying on it. Use structuredContent when it is present, check isError, and look at a sample response before writing code that depends on specific output fields.
It picks the right tool for the wrong reason. Being non-None is not the point. What matters is that the tool performs the requested deletion (functional fit) and that its boolean is exactly what the downstream success check reads (output compatibility). A status-string tool is also non-None, but it neither deletes the record nor returns a boolean.
Checkpoint 4 of 8· Check yourself
A dashboard tile shows one number: how many tickets are open in the region the user names. Four UC functions are registered. Which one should the agent call?
The tile needs one integer, and the region is already in the task, so the INT-returning count tool matches both the input and the output. Returning full records puts every ticket into the agent's context and adds a counting step. SQL clients can also cap returned rows or bytes, so a truncated list would give the wrong count. The status tool needs ticket IDs the agent does not have, and the text search expects search words, not a region filter.
“SQL clients might limit the maximum number of rows or bytes returned.”Source: docs.databricks.com
Checkpoint 5 of 8· Check yourself
A user tells an agent with list_volume_files and read_volume_file to "summarise the Q4 report" but gives no file path. What should the agent do?
read_volume_file requires a file_path, and the agent does not have one yet. list_volume_files takes no required input, so the agent calls it first to find the path and then reads the file. "Q4 report" is not a path, read_volume_file cannot run without file_path, and the listing returns only names and sizes, not file contents.
“Lists files and directories in the Unity Catalog volume. Provide a relative directory path, or leave empty to list the volume root.”Source: docs.databricks.com
Checkpoint 6 of 8· Exam question
An agent powering a support dashboard needs to populate a KPI widget that displays a single number: the count of open support tickets in the "EMEA" region. Available Unity Catalog tools: - get_ticket_details(ticket_id: str) -> dict — returns full details for one ticket - count_open_tickets_by_region(region: str) -> int — returns the number of open tickets for a region - list_tickets_by_region(region: str) -> list[dict] — returns full ticket records for a region Which tool is the best selection for this task?
Correct answer: A — count_open_tickets_by_region, because its region parameter matches the task input and its integer return matches the single count the widget needs
- A. Correct. The task requires exactly one integer count for a given region. count_open_tickets_by_region takes the region as input and returns that integer directly, giving the closest input/output match with no extra processing or unrelated context.
- B. Incorrect. list_tickets_by_region would work indirectly, but it pulls full ticket records into context and forces the agent to perform extra counting logic, when a tool already returns the exact value needed.
- C. Incorrect. get_ticket_details requires a specific ticket_id, not a region, so its input does not match what the task provides and it cannot answer an aggregate question.
- D. Incorrect. Returning more fields is not an advantage here; it adds irrelevant data to context and does not match the scalar output the task requires.
Checkpoint 7 of 8· Exam question
An agent workflow includes a downstream step that checks a boolean result to decide whether to notify a user that a record was removed. The task instruction is "Delete record REC-1120 and confirm it was removed." Available tools: - delete_record(record_id: str) -> bool — deletes a record and returns whether the deletion succeeded - archive_record(record_id: str) -> None — marks a record as archived without removing it - get_record_status(record_id: str) -> str — returns the current status string of a record Which tool satisfies both the requested action and the downstream requirement?
Correct answer: A — delete_record, because it performs the requested deletion and its boolean return directly supports the downstream success check
- A. Correct. The task explicitly requests deletion, and delete_record both performs that action and returns a bool the downstream step can consume directly, satisfying functional fit and output compatibility together.
- B. Incorrect. Archiving does not remove the record as the task requires, and it returns None, which cannot feed the boolean check the downstream step needs.
- C. Incorrect. get_record_status only reads a status string; it performs no deletion at all, so it fails the core task requirement even though it returns useful data.
- D. Incorrect. Ruling out tools by return type alone, without checking whether the tool performs the requested action, is not a valid selection justification.
4.Execution and permission requirements
A tool can fit the task and still fail if the agent's identity is not allowed to run it. Calling a UC function requires EXECUTE on the function, plus USE CATALOG and USE SCHEMA on its parent catalog and schema. The managed MCP servers apply the same rule: Unity Catalog permissions limit agents and users to the tools and data they have been granted. If the agent lacks EXECUTE on the function that fits best, the selection is not deployable as it stands. Either grant the privilege or choose a tool the agent can run.
Compute is the other requirement. The Function Client runs UC function tools on serverless general compute, and Databricks states that a SQL warehouse alone is not sufficient. Pricing differs in the same way: UC functions use serverless general compute pricing, Genie Agents use serverless SQL compute pricing and the Databricks SQL server uses Databricks SQL pricing. For a workspace without serverless compute enabled, a UC function tool will not run, however well it fits the task.
Checkpoint 8 of 8· Check yourself
After deployment, an agent runs as a service principal that has USE CATALOG on sales and USE SCHEMA on sales.support. The best-fitting tool is sales.support.lookup_customer_info, but every call fails with a permission error. What fixes it?
To call a UC function, the identity needs EXECUTE on the function as well as USE CATALOG and USE SCHEMA on its parents, and this principal is missing only EXECUTE. The COMMENT is metadata the model reads and grants no access. A SQL warehouse is not enough to run UC function tools. Registering a copy makes a new function instead of granting access to the one that fits.
“calling an existing function requires EXECUTE on it.”Source: docs.databricks.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The agent uses this comment to determine when to call this tool.”
↩︎ What an agent sees of a Unity Catalog function tool“SQL clients might limit the maximum number of rows or bytes returned.”
↩︎ Input and output compatibility“The agent uses this comment to determine when to call this tool.”
↩︎ Key concept“SQL clients might limit the maximum number of rows or bytes returned.”
↩︎ Exam trap 1“The agent uses this comment to determine how to generate the query string parameter.”
↩︎ Exam trap 4“Lists files and directories in the Unity Catalog volume. Provide a relative directory path, or leave empty to list the volume root.”
↩︎ Checkpoint - 2.
“Discover tool names and input schemas with list_tools() before calling a tool.”
↩︎ What an agent sees of a Unity Catalog function tool“Check isError and inspect a sample response before relying on particular output fields.”
↩︎ Input and output compatibility - 3.https://docs.databricks.com/aws/en/udf/unity-catalogOfficial docs
“the function name must follow the format catalog.schema.function_name”
↩︎ What an agent sees of a Unity Catalog function tool - 4.
“Create a structured retrieval tool using Unity Catalog SQL functions when the query is known ahead of time and the agent provides the parameters.”
↩︎ Functional fit: does the tool do what the task asks“Create a structured retrieval tool using Unity Catalog SQL functions when the query is known ahead of time and the agent provides the parameters.”
↩︎ Exam trap 2 - 5.
“Use the Databricks SQL MCP server when you need to run a specific query you already wrote”
↩︎ Functional fit: does the tool do what the task asks“Tool call arguments: Parameters that an LLM typically generates dynamically based on user input”
↩︎ Input and output compatibility“Unity Catalog enforces permissions, so agents and users access only the tools and data you grant them.”
↩︎ Execution and permission requirements - 6.
“The Function Client uses serverless general compute to run tools; a SQL warehouse alone is not sufficient.”
↩︎ Execution and permission requirements“calling an existing function requires EXECUTE on it.”
↩︎ Execution and permission requirements“calling an existing function requires EXECUTE on it.”
↩︎ Exam trap 3