Native tool_use blocks for the Anthropic Messages API. Returns tool definitions with input_schema matching the Anthropic format.
npm install agent402-anthropic-tools
import { agent402Tools } from "agent402-anthropic-tools";
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic();
const { tools, execute } = await agent402Tools();
const res = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [{ role: "user", content: "Hash 'hello world' with SHA-256" }],
tools,
});
// When the model returns a tool_use block, run it:
const block = res.content.find(b => b.type === "tool_use");
const result = await execute(block.name, block.input);
console.log(result);
| Option | Type | Description |
|---|---|---|
categories |
string[] |
Filter tools by category. |
slugs |
string[] |
Load only specific tools by slug. |
baseUrl |
string |
Point to a self-hosted Agent402 instance. |
agentKey |
string |
Private key for wallet-only (paid) tools. |
// Filter tools by category.
agent402Tools({ categories: ["search"] })
// Load only specific tools by slug.
agent402Tools({ slugs: ["hash", "extract"] })
// Point to a self-hosted Agent402 instance.
agent402Tools({ baseUrl: "https://my-agent402.example.com" })
// Private key for wallet-only (paid) tools.
agent402Tools({ agentKey: process.env.AGENT_KEY })