tpmjs/packages/tools/hello
Ajax Davis 0612eac5e2 feat: implement multi-tool package architecture with manual tool registry
BREAKING CHANGE: Complete refactoring from single-tool to multi-tool package support

Database Schema:
- Split Tool model into Package (1) and Tool (many) with one-to-many relationship
- Package stores npm metadata and package-level tpmjs fields (category, env, frameworks, tier)
- Tool stores individual tool exports with tool-level metadata (exportName, description, parameters, returns, aiAgent)
- Unique constraint on (packageId, exportName) to prevent duplicate tools
- Cascade deletes when packages are removed

Type System:
- Updated tpmjs field schema to support tools array
- Each tool has exportName, description, parameters, returns, aiAgent
- Package-level fields: category, env, frameworks shared across all tools
- Backward compatible with legacy single-tool format (auto-migrates to exportName: "default")

API Updates:
- Updated all /api/tools routes to query Tool model with Package relations
- Updated /api/tools/[slug] to accept package/export path segments
- Updated tool-executor-agent to use actual exportName instead of hardcoded "default"
- Updated metrics sync to calculate quality scores per Tool

Frontend Updates:
- Updated tool search page to display exportName as primary heading
- Updated tool detail pages to show package name as secondary info
- Removed tag-based filtering (tags moved to package level)

Manual Tool Registry:
- Added manual-tools.ts with 23 curated tools from major providers
- Created sync-manual-tools.ts script to sync manual tools to database
- Added MANUAL_TOOLS.md documentation for manual tool system
- Added GitHub workflow for automated daily sync
- Includes tools from: Vercel, Exa, Firecrawl, AWS Bedrock, Perplexity, Tavily, Superagent, Valyu

Playground Updates:
- Updated tool loader to load multiple tools per package
- Added sanitizeToolName for OpenAI API compatibility

Sync System Updates:
- Updated changes feed sync to handle multi-tool packages
- Updated keyword sync to upsert multiple tools per package
- Added orphaned tool deletion when tools removed from package.json

Migration Strategy:
- Database uses same Neon instance for dev and prod
- Schema updated via prisma db push (no migration files yet)
- All data repopulates from npm via sync system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 06:39:58 +10:00
..
src feat: implement playground app with AI SDK v6 tool execution 2025-12-04 02:51:02 +10:00
CHANGELOG.md feat: implement multi-tool package architecture with manual tool registry 2025-12-04 06:39:58 +10:00
package.json feat: implement multi-tool package architecture with manual tool registry 2025-12-04 06:39:58 +10:00
README.md feat: implement playground app with AI SDK v6 tool execution 2025-12-04 02:51:02 +10:00
tsconfig.json feat: implement playground app with AI SDK v6 tool execution 2025-12-04 02:51:02 +10:00

@tpmjs/hello

Simple example TPMJS tools for AI SDK v6 - demonstrates how to create tools that work with AI agents.

Tools

helloWorldTool

Returns a simple "Hello, World!" greeting with a timestamp.

Parameters: None

Returns:

{
  "message": "Hello, World!",
  "timestamp": "2024-12-04T..."
}

helloNameTool

Returns a personalized greeting with the provided name.

Parameters:

  • name (string, required): The name of the person to greet

Returns:

{
  "message": "Hello, John!",
  "timestamp": "2024-12-04T..."
}

Usage

With AI SDK v6

import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { helloWorldTool, helloNameTool } from '@tpmjs/hello';

const result = streamText({
  model: openai('gpt-4o-mini'),
  messages: [{ role: 'user', content: 'Say hello to Alice' }],
  tools: {
    helloWorld: helloWorldTool,
    helloName: helloNameTool,
  },
});

Template for Creating TPMJS Tools

This package serves as a template for creating your own TPMJS tools. Key requirements:

  1. Use AI SDK v6 Beta (ai@6.0.0-beta.124)
  2. Use Zod 4 for parameter validation
  3. Export tool objects with description, parameters, and execute
  4. Add TPMJS metadata to package.json:
    "tpmjs": {
      "category": "text-analysis",
      "description": "Your tool description"
    }
    
  5. Include the tpmjs-tool keyword in package.json

Development

# Build
pnpm build

# Type check
pnpm type-check

# Watch mode
pnpm dev