Duyetbot Agent
Advanced

Custom MCP Tools

Add MCP tool: Create in packages/tools/src/. Export index.ts. Register registry.ts. Test Vitest.

TL;DR: packages/tools/src/my-tool.ts -> export index.ts -> register registry.ts. bun run test. ✅ MCP live.

Table of Contents

Tutorial

From contributing.md:

  1. Create tool packages/tools/src/my-tool.ts:
  2. Export packages/tools/src/index.ts
  3. Register packages/tools/src/registry.ts
  4. Test: bun run test --filter @duyetbot/tools

Snippet

import { tool } from '@anthropic/claude-sdk';
import { z } from 'zod';
 
export const myTool = tool(
  'my_tool',
  'Description of what it does',
  z.object({
    input: z.string().describe('Input parameter'),
  }),
  async ({ input }) => {
    // Implementation
    return { result: 'output' };
  }
);

MCP Context

CLAUDE.md: Model Context Protocol tools.

Quiz: Register where? A: packages/tools/src/registry.ts ✅

Pro Tip ✅: 10+ built-in tools.

CTA: Build tool -> Fork/PR

Contrib: "Added X MCP tool via Y!"

Next: Build Custom Agent ->

On this page