@lit-protocol/fss-tool-registry
v0.1.1-10
Published
Central registry for Lit AI Agent tools. This package manages the registration, discovery, and validation of tools that can be executed by Lit agents.
Downloads
10
Keywords
Readme
@lit-protocol/fss-tool-registry
Central registry for Lit AI Agent tools. This package manages the registration, discovery, and validation of tools that can be executed by Lit agents.
Features
- Tool registration and management
- Policy validation
- Tool discovery and metadata
- Parameter validation
- IPFS integration for tool distribution
Installation
pnpm add @lit-protocol/fss-tool-registryUsage
Registering a Tool
import {
registerTool,
ToolInfo,
validateParamsAgainstPolicy
} from '@lit-protocol/fss-tool-registry';
// Define your tool
const myTool: ToolInfo = {
name: 'MyTool',
description: 'Performs a specific action',
ipfsCid: 'Qm...',
parameters: {
param1: {
type: 'string',
description: 'First parameter',
required: true
},
param2: {
type: 'number',
description: 'Second parameter',
required: false
}
}
};
// Register the tool
registerTool(myTool);Using the Registry
// List available tools
const tools = listAvailableTools();
// Get a specific tool
const tool = getToolFromRegistry('MyTool');
// Validate parameters against policy
validateParamsAgainstPolicy(
tool,
{ param1: 'value1', param2: 42 },
policyValues
);Tool Structure
Each tool in the registry must define:
Basic Information
- Name
- Description
- IPFS CID of the implementation
Parameters
- Name and type
- Description
- Required/optional status
- Validation rules
Policy Requirements (optional)
- Security constraints
- Parameter restrictions
- Network limitations
API Reference
Tool Management
registerTool()
function registerTool(tool: ToolInfo): voidRegister a new tool in the registry.
listAvailableTools()
function listAvailableTools(): ToolInfo[]Get a list of all registered tools.
getToolFromRegistry()
function getToolFromRegistry(name: string): ToolInfoGet a specific tool by name.
Validation
validateParamsAgainstPolicy()
function validateParamsAgainstPolicy(
tool: ToolInfo,
params: Record<string, any>,
policy: any
): voidValidate tool parameters against its policy.
License
MIT
