Deep Agents · Lesson 6 of 9 · 5 min read

Giving Your Agent Tools

How to give a deep agent tools: in deepagents a tool is a plain function whose docstring is its schema — plus how to plug in MCP servers. With code.

By the ToolsHub team · Updated September 14, 2026

Planning and subagents are useless without tools — the things that let the agent actually do something: search, read a database, call an API, run code. In deepagents a tool is just a Python function.

A tool is a function + a docstring

The function's name, type hints and docstring become the tool's schema — so write clear ones; the model reads them to decide when and how to call the tool.

def get_weather(city: str) -> str:
    """Get the current weather for a city.

    Args:
        city: City name, e.g. 'Paris'.
    """
    ...
    return "sunny, 21C"

agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-6",
    tools=[get_weather],
    system_prompt="You are a travel assistant.",
)

Need the tool schema in a specific format, or converting one between OpenAI/Anthropic/MCP? The Tool Definition Generator writes it for you.

Plugging in MCP tools

Agents increasingly get their tools from MCP servers (filesystem, GitHub, search…). Generate a valid server config with the MCP Config Generator, and before you trust a server, scan it — the next lesson covers that.

Try the tool