Files
video-create/web/server/agent/pi-tools.ts

19 lines
612 B
TypeScript
Raw Normal View History

import type { AgentTool, AgentToolResult } from '@earendil-works/pi-agent-core';
import type { ToolDefinition } from './tools/types';
export function createPiTools(tools: ToolDefinition[]): AgentTool[] {
return tools.map((t): AgentTool => ({
name: t.name,
description: t.description,
parameters: t.input_schema as any,
label: t.name,
execute: async (_toolCallId: string, params: any): Promise<AgentToolResult<any>> => {
const result = await t.execute(params);
return {
content: [{ type: 'text' as const, text: result }],
details: null,
};
},
}));
}