timeout-test
Test and prevent timeouts by executing processes for a specified duration, ensuring system stability and performance optimization with accurate timing simulations.
Instructions
Test timeout prevention by running for a specified duration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | Yes | Duration in milliseconds (minimum 10ms) |
Implementation Reference
- src/tools/timeout-test.tool.ts:16-37 (handler)The main 'execute' function implementing the tool logic: sleeps incrementally with progress updates to test timeout handling.execute: async (args, onProgress) => { const duration = args.duration as number; const steps = Math.ceil(duration / 5000); // Progress every 5 seconds const stepDuration = duration / steps; const startTime = Date.now(); const results: string[] = []; results.push(`Starting timeout test for ${duration}ms (${duration/1000}s)`); for (let i = 1; i <= steps; i++) { await new Promise(resolve => setTimeout(resolve, stepDuration)); const elapsed = Date.now() - startTime; results.push(`Step ${i}/${steps} completed - Elapsed: ${Math.round(elapsed/1000)}s`); } const totalElapsed = Date.now() - startTime; results.push(`\nTimeout test completed successfully!`); results.push(`Target duration: ${duration}ms`); results.push(`Actual duration: ${totalElapsed}ms`); return results.join('\n'); }
- src/tools/timeout-test.tool.ts:4-6 (schema)Zod input schema defining the 'duration' parameter for the tool.const timeoutTestArgsSchema = z.object({ duration: z.number().min(10).describe("Duration in milliseconds (minimum 10ms)"), });
- src/tools/index.ts:7-16 (registration)Import and registration of the timeoutTestTool into the toolRegistry.import { timeoutTestTool } from './timeout-test.tool.js'; toolRegistry.push( askGeminiTool, pingTool, helpTool, brainstormTool, fetchChunkTool, timeoutTestTool );