repomix
Version:
A tool to pack repository contents to single file for AI consumption
59 lines • 2.32 kB
TypeScript
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
import type { ProcessedFile } from '../../core/file/fileTypes.js';
export declare const registerOutputFile: (id: string, filePath: string) => void;
export declare const getOutputFilePath: (id: string) => string | undefined;
export interface McpToolMetrics {
totalFiles: number;
totalCharacters: number;
totalTokens: number;
fileCharCounts: Record<string, number>;
fileTokenCounts: Record<string, number>;
processedFiles: ProcessedFile[];
safeFilePaths: string[];
}
export interface McpToolContext {
directory?: string;
repository?: string;
}
interface BaseMcpToolResponse {
description?: string;
errorMessage?: string;
}
type McpToolStructuredContent = (BaseMcpToolResponse & Record<string, unknown>) | undefined;
/**
* Creates a temporary directory for MCP tool operations
*/
export declare const createToolWorkspace: () => Promise<string>;
/**
* Generate a unique output ID
*/
export declare const generateOutputId: () => string;
/**
* Creates a result object with metrics information for MCP tools
*/
export declare const formatPackToolResponse: (context: McpToolContext, metrics: McpToolMetrics, outputFilePath: string, topFilesLen?: number) => Promise<CallToolResult>;
export declare const convertErrorToJson: (error: unknown) => {
errorMessage: string;
details: {
stack?: string;
name: string;
cause?: unknown;
code?: string | number;
timestamp: string;
type: "Error" | "Unknown";
};
};
/**
* Creates a successful MCP tool response with type safety
* @param structuredContent - Object containing both machine-readable data and human-readable description
* @returns CallToolResult with both text and structured content
*/
export declare const buildMcpToolSuccessResponse: (structuredContent: McpToolStructuredContent) => CallToolResult;
/**
* Creates an error MCP tool response with type safety
* @param structuredContent - Object containing error message and details
* @returns CallToolResult with error flag, text content, and structured content
*/
export declare const buildMcpToolErrorResponse: (structuredContent: McpToolStructuredContent) => CallToolResult;
export {};
//# sourceMappingURL=mcpToolRuntime.d.ts.map