Skip to main content

LLM Integration

CTP provides specialized documents that enable AI models to generate compliant tools.

Available Documents

How It Works

  1. Copy the prompt from the Tool Generator page
  2. Paste into your AI conversation (Claude, GPT-4, etc.)
  3. Describe the tool you want to create
  4. Receive compliant code that follows CTP standards

Example Workflow

Step 1: Provide the Prompt

Copy the entire Tool Generator document and paste it into your AI conversation.

Step 2: Request a Tool

Create a URL encoder/decoder tool that:
- Encodes text for use in URLs
- Decodes URL-encoded strings back to text
- Supports encoding all characters or just special ones

Step 3: Receive Complete Implementation

The AI will generate:
  • TypeScript type definitions
  • Complete tool definition
  • Tool function implementation
  • Export statement

Quick Reference

For quick AI lookups during development, the Schema Reference provides:
  • Field types and descriptions
  • Parameter type options
  • Error codes
  • Category list
  • Common patterns

Supported AI Models

These documents are designed to work with:
ModelProviderNotes
Claude 3AnthropicBest results
Claude 3.5 SonnetAnthropicFast, accurate
GPT-4OpenAIGood results
GPT-4 TurboOpenAIGood results
Gemini ProGoogleCompatible

Best Practices

Be Specific

❌ "Make a text tool"
✅ "Create a tool that counts words, characters, and sentences in text"

Include Features

❌ "Make a hash tool"
✅ "Create a hash generator that supports SHA-256 and SHA-512, with hex and base64 output options"

Mention Edge Cases

❌ "Make a JSON formatter"
✅ "Create a JSON formatter with options for indentation, that handles invalid JSON gracefully with helpful error messages"

Integration Options

Manual Copy-Paste

  1. Copy the Tool Generator prompt
  2. Paste into AI chat
  3. Request your tool
  4. Copy generated code to your project

API Integration

import Anthropic from '@anthropic-ai/sdk';
import { TOOL_GENERATOR_PROMPT } from './prompts';

const client = new Anthropic();

async function generateTool(description: string) {
  const response = await client.messages.create({
    model: 'claude-3-5-sonnet-20241022',
    max_tokens: 4096,
    system: TOOL_GENERATOR_PROMPT,
    messages: [
      {
        role: 'user',
        content: `Create a CTP tool: ${description}`,
      },
    ],
  });

  return response.content[0].text;
}

MCP Integration

CTP tools can be exposed as MCP tools for direct AI access:
import { generateMCPManifest } from '@conveniencepro/ctp-discovery';

// Expose your tools to AI assistants
const manifest = generateMCPManifest(myTools);