npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@isdk/ai-tool-fastify

v0.1.1

Published

> ✨ **Fastify HTTP Server Transport for the `ToolFunc` Framework** > Build decoupled, type-safe, real-time Fastify apps with RPC tools and Pub/Sub events over IPC.

Downloads

7

Readme

@isdk/ai-tool-fastify

Fastify HTTP Server Transport for the ToolFunc Framework Build decoupled, type-safe, real-time Fastify apps with RPC tools and Pub/Sub events over IPC.

npm version Vitest Tests TypeScript License: MIT

npm install @isdk/ai-tool-fastify fastify @isdk/ai-tool

Built on @isdk/ai-tool — Define reusable, self-documenting functions.

🌟 Features

Designed to pair with @isdk/ai-tool. Define your business logic once as tools, then call them from any client like local methods.

  • Fastify Integration - Expose ToolFunc tools over HTTP with a Fastify server.
  • Automatic Tool Discovery - Client can fetch a list of all available tools from the server.
  • RPC (Remote Procedure Call) - Call server-side tools from the client as if they were local functions.
  • Type-Safe - Leverages TypeScript for type-safe tool definitions and calls.

🚀 Quick Start

Here is a quick example of how to set up a tool server and call it from a client.

1. Create the Server

Create a file server.ts and add the following code:

import { ServerTools } from '@isdk/ai-tool';
import { FastifyServerToolTransport } from '@isdk/ai-tool-fastify';

// 1. Register a tool on the server side
ServerTools.register({
  name: 'calculator',
  isApi: true,
  func: ({ a, b }: { a: number; b: number }) => {
    return a + b;
  },
});

// 2. Setup the server transport
const serverTransport = new FastifyServerToolTransport();
serverTransport.mount(ServerTools, '/api');

// 3. Start the server
serverTransport.start({ port: 3000 }).then(() => {
  console.log('Server is running on http://localhost:3000');
});

2. Create the Client

Create a file client.ts and add the following code:

import { ClientTools, HttpClientToolTransport } from '@isdk/ai-tool';

async function main() {
  // 1. Setup the client transport
  const clientTransport = new HttpClientToolTransport('http://localhost:3000/api');
  ClientTools.setTransport(clientTransport);

  // 2. Load tool definitions from the server
  await ClientTools.loadFrom();

  // 3. Get the dynamically created client-side tool stub
  const calculatorTool = ClientTools.get('calculator');

  // 4. Run the tool. This will trigger an HTTP call.
  const result = await calculatorTool!.run({ a: 40, b: 2 });

  // 5. Assert the result
  console.log('The result is:', result); // The result is: 42
}

main();

3. Run the code

You can run the server and client using ts-node or by compiling them with tsc first.

# In one terminal
npx ts-node server.ts

# In another terminal
npx ts-node client.ts

🧪 Testing

Run unit tests with mocked Fastify IPC:

npm test           # run once
npm run test:watch # dev mode
npm run coverage   # generate report

📚 Docs

🤝 Contributing

We ❤️ contributions!

  1. Fork → git clone
  2. Create branch → git checkout -b feat/your-feature
  3. Commit → git commit -m 'feat: add XYZ'
  4. Push → git push origin feat/your-feature
  5. Open PR 🎉

Please ensure tests pass and types are clean.

📜 License

MIT © ISDK — See LICENSE