nat.plugins.mcp.tool#

Attributes#

Classes#

MCPToolConfig

Function which connects to a Model Context Protocol (MCP) server and wraps the selected tool as a NeMo Agent toolkit

Functions#

mcp_tool_function(→ nat.builder.function_info.FunctionInfo)

Create a NeMo Agent toolkit function from an MCP tool.

mcp_tool(config, builder)

Generate a NeMo Agent Toolkit Function that wraps a tool provided by the MCP server.

Module Contents#

logger#
class MCPToolConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionBaseConfig

Function which connects to a Model Context Protocol (MCP) server and wraps the selected tool as a NeMo Agent toolkit function.

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.

url: pydantic.HttpUrl | None = None#
mcp_tool_name: str = None#
transport: Literal['sse', 'stdio', 'streamable-http'] = None#
command: str | None = None#
args: list[str] | None = None#
env: dict[str, str] | None = None#
description: str | None = None#
validate_model()#

Validate that stdio and SSE/Streamable HTTP properties are mutually exclusive.

mcp_tool_function(
tool: nat.plugins.mcp.client_base.MCPToolClient,
) nat.builder.function_info.FunctionInfo#

Create a NeMo Agent toolkit function from an MCP tool.

Args:

tool: The MCP tool to wrap

Returns:

The NeMo Agent toolkit function

async mcp_tool(config: MCPToolConfig, builder: nat.builder.builder.Builder)#

Generate a NeMo Agent Toolkit Function that wraps a tool provided by the MCP server.