AI Tools
Why Add AI Tools?
Tool Definition Structure
// src/index.ts
import type { ExtensionAITool } from '@nimbalyst/extension-sdk';
export const aiTools: ExtensionAITool[] = [
{
name: 'my_tool_name',
description: 'What this tool does - Claude reads this to decide when to use it',
inputSchema: {
type: 'object',
properties: {
param1: {
type: 'string',
description: 'Description of param1',
},
param2: {
type: 'number',
description: 'Description of param2',
},
},
required: ['param1'],
},
handler: async (args, context) => {
// Implement tool logic
return { result: 'success' };
},
},
];Registering Tools in the Manifest
Tool Handler Context
Example: Spreadsheet Tools
Updating File Content
Tool Naming Conventions
Writing Good Tool Descriptions
Error Handling
Input Schema
Best Practices
Testing Tools
Example: Data Model Tools
Calling AI Models Directly
Prerequisites
Listing Available Models
Non-Streaming Completion
Streaming Completion
Multi-Turn Conversations
Structured Output (JSON Mode)
Key Points
Next Steps
Last updated
