CertSafari
    Databricks Certified Context Engineer Associate· Lessons

    Domain 5 · Lesson 33/45

    Selecting the right Unity Catalog function tool for an agent task

    Given a described agent task and a set of tools registered in Unity Catalog (with names, descriptions, and parameter schemas), identify the most appropriate tool and justify the selection based on functional fit, input/output compatibility, and task requirements.

    16 min read
    2.17% of exam
    6 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    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.

    A UC SQL function used as a tool. The parameter COMMENT, the RETURNS type and the function COMMENT together make up its contract.sql
    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.

    A Python function registered as a UC tool. Typed parameters, a typed return and a docstring describe what it does.python
    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_2

    When 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;

    Sources123

    2.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.

    Matching the shape of the task to the tool type
    Your agent needs toUse
    Answer business questions across the workspaceGenie One MCP
    Query one curated Genie Agent from PythonAI Bridge tools
    Write and run SQLDatabricks SQL MCP
    Run a predefined query with parametersUnity 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?

    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?

    Sources45

    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.

    Reading inputs and outputs from real tool definitions
    ToolRequired inputReturnsFits a step that needs
    databricks_docs_vector_searchquery STRINGTABLE of page_content and metadataRelevant documentation chunks with a doc_uri
    list_volume_filesnone (directory is optional)Text list of [file] and [dir] entries with sizesFinding which file to read
    read_volume_filefile_path (required)The file's textThe 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.

    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?

    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?

    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?

    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?

    Sources512

    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?

    Sources65

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 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. 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. 3.
      “the function name must follow the format catalog.schema.function_name”
      ↩︎ What an agent sees of a Unity Catalog function tool
    4. 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. 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. 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

    Ready to test yourself?

    Practise Databricks Certified Context Engineer Associate in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.