ToolSDK.ai LogoToolSDK.ai
API Reference

ToolSDKApiClient

API Reference for ToolSDKApiClient

ToolSDKApiClient

ToolSDKApiClient is the main entry point for interacting with the ToolSDK.ai API.

1. Installation

npm install toolsdk

2. Initialization

Initialize the client with your API key.

import { ToolSDKApiClient } from 'toolsdk/api';

const client = new ToolSDKApiClient({
  apiKey: 'your-api-key', // process.env.TOOLSDK_AI_API_KEY
});

3. Methods

3.1 package(packageKey, version?, envs?)

Access a specific package (MCP Server) to run tools or get tool configurations.

  • packageKey: The unique identifier of the package (e.g., github, twilio).
  • version: (Optional) Specific version of the package.
  • envs: (Optional) Environment variables to pass to the package.

Returns a Package instance.

const github = client.package('github');

3.2 Package.run(options)

Execute a tool from the package.

const result = await client.package('github').run({
  toolKey: 'create-issue',
  inputData: {
    title: 'New Issue',
    body: 'Issue description'
  }
});

3.3 Package.getAISDKTool(toolKey)

Get a tool compatible with Vercel AI SDK (ai package).

const tool = await client.package('github').getAISDKTool('create-issue');

3.4 Package.getAISDKToolSet()

Get all tools from the package as a Vercel AI SDK compatible toolset.

const tools = await client.package('github').getAISDKToolSet();

3.5 Package.getOpenAISDKTools()

Get all tools from the package in OpenAI function calling format.

const tools = await client.package('github').getOpenAISDKTools();

3.6 packages.pages(params)

List available packages in the registry.

const packages = await client.packages.pages({ pageNo: 1, pageSize: 20 });

3.7 packageInstance(instanceId)

Access a specific package instance by ID.

const instance = client.packageInstance('instance-id');