Skip to main content

Overview

The @jinba-toolbox/sdk package provides a type-safe client library for consuming tools registered in Jinba Toolbox. It wraps the REST API with convenient methods for listing toolsets, executing tools, managing versions, and retrieving run history. Target consumers:
  • AI agents executing tools
  • CLI tools for automation
  • Third-party applications integrating with Jinba Toolbox
  • Developers building on Jinba Toolbox

Installation

Quick Start

1

Import and create a client

2

List your toolsets

3

Execute a tool

Client Configuration

The createClient function accepts a JinbaTBClientConfig object:
The SDK’s built-in default baseUrl is https://toolbox-api.jinba.dev (the staging API). Set baseUrl to https://toolbox-api.jinba.io explicitly to talk to the production Toolbox.
Example with all options:
If you set organizationId in the constructor, you can omit it from individual method calls. Every method also accepts an optional orgId parameter to override the default.

API Reference

Organizations

listOrganizations() and getOrganization() call endpoints that require a signed-in user session. With an API key (the only credential the SDK sends) they fail with JinbaTBError status 401.

ToolSets

Tools

Execution

run() sends { input, version } to the organization run endpoint; the organization ID must come from the constructor or options.orgId.

Versions

Run History

Key Types

RunResult

The object returned from run() and test():

ToolSet

Tool

Error Handling

The SDK throws JinbaTBError for non-2xx responses:
A 408 status code is thrown when a request exceeds the configured timeout. Because the API answers with RFC 9457 Problem Details (detail, not error), error.message is usually Request failed with status <code>; inspect statusCode to branch on the cause (for example 402 for insufficient credits).

Best Practices

  • Set a default organizationId in the constructor to avoid passing it to every method.
  • Use environment variables for the API key — never hard-code credentials.
  • Handle JinbaTBError to distinguish between client errors (4xx) and server errors (5xx).
  • Increase timeout for tool executions that run complex sandbox workloads.
  • Pin a version when calling run() if your application depends on deterministic behavior.