Search⌘ K
AI Features

Designing Unambiguous Tool Sets and Schemas

Explore how ambiguous tool definitions can make AI agents choose inconsistently. Learn to merge overlapping tools, write discriminating descriptions, constrain inputs with enums and strict schemas, validate calls locally, and test tool sets for overlap so production workflows are more reliable and easier to trace.

We'll cover the following...

In the previous lesson, we saw two skills with overlapping triggers give the model opposite instructions. Tools can overlap in the same way. In this lesson, we’ll apply the same check to the tool definitions that sit next to the prompt.

So far, our on-call assistant has one tool, search_documents(), which searches runbooks and postmortems. To answer “What changed?”, it also needs to see recent deploys. Over a few weeks, two teammates each add a tool for that. One adds get_deploy_log(). The other adds get_change_history(), which covers deploys and feature flag changes. On paper, that looks like more capability. In practice, it gives the model a choice it can’t make well.

Two tools for one job

Let’s write both tools in the same OpenAI function format we’ve used since Chapter 1, next to the existing search tool. A small helper keeps each definition short.

tools_overlap.py · Python 3.14.0
from engine_config import SEARCH_TOOL
def make_tool(name, description, properties, required):
return {"type": "function", "function": {
"name": name, "description": description,
"parameters": {"type": "object", "properties": properties, "required": required}}}
SERVICE_PARAM = {"service": {"type": "string", "description": "The service name, such as checkout."}}
DEPLOY_LOG_TOOL = make_tool(
"get_deploy_log", "Return recent deploys for a service, with time and version.",
SERVICE_PARAM, ["service"])
CHANGE_HISTORY_TOOL = make_tool(
"get_change_history", "Return recent changes to a service, including deploys, versions, and flag changes.",
SERVICE_PARAM, ["service"])
OVERLAPPING_TOOLS = [SEARCH_TOOL, DEPLOY_LOG_TOOL, CHANGE_HISTORY_TOOL]
CHANGE_QUERY = "What deployed to checkout right before the 14:05 spike?"
if __name__ == "__main__":
for tool in OVERLAPPING_TOOLS:
fn = tool["function"]
print(f"{fn['name']:<19}| needs {fn['parameters']['required']} | {fn['description'][:45]}...")

In the code above:

  • Lines 4–7: We define make_tool(), which builds a tool definition from a name, a description, parameters, and the required parameter names.

  • Line 10: We define SERVICE_PARAM, a single free-text service parameter.

  • Lines 11–16: We define get_deploy_log and get_change_history. Both take only service, and both descriptions promise recent deploys.

  • Lines 18–19: We collect the three tools and write a “what changed?” question.

  • Lines 21–24: We print each tool’s name, required parameters, and the start of its description.

The two change tools look almost the same:

search_documents | needs ['query', 'top_k'] | Search the team's runbooks and postmortems an...
get_deploy_log | needs ['service'] | Return recent deploys for a service, with tim...
get_change_history | needs ['service'] | Return recent changes to a service, including...
Two tools take the same input and promise the same deploy data

Try to decide which tool should answer “What deployed to checkout right before the 14:05 spike?” Both take a service name, and both return deploys. There’s no clear answer.

Which tool does the model pick?

Let’s ask the model the same question several times with all three tools available. We set tool_choice="auto" ...