import { z } from "zod";
/**
* Context Tools - Manage LLM context window and information aggregation
*/
// ============================================
// Summarize Files
// ============================================
export const summarizeFilesSchema = {
name: "summarize_files",
description: "Generates a high-level summary of multiple files to save context window",
inputSchema: z.object({
files: z.array(z.string()).describe("List of file paths"),
detailLevel: z.enum(["brief", "standard", "detailed"]).default("standard")
})
};
export function summarizeFilesHandler(args: { files: string[]; detailLevel: string }) {
// In a real agent, the LLM would read and summarize.
// Here we provide the structure for that action.
return {
content: [{
type: "text",
text: `Please summarize the following ${args.files.length} files at ${args.detailLevel} level:\n${args.files.map(f => `- ${f}`).join('\n')}`
}]
};
}
// ============================================
// Aggregate Context
// ============================================
export const aggregateContextSchema = {
name: "aggregate_context",
description: "Collects relevant files, definitions, and patterns for a specific task",
inputSchema: z.object({
task: z.string().describe("Task description"),
includePatterns: z.array(z.string()).optional(),
excludePatterns: z.array(z.string()).optional()
})
};
export function aggregateContextHandler(args: { task: string }) {
return {
content: [{
type: "text",
text: `# Aggregated Context for: "${args.task}"\n\n[System would auto-gather related files here based on embeddings/search]`
}]
};
}
export const contextTools = {
summarizeFilesSchema, summarizeFilesHandler,
aggregateContextSchema, aggregateContextHandler
};