Add 'aiui/' from commit 'e30ac1d1069532fb6d652d87e2d4a2fe9d1b4773'
git-subtree-dir: aiui git-subtree-mainline:0c4826f8ccgit-subtree-split:e30ac1d106
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: add-tool
|
||||
description: Add a new AI tool (function call) to the Claude proxy for the AI to use
|
||||
allowed-tools: Bash(*), Read, Edit, Write, Glob, Grep
|
||||
---
|
||||
|
||||
Add a new tool that the AI model can call via Claude's tool_use API. The user will describe what the tool should do (e.g., "search local files", "get app status", "browse media").
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Read the proxy**: Read `packages/app/server/claude-proxy.ts` to understand the existing tool_use loop and `SEARCH_WEB_TOOL` definition.
|
||||
|
||||
2. **Define the tool**: Add a new tool definition following the Claude tool_use format:
|
||||
```ts
|
||||
const NEW_TOOL = {
|
||||
name: 'tool_name',
|
||||
description: 'What this tool does...',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
properties: { ... },
|
||||
required: [...]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Add handler**: In the tool_use loop (where `search_web` calls are handled), add a handler for the new tool name.
|
||||
|
||||
4. **Implement backend**: If the tool needs a new API endpoint (e.g., `/api/media/scan`), create a Vite plugin or add a route to the proxy.
|
||||
|
||||
5. **Update system prompt**: Add instructions in `useAI.ts` SYSTEM_PROMPT telling the AI when and how to use the new tool.
|
||||
|
||||
6. **Verify**: Run `pnpm typecheck` and test the proxy starts without errors.
|
||||
Reference in New Issue
Block a user