@codervisor/devlog-mcp
Version:
MCP server for managing development logs and working notes
41 lines • 1.62 kB
TypeScript
/**
* MCP tool utility functions for consistent error handling and response formatting
*/
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
/**
* Extract error message with consistent fallback pattern
*/
export declare function extractErrorMessage(error: unknown): string;
/**
* Create standardized error response for MCP tools
*/
export declare function createErrorResponse(operation: string, error: unknown): CallToolResult;
/**
* Create standardized success response for MCP tools
*/
export declare function createSuccessResponse(message: string): CallToolResult;
/**
* Wrap MCP tool execution with standardized error handling
*/
export declare function wrapToolExecution<T>(operation: () => Promise<T>, operationName: string, successFormatter: (result: T) => string): Promise<CallToolResult>;
/**
* Validate required parameters for MCP tool calls
*/
export declare function validateRequiredParams(params: Record<string, unknown>, requiredFields: string[], toolName: string): void;
/**
* Format object for display in MCP tool responses
*/
export declare function formatObjectForDisplay(obj: unknown, indentLevel?: number): string;
/**
* Truncate text for display with ellipsis
*/
export declare function truncateText(text: string, maxLength: number): string;
/**
* Format timestamp for human readable display
*/
export declare function formatTimestamp(timestamp: string | Date): string;
/**
* Create pagination info string for MCP responses
*/
export declare function formatPaginationInfo(current: number, total: number, limit: number): string;
//# sourceMappingURL=common.d.ts.map