nat.plugins.mcp.client.fastapi_routes#
FastAPI routes for MCP client tool listing.
Attributes#
Classes#
Information about a single MCP tool. |
|
Response model for the MCP client tool list endpoint. |
Functions#
|
Collect MCP client tool information from all function groups. |
|
Add MCP client tool list endpoints to the FastAPI app. |
Module Contents#
- logger#
- class MCPToolInfo(/, **data: Any)#
Bases:
pydantic.BaseModelInformation about a single MCP tool.
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.selfis explicitly positional-only to allowselfas a field name.
- class MCPClientToolListResponse(/, **data: Any)#
Bases:
pydantic.BaseModelResponse model for the MCP client tool list endpoint.
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.selfis explicitly positional-only to allowselfas a field name.
- async _collect_mcp_client_tool_list(
- function_groups: dict[str, nat.builder.function.FunctionGroup],
Collect MCP client tool information from all function groups.
Iterates over function groups, identifies MCP client groups, checks session health, and builds a list of tool information including availability status.
- async add_mcp_client_tool_list_route(
- app: fastapi.FastAPI,
- builder: nat.builder.workflow_builder.WorkflowBuilder,
- session_managers: list[nat.runtime.session.SessionManager],
Add MCP client tool list endpoints to the FastAPI app.
Registers two GET routes: -
/mcp/client/tool/listfor shared workflows. -/mcp/client/tool/list/per_userfor per-user workflows.