dataflow.api.routes.tools_routes_fixed¶

Tools API routes using the unified discovery system.

This module provides FastAPI routes for discovering and listing all available tools in the Haive ecosystem using the haive-core discovery system.

Classes¶

ToolInfo

Information about a tool.

ToolInvokeRequest

Request to invoke a tool.

ToolInvokeResponse

Response from tool invocation.

ToolSchema

Tool input/output schema information.

ToolsListResponse

Response for tools list endpoint.

Functions¶

component_to_tool_info(component)

Convert a ComponentInfo to ToolInfo.

discover_all_tools([force_refresh])

Discover all tools using the unified discovery system.

discover_tools_fallback()

Fallback tool discovery if the main discovery fails.

get_discovery_instance()

Get or create the discovery instance.

get_tool_categories()

Get all available tool categories and their tools.

get_tool_details(tool_name)

Get detailed information about a specific tool.

get_tool_schema_endpoint(tool_name)

Get the input/output schema for a specific tool.

get_tool_stats()

Get summary statistics about discovered tools.

invoke_tool_endpoint(request)

Invoke a tool with the provided arguments.

list_tools([force_refresh])

List all available tools.

refresh_tool_cache()

Refresh the tool discovery cache.

search_tools([query, category, tool_type])

Search for tools by query, category, or type.

Module Contents¶

class dataflow.api.routes.tools_routes_fixed.ToolInfo(/, **data)¶

Bases: pydantic.BaseModel

Information about a 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.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class dataflow.api.routes.tools_routes_fixed.ToolInvokeRequest(/, **data)¶

Bases: pydantic.BaseModel

Request to invoke a 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.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class dataflow.api.routes.tools_routes_fixed.ToolInvokeResponse(/, **data)¶

Bases: pydantic.BaseModel

Response from tool invocation.

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.

Parameters:

data (Any)

class dataflow.api.routes.tools_routes_fixed.ToolSchema(/, **data)¶

Bases: pydantic.BaseModel

Tool input/output schema information.

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.

Parameters:

data (Any)

class dataflow.api.routes.tools_routes_fixed.ToolsListResponse(/, **data)¶

Bases: pydantic.BaseModel

Response for tools 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.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

dataflow.api.routes.tools_routes_fixed.component_to_tool_info(component)¶

Convert a ComponentInfo to ToolInfo.

Parameters:

component (haive.dataflow.api.routes.utils.haive_discovery.ComponentInfo)

Return type:

ToolInfo

dataflow.api.routes.tools_routes_fixed.discover_all_tools(force_refresh=False)¶

Discover all tools using the unified discovery system.

Parameters:

force_refresh (bool)

Return type:

list[haive.dataflow.api.routes.utils.haive_discovery.ComponentInfo]

dataflow.api.routes.tools_routes_fixed.discover_tools_fallback()¶

Fallback tool discovery if the main discovery fails.

Return type:

list[haive.dataflow.api.routes.utils.haive_discovery.ComponentInfo]

dataflow.api.routes.tools_routes_fixed.get_discovery_instance()¶

Get or create the discovery instance.

Return type:

haive.dataflow.api.routes.utils.haive_discovery.HaiveComponentDiscovery

async dataflow.api.routes.tools_routes_fixed.get_tool_categories()¶

Get all available tool categories and their tools.

Returns:

Dictionary mapping categories to tool names

Return type:

dict[str, list[str]]

async dataflow.api.routes.tools_routes_fixed.get_tool_details(tool_name)¶

Get detailed information about a specific tool.

Parameters:

tool_name (str) – Name of the tool to get details for

Returns:

Detailed information about the tool

Return type:

dict[str, Any]

async dataflow.api.routes.tools_routes_fixed.get_tool_schema_endpoint(tool_name)¶

Get the input/output schema for a specific tool.

Parameters:

tool_name (str) – Name of the tool to get schema for

Returns:

ToolSchema containing input and output schemas

Return type:

ToolSchema

async dataflow.api.routes.tools_routes_fixed.get_tool_stats()¶

Get summary statistics about discovered tools.

Returns:

Summary statistics

Return type:

dict[str, Any]

async dataflow.api.routes.tools_routes_fixed.invoke_tool_endpoint(request)¶

Invoke a tool with the provided arguments.

Parameters:

request (ToolInvokeRequest) – Tool invocation request with tool name and arguments

Returns:

ToolInvokeResponse with the result or error

Return type:

ToolInvokeResponse

async dataflow.api.routes.tools_routes_fixed.list_tools(force_refresh=False)¶

List all available tools.

Parameters:

force_refresh (bool) – Force refresh the tool cache

Returns:

ToolsListResponse containing list of available tools and total count

Return type:

ToolsListResponse

async dataflow.api.routes.tools_routes_fixed.refresh_tool_cache()¶

Refresh the tool discovery cache.

Returns:

Status and count of discovered tools

Return type:

dict[str, Any]

async dataflow.api.routes.tools_routes_fixed.search_tools(query=None, category=None, tool_type=None)¶

Search for tools by query, category, or type.

Parameters:
  • query (str | None) – Search query to match against tool names and descriptions

  • category (str | None) – Filter by category (e.g., ‘search’, ‘development’, ‘database’)

  • tool_type (str | None) – Filter by type (‘tool’ or ‘toolkit’)

Returns:

ToolsListResponse containing filtered list of tools

Return type:

ToolsListResponse