picogent/src/tools/projects.ts
Markov 7dd39f65f6 feat: MCP-compatible tracker tools (Function Calling hybrid)
- 14 tools: tasks (7), steps (2), messages (2), projects (2), members (1)
- TypeBox schemas for parameter validation
- Injected via customTools into Pi Agent Core session
- Tools wrap TrackerClient REST methods
2026-02-23 21:51:02 +01:00

37 lines
1.1 KiB
TypeScript

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<any>[] {
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));
},
},
];
}