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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pillar-ai/server

v0.2.4

Published

Pillar backend SDK — register server-side tools and handle tool calls

Readme

@pillar-ai/server

Backend SDK for Pillar — register server-side tools and handle tool calls from Pillar Cloud.

Install

npm install @pillar-ai/server

Optional peer dependencies for Zod schema support:

npm install zod zod-to-json-schema

Quick Start

import { Pillar, defineTool } from '@pillar-ai/server';
import { z } from 'zod';

const pillar = new Pillar({
  secret: process.env.PILLAR_SECRET!,
  endpointUrl: 'https://api.myapp.com/pillar',
});

const lookupCustomer = defineTool({
  name: 'lookup_customer',
  description: 'Look up a customer by email address',
  input: z.object({
    email: z.string().email().describe('Customer email address'),
  }),
  execute: async ({ email }, ctx) => {
    const customer = await db.findByEmail(email);
    return { name: customer.name, plan: customer.plan };
  },
});

await pillar.registerTools([lookupCustomer]);

Framework Integration

Express

import express from 'express';
const app = express();
app.use(express.json());
app.post('/pillar', pillar.expressHandler());
app.listen(3000);

Hono

import { Hono } from 'hono';
const app = new Hono();
app.post('/pillar', pillar.honoHandler());

Next.js (App Router)

// app/api/pillar/route.ts
export const POST = pillar.nextHandler();

Fastify

import Fastify from 'fastify';
const fastify = Fastify();
fastify.post('/pillar', pillar.fastifyHandler());
fastify.listen({ port: 3000 });

Standalone

pillar.serve({ port: 8787 });

Plain JSON Schema (No Zod)

const lookupCustomer = defineTool({
  name: 'lookup_customer',
  description: 'Look up a customer by email',
  inputSchema: {
    type: 'object',
    properties: {
      email: { type: 'string', description: 'Customer email' },
    },
    required: ['email'],
  },
  execute: async ({ email }: { email: string }, ctx) => {
    return { name: 'Jane' };
  },
});

API Reference

Pillar

new Pillar({
  secret: string,           // Required. Your Pillar secret (used for auth and signature verification).
  endpointUrl?: string,     // URL where Pillar Cloud sends tool calls.
  autoRegister?: boolean,   // Auto-register tools on first call (default: true).
  baseUrl?: string,         // Pillar API base URL (default: https://api.trypillar.com).
  logger?: Logger,          // Custom logger.
})

defineTool

defineTool({
  name: string,                    // Unique tool name.
  description: string,             // Human-readable description.
  input?: ZodSchema,               // Zod schema (optional).
  inputSchema?: JsonSchema,        // Plain JSON Schema (optional).
  outputSchema?: JsonSchema,       // Output schema (optional).
  guidance?: string,               // Agent instructions.
  timeoutMs?: number,              // Timeout in ms (default: 30000).
  channelCompatibility?: string[], // Channels (default: all).
  execute: (input, ctx) => any,    // Handler function.
})

ToolContext

interface ToolContext {
  caller: CallerInfo;
  conversationId: string;
  callId: string;
  productId?: string;
  isIdentified: boolean;
  confirmed: boolean; // true when re-executing after user confirmation
}

interface CallerInfo {
  channel: 'web' | 'slack' | 'discord' | 'email' | 'api';
  channelUserId?: string;
  externalUserId?: string;
  email?: string;
  displayName?: string;
}

Confirmation responses

When a tool needs user confirmation before performing an action, return a ConfirmationResponse from execute. Pillar renders a channel-appropriate confirmation UI (Block Kit buttons in Slack, structured JSON in the copilot) and re-calls execute with ctx.confirmed = true after the user confirms.

import { defineTool, type ConfirmationResponse } from '@pillar-ai/server';

const createPlan = defineTool({
  name: 'create_plan',
  description: 'Create a new plan',
  input: z.object({ name: z.string(), price: z.number() }),
  execute: async (input, ctx): Promise<ConfirmationResponse | { created: boolean }> => {
    if (!ctx.confirmed) {
      return {
        confirmation_required: true,
        title: 'Create plan',
        message: `Create "${input.name}" at $${input.price}/mo?`,
        details: {
          'Plan name': input.name,
          'Price': `$${input.price}/mo`,
        },
        confirm_payload: input,
      };
    }

    await db.createPlan(input);
    return { created: true };
  },
});

ConfirmationResponse

| Field | Required | Description | |---|---|---| | confirmation_required | yes | Must be true. | | title | no | Short headline. Defaults to the tool name. | | message | no | One-line description shown before the buttons. | | details | no | Key-value pairs rendered as a summary card. | | confirm_payload | no | Opaque data passed back to execute on confirm. Defaults to the original arguments. |