Skip to content

Conversation

@ianjkaplan
Copy link
Collaborator

@ianjkaplan ianjkaplan commented Sep 1, 2025

Add AI Tools Plugin

TL;DR

Added a new AI tools plugin that generates structured tool definitions from OpenAPI operations for integration with AI systems that support tool calling.

What changed?

  • Added documentation for the new AI tools plugin in the README
  • Included features of the AI tools plugin:
    • Generates tool definitions for each OpenAPI operation
    • Uses Zod schemas for parameter validation
    • Compatible with OpenAI function calling format
    • Maintains type safety with TypeScript types
    • Includes operation descriptions as tool documentation
  • Added installation instructions for the required @openai/agents package
  • Added usage example showing how to configure and use the tools plugin
  • Updated the configuration example to include the tools plugin

How to test?

  1. Install the required dependency:

    pnpm install @openai/agents
  2. Add the tools plugin to your configuration:

    import { tools } from "@pushpress/openapi-ts-plugins";
    
    export default defineConfig({
      // ...
      plugins: [
        // ...
        tools.defineConfig(),
      ],
    });
  3. Import and use the generated tools with OpenAI's agent:

    import { getUserTool, createUserTool } from "./client/tools";
    import { Agent } from "@openai/agents";
    
    const agent = new Agent({
      name: "Travel assistant",
      tools: [tool(getUserTool), tool(createUserTool)],
    });

Why make this change?

This plugin makes it easier to integrate OpenAPI-defined APIs with AI systems that support tool calling, such as OpenAI's function calling. By automatically generating structured tool definitions from OpenAPI operations, developers can quickly enable their APIs to be used by AI agents without manual schema definition work.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianjkaplan ianjkaplan marked this pull request as ready for review September 1, 2025 17:32
@ianjkaplan ianjkaplan merged commit 355adb3 into main Sep 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants