Skip to main content

SearchToolsTool

from mcp_use.managers.tools.search_tools import SearchToolsTool

Attributes
name
ClassVar
required
Name identifier
description
ClassVar
required
Parameter value
args_schema
ClassVar
required
Parameter value

method init

Initialize with server manager and create a search tool.Parameters
server_manager
required
Server name or configuration
Signature
def __init__(server_manager):

ToolSearchEngine

from mcp_use.managers.tools.search_tools import ToolSearchEngine

method init

Initialize the tool search engine.Parameters
server_manager
default:"None"
The ServerManager instance to get tools from
use_caching
bool
default:"True"
Whether to cache query results
Signature
def __init__(server_manager = None, use_caching: bool = True):

method index_tools

Index all tools from all servers for search.Parameters
server_tools
dict[str, list[langchain_core.tools.base.BaseTool]]
required
dictionary mapping server names to their tools
Signature
def index_tools(server_tools: dict[str, list[langchain_core.tools.base.BaseTool]]):

Search for tools that match the query using semantic search.Parameters
query
str
required
The search query
top_k
int
default:"5"
Number of top results to return
Returns
returns
list[tuple[langchain_core.tools.base.BaseTool, str, float]]
list of tuples containing (tool, server_name, score)
Signature
def search(query: str, top_k: int = 5):

method search_tools

Search for tools across all MCP servers using semantic search.Parameters
query
str
required
The search query to find relevant tools
top_k
int
default:"100"
Number of top results to return
active_server
str
default:"None"
Name of the currently active server (for highlighting)
Returns
returns
str
String with formatted search results
Signature
def search_tools(query: str, top_k: int = 100, active_server: str = None):

method start_indexing

Index the tools from the server manager.Signature
def start_indexing():

ToolSearchInput

from mcp_use.managers.tools.search_tools import ToolSearchInput

Attributes
query
str
required
Query string or input
top_k
int
required
Integer value

method init

Create a new model by parsing and validating input data from keyword arguments.Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self is explicitly positional-only to allow self as a field name.Parameters
data
Any
required
Parameter value
Signature
def __init__(data: Any):
I