aiq.front_ends.mcp.tool_converter#
Attributes#
Functions#
|
Create a wrapper function that exposes the actual parameters of an AIQ Function as an MCP tool. |
|
Retrieve a human-readable description for an AIQ function or workflow. |
|
Register an AIQ Function as an MCP tool. |
Module Contents#
- logger#
- create_function_wrapper(
- function_name: str,
- function: aiq.builder.function_base.FunctionBase,
- schema: type[pydantic.BaseModel],
- is_workflow: bool = False,
Create a wrapper function that exposes the actual parameters of an AIQ Function as an MCP tool.
- Args:
function_name: The name of the function/tool function: The AIQ 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: aiq.builder.function_base.FunctionBase,
Retrieve a human-readable description for an AIQ 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 AIQ 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: aiq.builder.function_base.FunctionBase,
Register an AIQ Function as an MCP tool.
- Args:
mcp: The FastMCP instance function_name: The name to register the function under function: The AIQ Function to register