Skip to contents

Create an ellmer::ToolDef that reads content accepted for one decision stream and purpose chosen by the host application. The tool has no model-controlled arguments and never writes to the store. It evaluates eligible on every invocation before it looks up retained content.

Usage

graft_tool(store, stream, purpose, eligible, name = "recall_project_memory")

Arguments

store

A store returned by graft_store() or graft_store_postgres(). The handle remains private inside the tool.

stream

A decision stream chosen and controlled by the host application.

purpose

The consultation purpose to use for every invocation.

eligible

A required host-supplied function with no arguments. It must return whether the current consultation is allowed when called.

name

The ellmer tool name. Defaults to "recall_project_memory".

Value

An ellmer::ToolDef. Calling the tool returns an ellmer::ContentToolResult whose value is a JSON string.