liveBook · Manning

Tool

As explained in AI Agents and Applications

A software tool is a capability or utility that enables a person or system to perform a defined task or operation.

A travel assistant may need to search destination information and check the weather before answering. A tool is a callable capability that gives an agent access to such information or actions. Tools can retrieve documents, query databases, call APIs, send emails, or create tickets. section 11.0 section 12.4

An agent exposes available tools to an LLM with their names, parameters, and descriptions. The model chooses which tool to use and supplies its arguments; the agent executes it and processes the result. It can repeat this loop, adapting subsequent choices to what earlier tools returned. section 11.2.2 section 1.1.3

Search travel information

A local search_travel_info tool accepts a query, invokes a vector-store retriever over Wikivoyage content, and returns up to four results as one string. Decorating the function with @tool makes its name, description, and parameter schema available for tool calling. section 11.2.2

Listing 11.3 LangGraph attribute-based tool definition
@tool  #1
def search_travel_info(query: str) -> str:  #2
    """Search embedded Wikivoyage content for 
    information about destinations in England."""
    docs = ti_retriever.invoke(query)  #3
     top = docs[:4] if isinstance(docs, list) else docs  #3
    return "\n---\n".join(
    d.page_content for d in top)  #4

Inspect the decorated search function and how it formats retrieved content. section 11.2.2

Tools can be local or remote. A travel agent can combine its local semantic search tool with weather tools retrieved from an MCP server. Its asynchronous main function passes the combined tool list to the agent, allowing destination search and live weather access in the same application. section 13.4 section 13.4.4

Listing 13.3 Combining local and remote tools
class AgentState(TypedDict):  #1
    messages: Annotated[Sequence[BaseMessage], operator.add]
    remaining_steps: RemainingSteps

async def main():
    accuweather_tools = \
        await get_accuweather_tools()  #2
    tools = [search_travel_info, 
        *accuweather_tools]  #3
    llm_model = ChatOpenAI( 
        model="gpt-5-mini",
        use_responses_api=True)  #4

    travel_info_agent = create_react_agent(  #5
        model=llm_model,
        tools=tools,
        state_schema=AgentState,
        name="travel_info_agent",
        prompt="""You are a helpful assistant that can 
        search travel information and get the weather forecast. 
        Only use the tools to find the information you need 
        (including town names).""",
    )
    await chat_loop(travel_info_agent) #6

if __name__ == "__main__":
    asyncio.run(main())  #7

See how the local search tool and remote weather tools are combined in the agent configuration. section 13.4.4

Do not assume a tool was called correctly just because the assistant produced an answer. In debug mode, inspect the registered tools, then check the server terminal and LangSmith trace to confirm the expected call. Traces can also expose slow calls or incorrect tool selection. section 13.4.5 section 12.4

How AI Agents and Applications covers it

How deep it goes
Works through tool registration and calling, from a single retriever to combined local and remote tools.
Examples
Uses a Wikivoyage destination search and an AccuWeather MCP tool in a travel assistant.
What it assumes
Assumes familiarity with sourcing content and populating a vector store before building the retrieval tool.
What you can do after
Builds a tool-calling protocol from scratch and applies tools through LangGraph.
How it connects
Connects tool calling with vector-store retrieval, APIs, MCP, and multi-agent routing.

Also explained in

Compare how 17 books explain tool →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.