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

@wattdata/sdk

v0.2.0

Published

Watt agent platform — connect to Watt's MCP tools with one line

Downloads

91

Readme

@wattdata/sdk

Agentic customer intelligence with one line of code.

Quick Start

npm install @wattdata/sdk
import { createWattClient } from "@wattdata/sdk";

const watt = createWattClient({
  wattApiKey: process.env.WATT_API_KEY,
  wattMcpUrl: process.env.WATT_MCP_URL,
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
});

const response = await watt.prompt("Resolve the identity for [email protected]");
console.log(response);

Usage

prompt() — Simple text response

const response = await watt.prompt("Resolve the identity for [email protected]");

generate() — Full result with steps and usage

const result = await watt.generate({
  prompt: "Analyze my customers",
  file: "/data/customers.csv",
});

console.log(result.text);    // Final response
console.log(result.steps);   // Agent steps
console.log(result.usage);   // Token usage

stream() — Streaming text

const result = await watt.stream({
  prompt: "Find tech executives in San Francisco",
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Structured output

Pass output to generate(), stream(), or streamChat() to get typed structured responses. The agent still runs its full tool loop — structured output only constrains the final response.

import { createWattClient, Output, z } from "@wattdata/sdk";

// Object output
const result = await watt.generate({
  prompt: "Find the CEO of Acme Corp",
  output: Output.object({
    schema: z.object({ name: z.string(), title: z.string() }),
  }),
});
console.log(result.output); // { name: "John Doe", title: "CEO" }

// Array output with streaming
const stream = await watt.stream({
  prompt: "List tech companies in SF",
  output: Output.array({
    element: z.object({ name: z.string(), industry: z.string() }),
  }),
});
for await (const partial of stream.partialOutputStream) {
  console.log(partial); // progressively more complete array
}
const final = await stream.output; // fully typed array

Available output types: Output.object(), Output.array(), Output.choice(), Output.text(), Output.json()

streamChat() — Chat UI integration

Returns a streaming Response for web frameworks. Pass output to constrain the agent's final response to a typed schema — the structured JSON streams as the last assistant message:

export async function POST(req: Request) {
  const { messages } = await req.json();
  const watt = createWattClient({
    wattApiKey: process.env.WATT_API_KEY,
    wattMcpUrl: process.env.WATT_MCP_URL,
    anthropicApiKey: process.env.ANTHROPIC_API_KEY,
  });
  return watt.streamChat(messages, {
    output: Output.object({
      schema: z.object({ response: z.string(), summary: z.string() }),
    }),
  });
}

Options: sendReasoning, file, abortSignal, output

Custom tools

Pass tools to inject custom tools into the agent alongside MCP and SDK tools:

import { tool } from "ai";
import { z } from "zod";

const watt = createWattClient({
  wattApiKey: process.env.WATT_API_KEY,
  wattMcpUrl: process.env.WATT_MCP_URL,
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
  tools: {
    draft_slack_message: tool({
      description: "Draft a Slack message summarizing analysis findings",
      inputSchema: z.object({
        channel: z.string(),
        title: z.string().max(150),
        body: z.string(),
        highlights: z.array(z.object({ label: z.string(), value: z.string() })).optional(),
      }),
      execute: async (input) => input,
    }),
  },
});

Custom tools are merged with MCP-discovered tools and built-in SDK tools. They're available in generate(), stream(), and streamChat().

Note: Custom tools take precedence over MCP and SDK tools with the same name. A warning is logged when a collision is detected. Avoid naming custom tools after built-in tools (e.g., upload_file, entity_resolve) unless you intend to override them.

File uploads

Pass file to upload and analyze local files:

const result = await watt.generate({
  prompt: "Analyze my customers",
  file: "/data/customers.csv",
});

API Reference

| Method | Returns | Description | |--------|---------|-------------| | prompt(text) | Promise<string> | Simple text response | | generate(opts) | Promise<GenerateTextResult> | Full result with steps and usage. Pass output for structured responses | | stream(opts) | Promise<StreamTextResult> | Streaming text. Pass output for structured responses | | streamChat(messages, opts?) | Promise<Response> | Streaming response for chat UIs. Pass output for structured responses | | close() | Promise<void> | Close MCP connection |

Configuration

createWattClient({
  wattApiKey: string;        // Watt API key
  wattMcpUrl: string;        // Watt MCP server URL
  anthropicApiKey: string;   // Anthropic API key
  systemPrompt?: string;     // Custom system prompt (optional)
  tools?: ToolSet;           // Custom tools merged into the agent (optional)
});

License

MIT