create-client-tool
Create a Client Tool
Scaffold a new AtlasTool named $ARGUMENTS and wire it into the app.
Prerequisite
integrate-atlas-chat must already be complete: the app should vend the atlas-agent sources under src/atlas-agent/ (including react.ts) and have @sinclair/typebox, ajv, and ajv-formats installed as in that skill.
Background
Client tools let the Atlas Agent invoke logic that runs in the browser — rendering charts, querying local state, showing UI panels, triggering navigation, etc. The agent decides when to call the tool; the app executes it and returns a result.
The flow is:
- Agent responds with a
clientToolaction - The library validates the arguments against the TypeBox schema
execute()runs in the browser and returns{ output, details }output(string) is sent back to the agent as the tool resultdetails(any shape) is 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
Create the tool as a typed constant. Use Type from @sinclair/typebox to define the parameters schema — this gives both compile-time types and runtime validation (same stack as the vendored atlas-agent from integrate-atlas-chat).
import { Type } from "@sinclair/typebox";
import type { AtlasTool } from "./atlas-agent/types";
export const myTool: AtlasTool = {
name: "my_tool", // snake_case — this is what the agent uses to invoke it
description:
"One sentence describing what this tool does and when the agent should call it.",
parameters: Type.Object({
exampleParam: Type.String({ description: "What this param is for" }),
optionalNum: Type.Optional(Type.Number({ description: "..." })),
}),
execute: async (args) => {
// args is fully typed from the schema above
// Do the work here — call APIs, update state, render UI, etc.
return {
output: "Plain text summary sent back to the agent",
details: {
// Any structured data you want available in the UI via message.toolCalls
},
};
},
};
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
| Schema | Usage |
|---|---|
Type.String() |
string |
Type.Number() |
number |
Type.Boolean() |
boolean |
Type.Literal("foo") |
exact value |
Type.Union([Type.Literal("a"), Type.Literal("b")]) |
enum |
Type.Array(Type.String()) |
string[] |
Type.Object({ ... }) |
object |
Type.Optional(...) |
mark any field optional |
Always add a description to each field — the agent uses these to understand what to pass.
Step 3 — Wire into useAtlasChat
Find the useAtlasChat call and add the tool to the tools array:
const { messages, send, ... } = useAtlasChat({
client: isLoading ? null : sdk,
agentExternalId: AGENT_EXTERNAL_ID,
tools: [myTool], // add here
});
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.
{msg.toolCalls?.map((tc, i) => (
// tc.name — tool name
// tc.output — the string sent back to the agent
// tc.details — your structured data (cast to your known shape)
<MyToolOutput key={i} data={tc.details as MyToolDetails} />
))}
Done
The agent can now invoke $ARGUMENTS. Describe what it does clearly in the description
field — the agent relies on that string to decide when and how to call the tool.
More from cognitedata/builder-skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch for Claude Code or Cursor, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
37security
MUST be used whenever fixing security issues in a Flows app, or before shipping any feature that handles credentials, user input, or external data. This skill finds AND fixes security problems — it does not just report them. Do NOT skip this when the user asks for a security fix, security hardening, or vulnerability remediation — run every step in order. Triggers: security, security fix, security hardening, vulnerability, XSS, injection, credentials, secrets, auth, authentication, authorization, token, sensitive data, input validation, CORS, CSP, dependency audit.
36design
Unified Aura design guidance — components and tokens, page layouts, UX copy, forms and async feedback, and accessibility. Use when building or styling customer-facing UI, structuring pages, writing interface text, or implementing validation, loading, errors, and a11y.
36performance
MUST be used whenever fixing performance issues in a Flows app. This skill finds AND fixes performance problems — re-renders, inefficient queries, missing pagination, unbounded fetches, large bundles, and memory leaks. It does not just report them. Always measure before and after. Triggers: performance, slow, laggy, optimize, re-render, bundle size, load time, CDF query, large list, memory leak, debounce, virtualize, lazy load, code split.
36reveal-3d
Integrates a local Cognite Reveal 3D CAD viewer bundle into Flows apps by copying app-local source code. Use when adding 3D viewer, 3D visualization, Reveal, CAD model, RevealProvider, RevealCanvas, Reveal3DResources, FDM 3D mapping, asset 3D model, model browser, or Cognite 3D content to a Flows application.
36use-topbar
>-
36