mcp-cisco-support
Version:
MCP server for Cisco Support APIs including Bug Search and future tools
79 lines • 2.51 kB
TypeScript
/**
* Progress Notification Utilities
*
* Provides progress notification functionality for long-running MCP tool operations.
* Sends notifications/progress messages to clients that support them.
*/
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
/**
* Initialize the progress notification system with an MCP server instance
* @param server - The MCP server instance to use for notifications
*/
export declare function initializeProgressNotifications(server: Server): void;
/**
* Send a progress notification to the client
*
* @param progressToken - Optional progress token from the client request
* @param progress - Current progress value (e.g., 1, 2, 3)
* @param total - Total number of steps (e.g., 5)
*
* @example
* ```typescript
* // Multi-step operation
* sendProgress(meta?.progressToken, 0, 5); // Starting
* sendProgress(meta?.progressToken, 1, 5); // 20% complete
* sendProgress(meta?.progressToken, 2, 5); // 40% complete
* sendProgress(meta?.progressToken, 5, 5); // 100% complete
* ```
*/
export declare function sendProgress(progressToken: string | undefined, progress: number, total: number): void;
/**
* Create a progress tracker for multi-step operations
*
* @param progressToken - Optional progress token from the client request
* @param totalSteps - Total number of steps in the operation
* @returns Object with methods to track progress
*
* @example
* ```typescript
* const tracker = createProgressTracker(meta?.progressToken, 5);
* tracker.start(); // 0/5
* await doStep1();
* tracker.increment(); // 1/5
* await doStep2();
* tracker.increment(); // 2/5
* tracker.complete(); // 5/5
* ```
*/
export declare function createProgressTracker(progressToken: string | undefined, totalSteps: number): {
/**
* Start tracking (sends initial 0 progress)
*/
start: () => void;
/**
* Increment progress by one step
*/
increment: () => void;
/**
* Set progress to a specific step
*/
setProgress: (step: number) => void;
/**
* Mark operation as complete (sends total progress)
*/
complete: () => void;
/**
* Get current progress state
*/
getProgress: () => {
current: number;
total: number;
percentage: number;
};
};
/**
* Check if progress notifications are supported/enabled
* @returns True if progress notifications can be sent
*/
export declare function canSendProgress(): boolean;
//# sourceMappingURL=progress.d.ts.map