add-ai-chat-tool
Installation
SKILL.md
Adding an AI Chat Tool
ryOS chat tools follow the Vercel AI SDK tool-loop pattern. A tool is defined on the server (name + description + Zod inputSchema), and is either:
- Server-executed — has an
executefn that runs inapi/chat/tools/(needs Redis, secrets, server fetch). Add the name toSERVER_EXECUTED_TOOL_NAMES. - Client-executed — has no
execute. The model emits a tool call, the browser runs a handler insrc/apps/chats/tools/, and the result is sent back viaaddToolOutput(needs Zustand stores, IndexedDB, media/DOM APIs).
File Map
| Concern | File |
|---|---|
| Server: input schemas (Zod) | api/chat/tools/schemas.ts |
| Server: descriptions + tool object + profile filtering | api/chat/tools/index.ts (TOOL_DESCRIPTIONS, createChatTools) |
| Server: shared types/constants | api/chat/tools/types.ts |
Server: execute logic |
api/chat/tools/executors.ts, app-state-executors.ts, maps-executor.ts |
| Server/client: execution split source of truth | src/shared/tools/serverExecuted.ts |
| Client: per-tool handlers | src/apps/chats/tools/<name>Handler.ts |
| Client: handler types/registry | src/apps/chats/tools/types.ts, index.ts |
Client: dispatch (switch on tool name) |
src/apps/chats/hooks/useAiChat.ts |