Create a Client Tool
Scaffold an AtlasTool named $ARGUMENTS. If the app has no approved in-app useAtlasChat, implement a Fusion action via integrate-fusion-agent instead.
Prerequisite: vendored src/atlas-agent/ and @sinclair/typebox from integrate-atlas-chat.
Background
Client tools let the Atlas Agent invoke browser-side logic — charts, local state, UI panels, navigation. The agent decides when to call; the app executes and returns a result.
- Agent responds with a
clientToolaction - TypeBox validates the arguments
execute()runs in the browser and returns{ output, details }output(string) is sent back to the agentdetailsis available onmessage.toolCallsfor the UI to render
Step 1 — Understand the codebase
Before writing anything, read:
- The file where
useAtlasChatis called (oftensrc/App.tsxor a chat hook) to find wheretoolsis passed — imports are typically from./atlas-agent/reactafterintegrate-atlas-chat - Any existing tool definitions to match the file/naming conventions
Step 2 — Define the tool
Use Type from @sinclair/typebox for the parameters schema (compile-time types + runtime validation).
Adjust the ./atlas-agent/... path if the tool file is not directly under src/ next to the atlas-agent folder (for example ../atlas-agent/types from src/tools/).
TypeBox quick reference
Always add a description on the tool and on each parameter — the agent uses those strings.
Step 3 — Wire into useAtlasChat
Find the useAtlasChat call and add the tool to the tools array:
Step 4 — Render tool results (if needed)
If the tool returns structured details, render them in the message list.
message.toolCalls is a ToolCall[] — one entry per tool call (client-side and server-side) in call order.


