Custom Tools¶
Create custom tools using TypeScript and the altimate plugin system.
Quick Start¶
- Create a tools directory:
- Create a tool file:
// .altimate-code/tools/my-tool.ts
import { defineTool } from "@altimateai/altimate-code-plugin/tool"
import { z } from "zod"
export default defineTool({
name: "my_custom_tool",
description: "Does something useful",
parameters: z.object({
input: z.string().describe("The input to process"),
}),
async execute({ input }) {
// Your tool logic here
return { result: `Processed: ${input}` }
},
})
Plugin Package¶
For more complex tools, create a plugin package:
// index.ts
import { definePlugin } from "@altimateai/altimate-code-plugin"
import { z } from "zod"
export default definePlugin({
name: "my-plugin",
tools: [
{
name: "analyze_costs",
description: "Analyze warehouse costs",
parameters: z.object({
warehouse: z.string(),
days: z.number().default(30),
}),
async execute({ warehouse, days }) {
// Implementation
return { costs: [] }
},
},
],
})
Registering Plugins¶
Add plugins to your config:
Plugin Hooks¶
Plugins can hook into 30+ lifecycle events:
onSessionStart/onSessionEndonMessage/onResponseonToolCall/onToolResultonFileEdit/onFileWriteonError- And more...