firewalla-mcp-server
Version:
Model Context Protocol (MCP) server for Firewalla MSP API - Provides real-time network monitoring, security analysis, and firewall management through 28 specialized tools compatible with any MCP client
61 lines • 2.06 kB
TypeScript
/**
* Unified Response Format for Solo Dev OSS Project
*
* Simple, consistent response format for all MCP tools.
* Focuses on practicality and maintainability over enterprise complexity.
*/
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
/**
* Simple unified response interface
*/
export interface UnifiedResponse<T = any> {
/** Whether the operation was successful */
success: boolean;
/** The actual data payload */
data?: T;
/** Error message if success is false */
error?: string;
/** Basic metadata */
meta: {
/** Timestamp when response was generated */
timestamp: string;
/** Tool that generated this response */
tool: string;
/** Simple request identifier */
request_id: string;
/** Number of results returned (for arrays) */
count?: number;
/** Execution time in milliseconds */
execution_time_ms?: number;
};
}
/**
* Create a successful unified response
*/
export declare function createSuccessResponse<T>(data: T, toolName: string, options?: {
executionTimeMs?: number;
requestId?: string;
}): UnifiedResponse<T>;
/**
* Create an error unified response
*/
export declare function createErrorResponse(error: string, toolName: string, options?: {
requestId?: string;
}): UnifiedResponse<never>;
/**
* Convert unified response to MCP CallToolResult format
*/
export declare function toCallToolResult(unifiedResponse: UnifiedResponse): CallToolResult;
/**
* Alias for toCallToolResult to maintain test compatibility
*/
export declare const toToolResponse: typeof toCallToolResult;
/**
* Simple wrapper to convert any tool handler to use unified responses
*/
export declare function withUnifiedResponse<T extends (...args: any[]) => Promise<CallToolResult>>(handler: T, toolName: string): T;
/**
* Type guard to check if a response is a unified response
*/
export declare function isUnifiedResponse(obj: any): obj is UnifiedResponse;
//# sourceMappingURL=unified-response.d.ts.map