@kognitivedev/tools
v0.2.28
Published
Provider-agnostic tool system with approval workflows
Downloads
621
Maintainers
Readme
@kognitivedev/tools
Provider-agnostic tool system for Kognitive agents and runtimes.
Installation
bun add @kognitivedev/tools zodQuick Start
import { createTool, ToolRegistry } from "@kognitivedev/tools";
import { z } from "zod";
const searchTool = createTool({
id: "search",
description: "Search documentation",
inputSchema: z.object({ query: z.string() }),
execute: async (input, context) => {
context.emit("progress", { query: input.query });
return { results: [`Result for: ${input.query}`] };
},
});
const registry = new ToolRegistry();
registry.register(searchTool);
console.log(registry.all().map((tool) => tool.id));Features
createToolfor typed tool definitionsToolRegistryfor grouping and lookuprequireApprovalfor human-in-the-loop executiontoModelOutputfor summarizing large tool results- Neutral
ToolContextwithabortSignal,resourceId,memory,metadata, andemit
Provider Bridges
The neutral package no longer exports provider-specific conversion helpers. Use adapter packages when you need a concrete runtime bridge:
@kognitivedev/adapter-ai-sdkfortoAISDKTool()andtoAISDKTools()@kognitivedev/adapter-claude-agent-sdkwhen tools should be exposed through Claude Agent SDK's MCP bridge
import { createTool } from "@kognitivedev/tools";
import { toAISDKTool } from "@kognitivedev/adapter-ai-sdk";
const sdkTool = toAISDKTool(searchTool, {
resourceId: { userId: "user_1" },
});