fabricatio_tool.rust

Classes

CheckConfig

Configuration for checks, specifying the mode and target items.

MCPManager

Python-exposed MCP manager.

ToolMetaData

Python representation of tool metadata.

Functions

gather_violations(→ list[str])

Gathers violations in the provided source code based on the given configuration.

treeview(→ str)

Generates a tree-like string representation of a directory structure.

Package Contents

class fabricatio_tool.rust.CheckConfig

Configuration for checks, specifying the mode and target items.

class fabricatio_tool.rust.MCPManager

Python-exposed MCP manager.

static create(server_configs: dict) Any

Creates a new MCP manager instance.

Parameters:

server_configs – Python dictionary containing server configurations.

Returns:

An awaitable that resolves to a new MCPManager instance.

list_tools(client_id: str) Any

Retrieves list of tools from a client.

Parameters:

client_id – The ID of the client.

Returns:

An awaitable that resolves to a list of ToolMetaData objects.

get_tool(client_id: str, tool_name: str) Any

Retrieves a tool from a client.

Parameters:
  • client_id – The ID of the client.

  • tool_name – The name of the tool.

Returns:

An awaitable that resolves to a ToolMetaData object or None.

list_tool_names(client_id: str) Any

Retrieves a list of tool names from a client.

Parameters:

client_id – The ID of the client to retrieve tools from.

Returns:

An awaitable that resolves to a list of tool names.

description_mapping(client_id: str) Any

Retrieves a mapping of tool names to their descriptions from a client.

Parameters:

client_id – The ID of the client.

Returns:

An awaitable that resolves to a dict mapping tool names to descriptions.

server_list() list[str]

Returns a list of all server names currently managed by the MCP manager.

Returns:

A list of server names.

server_count() int

Returns the number of servers currently managed by the MCP manager.

Returns:

The number of servers.

ping(client_id: str) Any

Checks if a client is still connected and responsive.

Parameters:

client_id – The ID of the client to ping.

Returns:

An awaitable that resolves to True if connected, False otherwise.

call_tool(client_id: str, tool_name: str, arguments: dict | None) Any

Executes a tool on a client and returns the result.

Parameters:
  • client_id – The ID of the client.

  • tool_name – The name of the tool to execute.

  • arguments – Optional dictionary of tool arguments.

Returns:

An awaitable that resolves to a list of result strings.

has_client(client_id: str) bool

Checks if a client exists in the manager.

Parameters:

client_id – The ID of the client to check.

Returns:

True if the client exists, False otherwise.

has_tool(client_id: str, tool_name: str) Any

Checks if a tool exists for a specific client.

Parameters:
  • client_id – The ID of the client.

  • tool_name – The name of the tool to check.

Returns:

An awaitable that resolves to True if the tool exists, False otherwise.

class fabricatio_tool.rust.ToolMetaData

Python representation of tool metadata.

property name: str

Returns the name of the tool.

Returns:

The tool name as a string.

property description: str

Returns the description of the tool.

Returns:

The tool description as a string.

property input_schema: Any

Returns the input schema as a Python object.

Returns:

The input schema as a Python object.

property input_schema_string: str

Returns the input schema as a JSON string.

Returns:

The input schema as a JSON string.

property annotations: Any

Returns the annotations as a Python object.

Returns:

The annotations as a Python object.

property annotations_string: str

Returns the annotations as a JSON string.

Returns:

The annotations as a JSON string.

property function_header: str

Returns the function signature header.

Returns:

The function signature as a string.

property function_docstring: str

Returns the function docstring.

Returns:

The function docstring as a string.

property function_string: str

Returns the complete function string with header and docstring.

Returns:

The complete function definition as a string.

dump_dict() Any

Serializes the tool metadata to a Python dictionary.

Returns:

A Python dictionary representation of the tool metadata.

fabricatio_tool.rust.gather_violations(source: str, modules: CheckConfig | None = None, imports: CheckConfig | None = None, calls: CheckConfig | None = None) list[str]

Gathers violations in the provided source code based on the given configuration.

fabricatio_tool.rust.treeview(directory: str | os.PathLike | pathlib.Path | None = None, max_depth: int = 10) str

Generates a tree-like string representation of a directory structure.

Skips hidden files and respects .gitignore.

Parameters:
  • directory – Root path to visualize (default: current directory).

  • max_depth – Maximum depth to traverse (default: 10).

Returns:

A formatted string resembling the Unix tree command output.