AI Connect / AI Tool DEVELOPERS

Create JavaScript AI Tools

Install the SDK, write and test your tools, then package and publish.

Create and publish a JavaScript AI Tool in six steps. No cloud account is needed until you upload your ZIP.

1. Install

Install Node.js 22 or later, which includes npm. Check your terminal:

node --version
npm --version

The project generator in step 2 installs @syraio/ai-connect as a project dependency. You do not need to install the SDK globally.

2. Create a project

npm create @syraio/ai-connect@latest my-js-tools
cd my-js-tools
npm install

Your project contains src/tool.js, tool.json, README.md, preview.mjs, and package.json. The generated npm scripts build and package your code.

3. Write your tools

Replace src/tool.js with this example:

import { createAiTools } from '@syraio/ai-connect';

const myTools = createAiTools({ name: 'my-js-tools', version: '0.1.0' });

myTools.add_tool('hello', 'Return a greeting.', () => {
  return 'Hello from AI Connect!';
});

export default myTools;

This adds hello, a tool with no arguments that returns a greeting.

Another example: use an argument

Add this before export default myTools in the same file:

myTools.add_tool(
  'greet',
  'Greet someone by name.',
  ({ name }) => `Hello, ${name}!`,
  {
    type: 'object',
    properties: { name: { type: 'string', minLength: 1 } },
    required: ['name'],
    additionalProperties: false,
  },
);

greet accepts a required name. For example, { "name": "Ada" } returns Hello, Ada!.

Practical example: add two numbers

Add an add tool that calculates a sum. Your AI client calls your code with the numbers it needs and uses the result in its answer.

Place this before export default myTools.

myTools.add_tool(
  'add',
  'Add two numbers.',
  ({ a, b }) => ({ sum: a + b }),
  {
    type: 'object',
    properties: { a: { type: 'number' }, b: { type: 'number' } },
    required: ['a', 'b'],
    additionalProperties: false,
  },
);

For example, the client sends { "a": 20, "b": 22 } and your tool returns { "sum": 42 }. You can use the same pattern for business calculations or reading data from your own system.

4. Try the examples

From your project folder, build and run the preview:

npm run build
npm start

The preview lists your tools and calls hello. You should see Hello from AI Connect!.

If you added greet, add this line to preview.mjs to try it:

console.log(await myTools.callTool('greet', { name: 'Ada' }));

The result should contain Hello, Ada!.

Try the addition tool

Add this line to preview.mjs:

console.log(await myTools.callTool('add', { a: 20, b: 22 }));

Run npm run build, then npm start again.

The result should contain:

{ "sum": 42 }

5. Build the ZIP

Update README.md with what your tool does, setup instructions, and runtime requirements. This README appears on your public tool page.

Check the generated tool.json: keep a stable, unique id, set a display name and description, and keep the tool version at 0.1.0 for this first release. The SDK version and your tool's release version are separate.

From my-js-tools:

npm run package

Output: my-js-tools.zip. It contains tool.json, README.md, and the built JavaScript under dist/, with dist/tool.mjs as the entry point. Users need Node.js 22 or later, not your source files or node_modules.

6. Upload and publish

  1. Register a cloud account or sign in.
  2. Open the Developer portal.
  3. Select Upload AI Tool ZIP and choose my-js-tools.zip.
  4. Wait for processing, then open the new listing. New listings are Private draft.
  5. Review the name, description, version, and README. Save any listing edits.
  6. Select Publish and confirm. Find your listing in the public AI Tool store, open its page, and verify the README and ZIP download.

Upload the AI Tool ZIP here, not an npm .tgz or Python SDK .whl. If another creator already uses your tool ID, choose a unique ID in tool.json and rebuild before uploading.

For updates, keep the ID and increase the version in tool.json and your service declaration; JavaScript projects also update package.json. Rebuild and upload the new ZIP. Existing versions cannot be overwritten. A new release uploaded to an already published listing becomes public immediately.

Your users now follow step 7: install the tool, then step 8: connect an AI client. They do not need a cloud account to browse, download, or use your public release.

Use the calculation from an AI client

After installing and enabling the package and connecting your client with the user guide, ask:

Use my-js-tools__add to calculate 20 + 22 and show the result.

The client should call your tool with a: 20 and b: 22, then display 42. AI Connect runs your code on your device and returns its result to the client.