Tools
any_agent.tools
MCPClient
Bases: BaseModel
Unified MCP client that handles all transport types and frameworks.
Source code in src/any_agent/tools/mcp/mcp_client.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
connect()
async
Connect using the appropriate transport type.
Source code in src/any_agent/tools/mcp/mcp_client.py
disconnect()
async
list_raw_tools()
async
Get raw MCP tools from the server.
Source code in src/any_agent/tools/mcp/mcp_client.py
list_tools()
async
Get tools converted to callable functions that work with any framework.
model_post_init(__context)
Initialize the MCP client and check dependencies.
Source code in src/any_agent/tools/mcp/mcp_client.py
a2a_tool(url, toolname=None, http_kwargs=None)
Perform a query using A2A to another agent (synchronous version).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The url in which the A2A agent is located. |
required |
toolname
|
str
|
The name for the created tool. Defaults to |
None
|
http_kwargs
|
dict
|
Additional kwargs to pass to the httpx client. |
None
|
Returns:
Type | Description |
---|---|
Callable[[str, Optional[str], Optional[str]], str]
|
A sync |
Source code in src/any_agent/tools/a2a.py
a2a_tool_async(url, toolname=None, http_kwargs=None)
async
Perform a query using A2A to another agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The url in which the A2A agent is located. |
required |
toolname
|
str
|
The name for the created tool. Defaults to |
None
|
http_kwargs
|
dict
|
Additional kwargs to pass to the httpx client. |
None
|
Returns:
Type | Description |
---|---|
Callable[[str, Optional[str], Optional[str]], Coroutine[Any, Any, dict[str, Any]]]
|
An async |
Source code in src/any_agent/tools/a2a.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
ask_user_verification(query)
Asks user to verify the given query
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The question that requires verification. |
required |
prepare_final_output(output_type, instructions=None)
Prepare instructions and tools for structured output, returning the function directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_type
|
type[BaseModel]
|
The Pydantic model type for structured output |
required |
instructions
|
str | None
|
Original instructions to modify |
None
|
Returns:
Type | Description |
---|---|
tuple[str, Callable[[str], dict[str, str | bool | dict[str, Any] | list[Any]]]]
|
Tuple of (modified_instructions, final_output_function) |
Source code in src/any_agent/tools/final_output.py
search_tavily(query, include_images=False)
Perform a Tavily web search based on your query and return the top search results.
See https://blog.tavily.com/getting-started-with-the-tavily-search-api for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The search query to perform. |
required |
include_images
|
bool
|
Whether to include images in the results. |
False
|
Returns:
Type | Description |
---|---|
str
|
The top search results as a formatted string. |
Source code in src/any_agent/tools/web_browsing.py
search_web(query)
Perform a duckduckgo web search based on your query (think a Google search) then returns the top search results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The search query to perform. |
required |
Returns:
Type | Description |
---|---|
str
|
The top search results. |
Source code in src/any_agent/tools/web_browsing.py
send_console_message(user, query)
Send the specified user a message via console and returns their response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The question to ask the user. |
required |
user
|
str
|
The user to ask the question to. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The user's response. |
Source code in src/any_agent/tools/user_interaction.py
show_final_output(answer)
Show the final answer to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
answer
|
str
|
The final answer. |
required |
show_plan(plan)
Show the current plan to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plan
|
str
|
The current plan. |
required |
visit_webpage(url, timeout=30, max_length=10000)
Visits a webpage at the given url and reads its content as a markdown string. Use this to browse webpages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The url of the webpage to visit. |
required |
timeout
|
int
|
The timeout in seconds for the request. |
30
|
max_length
|
int
|
The maximum number of characters of text that can be returned (default=10000). If max_length==-1, text is not truncated and the full webpage is returned. |
10000
|