nat.front_ends.mcp.tool_converter#
Attributes#
Functions#
|
Create a wrapper function that exposes the actual parameters of a NAT Function as an MCP tool. |
|
Retrieve a human-readable description for a NAT function or workflow. |
|
Register a NAT Function as an MCP tool. |
Module Contents#
- logger#
- create_function_wrapper(
- function_name: str,
- function: nat.builder.function_base.FunctionBase,
- schema: type[pydantic.BaseModel],
- is_workflow: bool = False,
Create a wrapper function that exposes the actual parameters of a NAT Function as an MCP tool.
- Args:
function_name: The name of the function/tool function: The NAT Function object schema: The input schema of the function is_workflow: Whether the function is a Workflow
- Returns:
A wrapper function suitable for registration with MCP
- get_function_description(
- function: nat.builder.function_base.FunctionBase,
Retrieve a human-readable description for a NAT function or workflow.
- The description is determined using the following precedence:
If the function is a Workflow and has a ‘description’ attribute, use it.
If the Workflow’s config has a ‘topic’, use it.
If the Workflow’s config has a ‘description’, use it.
If the function is a regular Function, use its ‘description’ attribute.
- Args:
function: The NAT FunctionBase instance (Function or Workflow).
- Returns:
The best available description string for the function.
- register_function_with_mcp(
- mcp: mcp.server.fastmcp.FastMCP,
- function_name: str,
- function: nat.builder.function_base.FunctionBase,
Register a NAT Function as an MCP tool.
- Args:
mcp: The FastMCP instance function_name: The name to register the function under function: The NAT Function to register