MCP Servers
MCPServer
Bases: ABC
Base class for Model Context Protocol servers.
ソースコード位置: src/agents/mcp/server.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
cached_tools
property
Return the most recently fetched tools list, if available.
Implementations may return None when tools have not been fetched yet or caching is
disabled.
__init__
__init__(
use_structured_content: bool = False,
require_approval: RequireApprovalSetting = None,
failure_error_function: ToolErrorFunction
| None
| _UnsetType = _UNSET,
tool_meta_resolver: MCPToolMetaResolver | None = None,
)
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
use_structured_content
|
bool
|
Whether to use |
False
|
require_approval
|
RequireApprovalSetting
|
Approval policy for tools on this server. Accepts "always"/"never",
a dict of tool names to those values, a boolean, an object with always/never
tool lists (mirroring TS requireApproval), or a sync/async callable that receives
|
None
|
failure_error_function
|
ToolErrorFunction | None | _UnsetType
|
Optional function used to convert MCP tool failures into a model-visible error message. If explicitly set to None, tool errors will be raised instead of converted. If left unset, the agent-level configuration (or SDK default) will be used. |
_UNSET
|
tool_meta_resolver
|
MCPToolMetaResolver | None
|
Optional callable that produces MCP request metadata ( |
None
|
ソースコード位置: src/agents/mcp/server.py
connect
abstractmethod
async
Connect to the server. For example, this might mean spawning a subprocess or
opening a network connection. The server is expected to remain connected until
cleanup() is called.
cleanup
abstractmethod
async
Cleanup the server. For example, this might mean closing a subprocess or closing a network connection.
list_tools
abstractmethod
async
list_tools(
run_context: RunContextWrapper[Any] | None = None,
agent: AgentBase | None = None,
) -> list[Tool]
List the tools available on the server.
call_tool
abstractmethod
async
list_prompts
abstractmethod
async
get_prompt
abstractmethod
async
list_resources
async
List the resources available on the server.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
cursor
|
str | None
|
An opaque pagination cursor returned in a previous
:class: |
None
|
Returns a :class:~mcp.types.ListResourcesResult. When the result contains
a nextCursor field, call this method again with that cursor to retrieve
the next page. Subclasses that do not support resources may leave this
unimplemented; it will raise :exc:NotImplementedError at call time.
ソースコード位置: src/agents/mcp/server.py
list_resource_templates
async
List the resource templates available on the server.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
cursor
|
str | None
|
An opaque pagination cursor returned in a previous
:class: |
None
|
Returns a :class:~mcp.types.ListResourceTemplatesResult. When the result
contains a nextCursor field, call this method again with that cursor to
retrieve the next page. Subclasses that do not support resource templates
may leave this unimplemented; it will raise :exc:NotImplementedError at
call time.
ソースコード位置: src/agents/mcp/server.py
read_resource
async
Read the contents of a specific resource by URI.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
uri
|
str
|
The URI of the resource to read. See :class: |
必須 |
Returns a :class:~mcp.types.ReadResourceResult. Subclasses that do not
support resources may leave this unimplemented; it will raise
:exc:NotImplementedError at call time.
ソースコード位置: src/agents/mcp/server.py
MCPServerStdioParams
Bases: TypedDict
Mirrors mcp.client.stdio.StdioServerParameters, but lets you pass params without another
import.
ソースコード位置: src/agents/mcp/server.py
command
instance-attribute
The executable to run to start the server. For example, python or node.
args
instance-attribute
Command line args to pass to the command executable. For example, ['foo.py'] or
['server.js', '--port', '8080'].
env
instance-attribute
The environment variables to set for the server. .
cwd
instance-attribute
The working directory to use when spawning the process.
encoding
instance-attribute
The text encoding used when sending/receiving messages to the server. Defaults to utf-8.
MCPServerStdio
Bases: _MCPServerWithClientSession
MCP server implementation that uses the stdio transport. See the [spec] (https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#stdio) for details.
ソースコード位置: src/agents/mcp/server.py
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | |
__init__
__init__(
params: MCPServerStdioParams,
cache_tools_list: bool = False,
name: str | None = None,
client_session_timeout_seconds: float | None = 5,
tool_filter: ToolFilter = None,
use_structured_content: bool = False,
max_retry_attempts: int = 0,
retry_backoff_seconds_base: float = 1.0,
message_handler: MessageHandlerFnT | None = None,
require_approval: RequireApprovalSetting = None,
failure_error_function: ToolErrorFunction
| None
| _UnsetType = _UNSET,
tool_meta_resolver: MCPToolMetaResolver | None = None,
)
Create a new MCP server based on the stdio transport.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
params
|
MCPServerStdioParams
|
The params that configure the server. This includes the command to run to start the server, the args to pass to the command, the environment variables to set for the server, the working directory to use when spawning the process, and the text encoding used when sending/receiving messages to the server. |
必須 |
cache_tools_list
|
bool
|
Whether to cache the tools list. If |
False
|
name
|
str | None
|
A readable name for the server. If not provided, we'll create one from the command. |
None
|
client_session_timeout_seconds
|
float | None
|
the read timeout passed to the MCP ClientSession. |
5
|
tool_filter
|
ToolFilter
|
The tool filter to use for filtering tools. |
None
|
use_structured_content
|
bool
|
Whether to use |
False
|
max_retry_attempts
|
int
|
Number of times to retry failed list_tools/call_tool calls. Defaults to no retries. |
0
|
retry_backoff_seconds_base
|
float
|
The base delay, in seconds, for exponential backoff between retries. |
1.0
|
message_handler
|
MessageHandlerFnT | None
|
Optional handler invoked for session messages as delivered by the ClientSession. |
None
|
require_approval
|
RequireApprovalSetting
|
Approval policy for tools on this server. Accepts "always"/"never", a dict of tool names to those values, or an object with always/never tool lists. |
None
|
failure_error_function
|
ToolErrorFunction | None | _UnsetType
|
Optional function used to convert MCP tool failures into a model-visible error message. If explicitly set to None, tool errors will be raised instead of converted. If left unset, the agent-level configuration (or SDK default) will be used. |
_UNSET
|
tool_meta_resolver
|
MCPToolMetaResolver | None
|
Optional callable that produces MCP request metadata ( |
None
|
ソースコード位置: src/agents/mcp/server.py
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | |
create_streams
connect
async
Connect to the server.
ソースコード位置: src/agents/mcp/server.py
cleanup
async
Cleanup the server.
ソースコード位置: src/agents/mcp/server.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
list_tools
async
list_tools(
run_context: RunContextWrapper[Any] | None = None,
agent: AgentBase | None = None,
) -> list[Tool]
List the tools available on the server.
ソースコード位置: src/agents/mcp/server.py
call_tool
async
call_tool(
tool_name: str,
arguments: dict[str, Any] | None,
meta: dict[str, Any] | None = None,
) -> CallToolResult
Invoke a tool on the server.
ソースコード位置: src/agents/mcp/server.py
list_prompts
async
List the prompts available on the server.
ソースコード位置: src/agents/mcp/server.py
get_prompt
async
Get a specific prompt from the server.
ソースコード位置: src/agents/mcp/server.py
list_resources
async
List the resources available on the server.
ソースコード位置: src/agents/mcp/server.py
list_resource_templates
async
List the resource templates available on the server.
ソースコード位置: src/agents/mcp/server.py
read_resource
async
Read the contents of a specific resource by URI.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
uri
|
str
|
The URI of the resource to read. See :class: |
必須 |
ソースコード位置: src/agents/mcp/server.py
MCPServerSseParams
Bases: TypedDict
Mirrors the params inmcp.client.sse.sse_client.
ソースコード位置: src/agents/mcp/server.py
timeout
instance-attribute
The timeout for the HTTP request. Defaults to 5 seconds.
sse_read_timeout
instance-attribute
The timeout for the SSE connection, in seconds. Defaults to 5 minutes.
auth
instance-attribute
Optional httpx authentication handler (e.g. httpx.BasicAuth, a custom
httpx.Auth subclass for OAuth token refresh, etc.). When provided, it is
passed directly to the underlying httpx.AsyncClient used by the SSE transport.
httpx_client_factory
instance-attribute
httpx_client_factory: NotRequired[HttpClientFactory]
Custom HTTP client factory for configuring httpx.AsyncClient behavior (e.g. to set custom SSL certificates, proxies, or other transport options).
MCPServerSse
Bases: _MCPServerWithClientSession
MCP server implementation that uses the HTTP with SSE transport. See the [spec] (https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse) for details.
ソースコード位置: src/agents/mcp/server.py
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | |
__init__
__init__(
params: MCPServerSseParams,
cache_tools_list: bool = False,
name: str | None = None,
client_session_timeout_seconds: float | None = 5,
tool_filter: ToolFilter = None,
use_structured_content: bool = False,
max_retry_attempts: int = 0,
retry_backoff_seconds_base: float = 1.0,
message_handler: MessageHandlerFnT | None = None,
require_approval: RequireApprovalSetting = None,
failure_error_function: ToolErrorFunction
| None
| _UnsetType = _UNSET,
tool_meta_resolver: MCPToolMetaResolver | None = None,
)
Create a new MCP server based on the HTTP with SSE transport.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
params
|
MCPServerSseParams
|
The params that configure the server. This includes the URL of the server, the headers to send to the server, the timeout for the HTTP request, and the timeout for the SSE connection. |
必須 |
cache_tools_list
|
bool
|
Whether to cache the tools list. If |
False
|
name
|
str | None
|
A readable name for the server. If not provided, we'll create one from the URL. |
None
|
client_session_timeout_seconds
|
float | None
|
the read timeout passed to the MCP ClientSession. |
5
|
tool_filter
|
ToolFilter
|
The tool filter to use for filtering tools. |
None
|
use_structured_content
|
bool
|
Whether to use |
False
|
max_retry_attempts
|
int
|
Number of times to retry failed list_tools/call_tool calls. Defaults to no retries. |
0
|
retry_backoff_seconds_base
|
float
|
The base delay, in seconds, for exponential backoff between retries. |
1.0
|
message_handler
|
MessageHandlerFnT | None
|
Optional handler invoked for session messages as delivered by the ClientSession. |
None
|
require_approval
|
RequireApprovalSetting
|
Approval policy for tools on this server. Accepts "always"/"never", a dict of tool names to those values, or an object with always/never tool lists. |
None
|
failure_error_function
|
ToolErrorFunction | None | _UnsetType
|
Optional function used to convert MCP tool failures into a model-visible error message. If explicitly set to None, tool errors will be raised instead of converted. If left unset, the agent-level configuration (or SDK default) will be used. |
_UNSET
|
tool_meta_resolver
|
MCPToolMetaResolver | None
|
Optional callable that produces MCP request metadata ( |
None
|
ソースコード位置: src/agents/mcp/server.py
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 | |
create_streams
Create the streams for the server.
ソースコード位置: src/agents/mcp/server.py
connect
async
Connect to the server.
ソースコード位置: src/agents/mcp/server.py
cleanup
async
Cleanup the server.
ソースコード位置: src/agents/mcp/server.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
list_tools
async
list_tools(
run_context: RunContextWrapper[Any] | None = None,
agent: AgentBase | None = None,
) -> list[Tool]
List the tools available on the server.
ソースコード位置: src/agents/mcp/server.py
call_tool
async
call_tool(
tool_name: str,
arguments: dict[str, Any] | None,
meta: dict[str, Any] | None = None,
) -> CallToolResult
Invoke a tool on the server.
ソースコード位置: src/agents/mcp/server.py
list_prompts
async
List the prompts available on the server.
ソースコード位置: src/agents/mcp/server.py
get_prompt
async
Get a specific prompt from the server.
ソースコード位置: src/agents/mcp/server.py
list_resources
async
List the resources available on the server.
ソースコード位置: src/agents/mcp/server.py
list_resource_templates
async
List the resource templates available on the server.
ソースコード位置: src/agents/mcp/server.py
read_resource
async
Read the contents of a specific resource by URI.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
uri
|
str
|
The URI of the resource to read. See :class: |
必須 |
ソースコード位置: src/agents/mcp/server.py
MCPServerStreamableHttpParams
Bases: TypedDict
Mirrors the params inmcp.client.streamable_http.streamablehttp_client.
ソースコード位置: src/agents/mcp/server.py
timeout
instance-attribute
The timeout for the HTTP request. Defaults to 5 seconds.
sse_read_timeout
instance-attribute
The timeout for the SSE connection, in seconds. Defaults to 5 minutes.
httpx_client_factory
instance-attribute
httpx_client_factory: NotRequired[HttpClientFactory]
Custom HTTP client factory for configuring httpx.AsyncClient behavior.
auth
instance-attribute
Optional httpx authentication handler (e.g. httpx.BasicAuth, a custom
httpx.Auth subclass for OAuth token refresh, etc.). When provided, it is
passed directly to the underlying httpx.AsyncClient used by the Streamable HTTP
transport.
ignore_initialized_notification_failure
instance-attribute
Whether to ignore failures when sending the best-effort
notifications/initialized POST.
Defaults to False. When set to True, initialized-notification failures are
logged and ignored so subsequent requests on the same transport can continue.
MCPServerStreamableHttp
Bases: _MCPServerWithClientSession
MCP server implementation that uses the Streamable HTTP transport. See the [spec] (https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) for details.
ソースコード位置: src/agents/mcp/server.py
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | |
session_id
property
The MCP session ID assigned by the server, or None if not yet connected or if the server did not issue a session ID.
The session ID is stable for the lifetime of this server instance's connection. You can persist it and pass it back via the Mcp-Session-Id request header (params["headers"]) on a new MCPServerStreamableHttp instance to resume the same server-side session across process restarts or stateless workers.
Example::
async with MCPServerStreamableHttp(params={"url": url}) as server:
session_id = server.session_id
# In a new worker / process:
async with MCPServerStreamableHttp(
params={"url": url, "headers": {"Mcp-Session-Id": session_id}}
) as server:
# Resumes the same server-side session.
...
__init__
__init__(
params: MCPServerStreamableHttpParams,
cache_tools_list: bool = False,
name: str | None = None,
client_session_timeout_seconds: float | None = 5,
tool_filter: ToolFilter = None,
use_structured_content: bool = False,
max_retry_attempts: int = 0,
retry_backoff_seconds_base: float = 1.0,
message_handler: MessageHandlerFnT | None = None,
require_approval: RequireApprovalSetting = None,
failure_error_function: ToolErrorFunction
| None
| _UnsetType = _UNSET,
tool_meta_resolver: MCPToolMetaResolver | None = None,
)
Create a new MCP server based on the Streamable HTTP transport.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
params
|
MCPServerStreamableHttpParams
|
The params that configure the server. This includes the URL of the server, the headers to send to the server, the timeout for the HTTP request, the timeout for the Streamable HTTP connection, whether we need to terminate on close, and an optional custom HTTP client factory. |
必須 |
cache_tools_list
|
bool
|
Whether to cache the tools list. If |
False
|
name
|
str | None
|
A readable name for the server. If not provided, we'll create one from the URL. |
None
|
client_session_timeout_seconds
|
float | None
|
the read timeout passed to the MCP ClientSession. |
5
|
tool_filter
|
ToolFilter
|
The tool filter to use for filtering tools. |
None
|
use_structured_content
|
bool
|
Whether to use |
False
|
max_retry_attempts
|
int
|
Number of times to retry failed list_tools/call_tool calls. Defaults to no retries. |
0
|
retry_backoff_seconds_base
|
float
|
The base delay, in seconds, for exponential backoff between retries. |
1.0
|
message_handler
|
MessageHandlerFnT | None
|
Optional handler invoked for session messages as delivered by the ClientSession. |
None
|
require_approval
|
RequireApprovalSetting
|
Approval policy for tools on this server. Accepts "always"/"never", a dict of tool names to those values, or an object with always/never tool lists. |
None
|
failure_error_function
|
ToolErrorFunction | None | _UnsetType
|
Optional function used to convert MCP tool failures into a model-visible error message. If explicitly set to None, tool errors will be raised instead of converted. If left unset, the agent-level configuration (or SDK default) will be used. |
_UNSET
|
tool_meta_resolver
|
MCPToolMetaResolver | None
|
Optional callable that produces MCP request metadata ( |
None
|
ソースコード位置: src/agents/mcp/server.py
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | |
create_streams
Create the streams for the server.
ソースコード位置: src/agents/mcp/server.py
connect
async
Connect to the server.
ソースコード位置: src/agents/mcp/server.py
cleanup
async
Cleanup the server.
ソースコード位置: src/agents/mcp/server.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
list_tools
async
list_tools(
run_context: RunContextWrapper[Any] | None = None,
agent: AgentBase | None = None,
) -> list[Tool]
List the tools available on the server.
ソースコード位置: src/agents/mcp/server.py
list_prompts
async
List the prompts available on the server.
ソースコード位置: src/agents/mcp/server.py
get_prompt
async
Get a specific prompt from the server.
ソースコード位置: src/agents/mcp/server.py
list_resources
async
List the resources available on the server.
ソースコード位置: src/agents/mcp/server.py
list_resource_templates
async
List the resource templates available on the server.
ソースコード位置: src/agents/mcp/server.py
read_resource
async
Read the contents of a specific resource by URI.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
uri
|
str
|
The URI of the resource to read. See :class: |
必須 |