OpenAI was rejecting tool definitions with error "schema must be a JSON Schema of 'type: "object"'". This was caused by AI SDK v5 not properly converting Zod schemas to JSON Schema format. **Changes:** - Upgrade AI SDK from v5.0.104 to v6.0.0-beta.124 - Upgrade @ai-sdk/openai from v2.0.74 to v3.0.0-beta.22 - Upgrade Zod from v3.25.76 to v4.1.13 across all packages **AI SDK v6 breaking changes:** - Tool definition API: `parameters` renamed to `inputSchema` - Removed `aiTool()` wrapper - use plain object with description, inputSchema, execute - Streaming API: Use `textStream` async iterator instead of onChunk callback - Zod schemas now properly converted to JSON Schema for OpenAI **Zod v4 breaking changes:** - `z.record()` now requires two arguments: `z.record(keySchema, valueSchema)` - `z.enum()` params changed: `errorMap` removed, use `message` instead - Type system improvements require explicit type parameters - Fixed type errors in @tpmjs/env, @tpmjs/npm-client, @tpmjs/types **Files changed:** - apps/web/src/lib/ai-agent/tool-executor-agent.ts - Updated tool definition to use `inputSchema` instead of `parameters` - Removed `aiTool()` wrapper - Fixed streaming to use `textStream` iterator - packages/env/src/index.ts - Updated type constraint from `z.ZodRawShape` to `Record<string, z.ZodTypeAny>` - packages/npm-client/src/package.ts - Fixed `z.record()` calls to include both key and value schemas - Added type assertions for record indexing - packages/types/src/tpmjs.ts - Changed `errorMap` to `message` in z.enum() calls **Testing:** - ✅ Type-check passes - ✅ Production build succeeds - ✅ All routes compile correctly This fixes the tool execution error where OpenAI rejected tool schemas with invalid format. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
111 lines
3.5 KiB
JSON
111 lines
3.5 KiB
JSON
{
|
|
"name": "@tpmjs/createblogpost",
|
|
"version": "0.2.0",
|
|
"description": "A tool for creating structured blog posts with AI-generated content",
|
|
"type": "module",
|
|
"keywords": ["tpmjs-tool", "blog", "content", "ai", "writing"],
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
}
|
|
},
|
|
"files": ["dist"],
|
|
"scripts": {
|
|
"build": "tsup",
|
|
"dev": "tsup --watch",
|
|
"type-check": "tsc --noEmit",
|
|
"clean": "rm -rf dist .turbo"
|
|
},
|
|
"devDependencies": {
|
|
"@tpmjs/tsconfig": "workspace:*",
|
|
"tsup": "^8.3.5",
|
|
"typescript": "^5.9.3"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/ajaxdavis/tpmjs.git",
|
|
"directory": "packages/tools/createBlogPost"
|
|
},
|
|
"homepage": "https://tpmjs.com",
|
|
"license": "MIT",
|
|
"tpmjs": {
|
|
"category": "text-analysis",
|
|
"description": "Creates structured blog posts with customizable frontmatter, content sections, and SEO metadata. Supports multiple output formats including Markdown and MDX.",
|
|
"example": "const post = await createBlogPost({ title: 'My First Post', author: 'John Doe', content: 'Hello World!', tags: ['intro', 'blog'] });",
|
|
"parameters": [
|
|
{
|
|
"name": "title",
|
|
"type": "string",
|
|
"description": "The title of the blog post",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "author",
|
|
"type": "string",
|
|
"description": "The author of the blog post",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "content",
|
|
"type": "string",
|
|
"description": "The main content of the blog post",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "tags",
|
|
"type": "string[]",
|
|
"description": "Array of tags for categorization",
|
|
"required": false,
|
|
"default": []
|
|
},
|
|
{
|
|
"name": "format",
|
|
"type": "'markdown' | 'mdx'",
|
|
"description": "Output format for the blog post",
|
|
"required": false,
|
|
"default": "markdown"
|
|
},
|
|
{
|
|
"name": "excerpt",
|
|
"type": "string",
|
|
"description": "Short excerpt or summary of the post",
|
|
"required": false
|
|
}
|
|
],
|
|
"returns": {
|
|
"type": "BlogPost",
|
|
"description": "A structured blog post object with frontmatter, content, and metadata including slug, wordCount, readingTime, and formattedOutput"
|
|
},
|
|
"authentication": {
|
|
"required": false,
|
|
"type": "api-key"
|
|
},
|
|
"pricing": {
|
|
"model": "free"
|
|
},
|
|
"frameworks": ["vercel-ai", "langchain"],
|
|
"links": {
|
|
"documentation": "https://tpmjs.com/tools/createblogpost",
|
|
"repository": "https://github.com/ajaxdavis/tpmjs/tree/main/packages/tools/createBlogPost",
|
|
"homepage": "https://tpmjs.com"
|
|
},
|
|
"tags": ["blog", "content", "markdown", "mdx", "writing", "seo"],
|
|
"status": "stable",
|
|
"aiAgent": {
|
|
"useCase": "Use this tool when users need to generate blog posts, articles, or structured content with proper frontmatter and metadata. Ideal for content management systems, static site generators, and documentation sites.",
|
|
"limitations": "Does not include AI content generation - you must provide the content. Only formats and structures existing content.",
|
|
"examples": [
|
|
"Create a blog post about TypeScript best practices",
|
|
"Generate a tutorial post with code examples",
|
|
"Format an article with SEO metadata"
|
|
]
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"zod": "^4.1.13"
|
|
}
|
|
}
|