Catalog npm
PACKAGE EXPLORERView in registry

2schema

npm

enhance tooling for AI agents

agentjsonopenapischematool
Versions collected5
Direct dependencies2From release 1.1.3
Last observed20 Oct, 19:18 UTC

README

Current package documentation

2schema

Automatically generate schemas from LLM function calling.

Instead of writing schemas by hand 🥱

import { OpenAI } from "openai";

const openai = new OpenAI();

const tools = [{
    "type": "function",
    "function": {
        "name": "getWeather",
        "description": "Get current temperature for a given location.",
        "parameters": {
            "type": "object",
            "properties": {
                // life is too short for schema
            },
        },
    }
}];

function getWeather(args: { location: string }) {
    return //...
}

const completion = await openai.chat.completions.create({
    model: "gpt-5",
    messages: [{ role: "user", content: "What is the weather like in Paris today?" }],
    tools,
});

Let the compiler works for you

import { fn } from "2schema";

const openai = new OpenAI();

class Tools {
  @fn
  static async getWeather(args: { location: string }) {
    return; // ...
  }
}

// will generate the schema for you
const tools = [Tools.getWeather.toJSONSchema()];

const completion = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [
    { role: "user", content: "What is the weather like in Paris today?" },
  ],
  tools,
});

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 5

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.3Registry latest16 Mar 20252
1.1.216 Mar 20252
1.1.016 Mar 20252
1.0.316 Mar 20252
1.0.216 Mar 20252

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
chenhunghan/2schema

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:18 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:28c3fd728a0f6c786aa413ac6cf154c07c015f327f0f7f3946275f6600835112