OpenAPI to Agent Tools Converter avatar

OpenAPI to Agent Tools Converter

Pricing

from $5.00 / 1,000 spec converteds

Go to Apify Store
OpenAPI to Agent Tools Converter

OpenAPI to Agent Tools Converter

Pricing

from $5.00 / 1,000 spec converteds

Rating

0.0

(0)

Developer

Nadim Hider

Nadim Hider

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Share

OpenAPI and Swagger to Agent Tools Converter API

Instantly and deterministically transform any OpenAPI 2.0/3.0/3.1 or Swagger specification into production ready tool calling definitions for autonomous agents. Supports OpenAI Function Calling, Anthropic Tool Use, Google Gemini Function Declarations, and Model Context Protocol (MCP) server schemas in one pass.

Key Capabilities

  • Multi Framework Native: Simultaneously generates schemas tailored for OpenAI, Anthropic Claude, Google Gemini, and Model Context Protocol (MCP).
  • Strict Schema Support: Enables additionalProperties: false and strict JSON schemas compatible with OpenAI Structured Outputs.
  • Deep Parameter Extraction: Parses path variables, query parameters, headers, and complex nested request bodies into typed tool schemas.
  • Deterministic and Zero External Cost: 100% algorithmic parsing via syntax tree reconstruction without LLM calls or token overhead.
  • Agent Ready Output: Delivers clean tool definitions alongside Markdown endpoint summaries for prompt injection.

Pricing

  • Pay-Per-Event (PPE): $0.005 per specification converted ($5.00 per 1,000 specifications).
  • Compute fee waived for fast executions.

Input Parameters

ParameterTypeRequiredDefaultDescription
itemsArrayYesSample Petstore APIList of OpenAPI/Swagger specs as JSON objects or YAML/JSON strings.
target_formatsArrayNo["openai", "anthropic", "gemini", "mcp"]Formats to generate for autonomous agent systems.
strict_modeBooleanNotrueAdds strict formatting for structured outputs compliance.

Output Format

Outputs follow the standardized Dual Output Envelope:

{
"success": true,
"meta": {
"title": "Pet Store API",
"version": "1.0.0",
"endpoints_count": 2,
"tools_generated_count": 2,
"processing_time_ms": 1.45
},
"data": {
"openai_tools": [
{
"type": "function",
"function": {
"name": "listPets",
"description": "Returns a list of pets with optional limit filter.",
"parameters": {
"type": "object",
"properties": {
"limit": { "type": "integer", "format": "int32", "description": "How many items to return at one time (max 100)" }
},
"required": [],
"additionalProperties": false
},
"strict": true
}
}
],
"anthropic_tools": [...],
"gemini_declarations": [...],
"mcp_tools": [...]
},
"markdown_summary": "### API: Pet Store API (v1.0.0)\n- **listPets** (GET `/pets`): Returns a list of pets with optional limit filter."
}

Code Examples (10+ Languages)

1. Python

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run_input = {
"items": [{"openapi": "3.0.0", "info": {"title": "Test", "version": "1.0"}, "paths": {}}],
"target_formats": ["openai", "mcp"],
"strict_mode": True
}
run = client.actor("n4d.h1dr/openapi-to-agent-tools").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["data"]["mcp_tools"])

2. TypeScript / JavaScript

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('n4d.h1dr/openapi-to-agent-tools').call({
items: [myOpenApiSpec],
target_formats: ['anthropic', 'openai']
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].data.anthropic_tools);

3. cURL

curl -X POST "https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"items": [{"openapi": "3.0.0", "info": {"title": "API", "version": "1.0"}, "paths": {}}]}'

4. Go

package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"items": []interface{}{map[string]string{"openapi": "3.0.0"}},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
client.Do(req)
}

5. Ruby

require 'net/http'
require 'json'
require 'uri'
uri = URI("https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN")
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req.body = { items: [{ openapi: "3.0.0" }] }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }

6. PHP

<?php
$ch = curl_init('https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['items' => [['openapi' => '3.0.0']]]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

7. Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolConverter {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{\"items\":[{\"openapi\":\"3.0.0\"}]}";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.send(req, HttpResponse.BodyHandlers.ofString());
}
}

8. C# (.NET)

using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var content = new StringContent("{\"items\":[{\"openapi\":\"3.0.0\"}]}", Encoding.UTF8, "application/json");
await client.PostAsync("https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN", content);
}
}

9. Rust

use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let body = json!({ "items": [{ "openapi": "3.0.0" }] });
client.post("https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN")
.json(&body)
.send()
.await?;
Ok(())
}

10. Swift

import Foundation
let url = URL(string: "https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/runs?token=YOUR_APIFY_TOKEN")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: ["items": [["openapi": "3.0.0"]]])
URLSession.shared.dataTask(with: request).resume()

11. n8n and Make.com

  • In n8n, use the HTTP Request node with Method POST pointing to https://api.apify.com/v2/acts/n4d.h1dr~openapi-to-agent-tools/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN.
  • In Make.com, add an Apify module "Run Actor and get dataset items" with the specified configuration.