add-ai-chat-tool

Add server or client AI chat tools to the ryOS assistant using Zod schemas and handlers.

1.2k|181|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/ryokun6/ryos --skill add-ai-chat-tool
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-ai-chat-tool
Source: https://github.com/ryokun6/ryos/tree/main/.cursor/skills/add-ai-chat-tool
Command: npx skills add https://github.com/ryokun6/ryos --skill add-ai-chat-tool

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new capability to the ryOS AI assistant requires touching many files across the server and client, and it is easy to miss a step such as the dispatch switch case or the execution-side metadata. This Skill provides the complete file map, decision rules, and code patterns so a new chat tool works end to end on the first attempt.

Core Features & Use Cases

  • Server vs Client Decision Guide: Determines whether a tool needs a server-side execute function (Redis, secrets, server fetch) or a client-side handler (Zustand stores, IndexedDB, DOM, media playback).
  • Step-by-Step Implementation: Covers Zod schema definition, tool description and registration, execution metadata, client handler conventions, dispatch wiring, and server executors.
  • Testing and Checklist Guidance: Explains how to add schema unit tests and verify the tool end to end in the Chats app.
  • Use Case: You want Ryo to control a new app feature, such as listing and creating items in a store. Follow the Skill to add the schema, description, handler, and dispatch case so the AI can invoke the capability in chat.

Quick Start

Ask the AI to add a new chat tool named myFeatureControl following the add-ai-chat-tool skill, with list, create, and delete actions handled client-side.

Frequently Asked Questions about add-ai-chat-tool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new AI chat tool in ryOS?

Define a Zod schema in api/chat/tools/schemas.ts, add a description and tool entry in api/chat/tools/index.ts, then wire either a server executor or a client handler in src/apps/chats/tools with a dispatch switch case. The Skill provides code templates for each step.

Should a chat tool run on the server or the client?

Use server execution when the tool needs Redis, secrets, or server-side fetch, and client execution when it touches Zustand stores, IndexedDB, media playback, app windows, or the DOM. Some tools like stickiesControl run both ways for web chat and Telegram profiles.

Why does my new chat tool report unhandled tool?

The client dispatch is an explicit switch statement with no automatic registry. You must add a case for your tool name in the dispatch file, otherwise the call falls through to the default branch and reports an unhandled tool error.

How do I test a new AI chat tool?

Add a schema unit test that safeParses valid and invalid inputs under tests/unit, cover server executors through the AI endpoint suite, and verify client handlers by asking Ryo in the Chats app and confirming the store updates and tool result bubble.

Can a chat tool return images to the model?

Yes, server executors can return images by adding a toModelOutput function that converts the result into multimodal content, following the pattern used by infiniteMacControl's readScreen capability.