Interface ToolFactory


public interface ToolFactory
SPI for contributing a single built-in tool to the agent runtime.

Each factory is responsible for one tool name. Implementations are discovered via ServiceLoader. Each tool module ships a file:

   META-INF/services/ai.mindconnect.agent.tool.ToolFactory
 
containing the fully-qualified class names of every factory it provides (one per line).

Lifecycle:

  1. The runtime instantiates each factory via its public no-arg constructor.
  2. bind(ToolEnvironment) is called exactly once with the runtime environment so the factory can capture only the dependencies it needs.
  3. isAvailable() is consulted to decide whether the factory can serve requests at all (e.g. a missing API key may disable a tool).
  4. create(AgentTool, ToolCallScope) is invoked per tool resolution.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Called once after construction to wire the factory against the runtime environment.
    create(AgentTool agentTool, ToolCallScope scope)
    Build a tool for the given configuration and call scope.
    default String
    Rubric under which this tool is shown in catalogs and pickers (e.g.
    default boolean
    Whether this factory has everything it needs to produce a working tool.
    Unique tool name this factory produces (e.g.
    default Map<String,Object>
    JSON-Schema-shaped description of the config overrides this tool understands in AgentTool.overrides() — operator-level settings the LLM never sees (e.g.
  • Method Details

    • name

      String name()
      Unique tool name this factory produces (e.g. "web_search").
    • group

      default String group()
      Rubric under which this tool is shown in catalogs and pickers (e.g. "web", "documents", "files"). Lowercase; UIs capitalize for display. Most built-in names already follow the group_name convention (e.g. web_search). Default "general".
    • bind

      default void bind(ToolEnvironment env)
      Called once after construction to wire the factory against the runtime environment. Default implementation does nothing; override to grab services or configuration from env.
    • isAvailable

      default boolean isAvailable()
      Whether this factory has everything it needs to produce a working tool. Defaults to true; override to disable the factory when required configuration is missing.
    • overridesSchema

      default Map<String,Object> overridesSchema()
      JSON-Schema-shaped description of the config overrides this tool understands in AgentTool.overrides() — operator-level settings the LLM never sees (e.g. baseDir for file-rooted tools, network for code execution). Admin UIs render this so overrides are discoverable instead of doc-only knowledge. The reserved params override (parameter pinning) is a framework feature and not listed here. Default: no overrides.
    • create

      Tool create(AgentTool agentTool, ToolCallScope scope)
      Build a tool for the given configuration and call scope.