Dynamic tool discovery queries an MCP server for its available tools before an agent is constructed. An MCPToolProvider uses an established session to request the server’s tool list and turn each result into a client-side MCPTool linked to its provider. section 5.2 section 5.2.1
The discovery flow connects server metadata to agent-ready tools:
- Call the provider’s asynchronous get_tools(); it obtains a session and invokes list_tools(). section 5.2.1
- Convert each server tool’s name, description, input schema, and annotations into an MCPTool, retaining a reference to the provider. section 5.2.1
- Pass the discovered tools to an LLM agent; use LLMAgentBuilder to discover tools across configured providers during its asynchronous build(). section 5.3
Listing 5.4 Implementing MCPToolProvider: get_tools()
# llm_agents_from_scratch/tools/mcp/provider.py
… #A
from typing import TYPE_CHECKING
if TYPE_CHECKING: #B
from .tool import MCPTool
class MCPToolProvider:
"""MCP Tool Provider class."""
… #C
async def get_tools(self) -> list["MCPTool"]:
"""Fetch tools from the MCP server and create MCPTool instances."""
from llm_agents_from_scratch.tools.mcp.tool import MCPTool #D
session = await self.session() #E
response = await session.list_tools() #F
return [
MCPTool( #G
provider=self,
name=f"mcp__{self.name}__{tool.name}",
desc=tool.description or "",
params_json_schema=tool.input_schema,
additional_annotations=tool.annotations,
)
for tool in response.tools
]See the get_tools() implementation, including the server query and MCPTool construction. section 5.2.1
Hailstone server
An MCPToolProvider discovers the Hailstone server’s tool, whose description and parameter schema can then be inspected or supplied to an agent. section 5.2.1 section 5.3



