| name | add-tool |
| description | Scaffold a new Pi SDK tool for the YuBot agent runtime with TypeBox schema, implementation, and tests |
| invocation | user |
| user_invocation | /add-tool |
Add Tool Skill
Scaffold a new tool for the YuBot agent runtime (Pi SDK).
Inputs
The user provides:
- Tool name (snake_case, e.g.,
get_user_profile)
- Description (what the tool does)
- Parameters (name, type, description for each)
- Return type (what the tool returns)
Generated Files
1. Tool Implementation
Create packages/agent-runtime/src/tools/{tool_name}.ts:
import { Type, Static } from '@sinclair/typebox';
import { Tool } from '../types';
export const {ToolName}Schema = Type.Object({
});
export type {ToolName}Input = Static<typeof {ToolName}Schema>;
const {toolName}Tool: Tool = {
name: '{tool_name}',
description: '{description}',
schema: {ToolName}Schema,
async execute(input: {ToolName}Input, { db, abortSignal }) {
throw new Error('Not implemented');
},
};
export default {toolName}Tool;
2. Test File
Create packages/agent-runtime/src/tools/{tool_name}.test.ts:
import { describe, it, expect, vi } from 'vitest';
import {toolName}Tool from './{tool_name}';
describe('{tool_name}', () => {
it('should have correct name and schema', () => {
expect({toolName}Tool.name).toBe('{tool_name}');
expect({toolName}Tool.schema).toBeDefined();
});
it('should execute successfully with valid input', async () => {
});
it('should handle abort signal', async () => {
});
});
3. Register in Tool Index
Add the tool to packages/agent-runtime/src/tools/index.ts:
import {toolName}Tool from './{tool_name}';
After Scaffolding
- Run
bun --filter agent-runtime typecheck to verify types
- Implement the
execute function
- Fill in test cases
- Run
bun --filter agent-runtime test to verify