Phantom.Tool (phantom v0.1.0)

View Source

The Model Context Protocol (MCP) allows servers to expose tools that can be invoked by language models. Tools enable models to interact with external systems, such as querying databases, calling APIs, or performing computations. Each tool is uniquely identified by a name and includes metadata describing its schema.

https://modelcontextprotocol.io/specification/2025-03-26/server/tools

Summary

Types

json()

@type json() :: %{
  :name => String.t(),
  :description => String.t(),
  :inputSchema => Phantom.Tool.InputSchema.json(),
  optional(:annotations) => Phantom.Tool.Annotation.json()
}

t()

@type t() :: %Phantom.Tool{
  annotations: Phantom.Tool.Annotation.t(),
  description: String.t(),
  function: atom(),
  handler: module(),
  input_schema: Phantom.Tool.InputSchema.t(),
  name: String.t()
}

Functions

build(attrs)

to_json(tool)