Libraries · Reference
Documentation Toolkit
An Effect AI toolkit contribution for searching and reading the same documentation catalog used by the application UI.
Last updated October 9, 2026
Overview
DocumentationToolkit defines fixed tools for searching and reading the localized documentation catalogue used by the application UI. DocumentationToolkitLayer({ docs, locale }) supplies their handlers. Model selection, chat transport, authentication, authorization, and persistence remain application-owned.
The tools describe their own workflow: searchDocumentation identifies exact paths, and readDocumentation reads those paths before answering documented behavior questions. Their descriptions tell the model to treat retrieved content as reference data rather than instructions, so no separate system prompt contribution is required.
Install
bunx shadcn@latest add @krak-stack/documentation-toolkitPackage consumers import from @krak-stack/registry/documentation-toolkit.
Compose With An Agent
import { Effect, Layer } from "effect";
import { Toolkit } from "effect/ai";
import { DocumentationToolkit, DocumentationToolkitLayer } from "@/lib/documentation-toolkit";
const toolkitDefinition = Toolkit.merge(application.toolkit, DocumentationToolkit);
const toolsLayer = Layer.mergeAll(
application.layer,
DocumentationToolkitLayer({ docs, locale: "en" }),
);
const toolkit = yield* toolkitDefinition.pipe(Effect.provide(toolsLayer));
const events = yield* agent.stream({
action: request.action,
history: request.history,
systemPrompt: application.systemPrompt,
toolkit,
});docs, application, agent, and request belong to the consuming application. docs and locale bind handlers to the intended catalogue and language. Definitions remain available synchronously for inspection and composition; their implementation is supplied separately through a layer. searchDocumentation returns ranked pages and headings; readDocumentation accepts one to three exact paths.