import { Type } from '@sinclair/typebox'; import type { ToolDefinition } from '@mariozechner/pi-coding-agent'; import type { ToolContext } from './types.js'; const GetProjectParams = Type.Object({ slug: Type.String({ description: 'Project slug' }), }); function ok(text: string) { return { content: [{ type: 'text' as const, text }], details: {} }; } export function createProjectTools(ctx: ToolContext): ToolDefinition[] { return [ { name: 'list_projects', label: 'List Projects', description: 'List all projects the agent has access to.', parameters: Type.Object({}), async execute() { const projects = await ctx.trackerClient.listProjects(); return ok(JSON.stringify(projects, null, 2)); }, }, { name: 'get_project', label: 'Get Project', description: 'Get project details by slug, including chat_id.', parameters: GetProjectParams, async execute(_id: string, params: any) { const project = await ctx.trackerClient.getProject(params.slug); return ok(JSON.stringify(project, null, 2)); }, }, ]; }