Mcpixir.Agents.MCPAgent (Mcpixir v0.1.0)

View Source

Agent implementation that integrates LLMs with MCP tools.

Summary

Functions

Creates a new MCP agent with the given configuration.

Prepares the agent by initializing the LLM client and loading tools.

Runs a query using the agent.

Directly executes a tool using the agent.

Types

t()

@type t() :: %Mcpixir.Agents.MCPAgent{
  client: Mcpixir.Client.t(),
  config: Mcpixir.Config.t(),
  intermediate_steps: [Mcpixir.IntermediateStep.t()],
  llm_client: Mcpixir.LLMClient.t(),
  messages: [Mcpixir.Message.t()],
  sessions: [Mcpixir.Session.t()],
  tools: [Mcpixir.Tool.t()]
}

Functions

new(config)

@spec new(map()) :: {:ok, t()}

Creates a new MCP agent with the given configuration.

prepare(agent)

@spec prepare(t()) :: {:ok, t()} | {:error, String.t()}

Prepares the agent by initializing the LLM client and loading tools.

run(agent, query)

@spec run(t(), String.t()) :: {:ok, String.t(), t()}

Runs a query using the agent.

run_tool(agent, tool_name, args)

@spec run_tool(t(), String.t(), map()) :: {:ok, any()} | {:error, any()}

Directly executes a tool using the agent.