Home/Tools/@tpmjs/tools-openapi-snippet-build

openapiSnippetBuildTool

@tpmjs/tools-openapi-snippet-build

Generates code snippets from OpenAPI operation definitions. Takes an operation object with method, path, and parameters, plus a target language. Returns a ready-to-use code snippet with necessary imports. Supports JavaScript, Python, cURL, and Go.

Official
engineering
v0.2.0
MIT

Interactive Playground

Test @tpmjs/tools-openapi-snippet-build (openapiSnippetBuildTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-openapi-snippet-build
pnpm add @tpmjs/tools-openapi-snippet-build
yarn add @tpmjs/tools-openapi-snippet-build
bun add @tpmjs/tools-openapi-snippet-build
deno add npm:@tpmjs/tools-openapi-snippet-build

2. Import the tool

import { openapiSnippetBuildTool } from '@tpmjs/tools-openapi-snippet-build';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { openapiSnippetBuildTool } from '@tpmjs/tools-openapi-snippet-build';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { openapiSnippetBuildTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Signature

(language: string, operation: { path: string; method: string; parameters: { in: string; name: string; type: string; example: {  }; required: boolean }[]; requestBody: Record<string, unknown> }) => Promise<unknown>

Tags

ai
api
build
code
code-generation
definitions
engineering
generates
method
object
openapi
operation
snippet
snippets
takes
tpmjs

Parameters

Available configuration options

Auto-extracted
operation
Required
Type: object

OpenAPI operation definition

language
Required
Type: string

Target language (javascript, python, curl, go)

Schema extracted: 3/1/2026, 4:26:41 AM

README

ERROR: No README data found!

Statistics

Downloads/month

6

GitHub Stars

0

Quality Score

73%

Bundle Size

NPM Keywords

tpmjs
engineering
ai
openapi
code-generation
api

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai