Skip to main content
Glama
niko91i

Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP

by niko91i

check_response_status

Monitor the progress of a response generation task using the task ID. Ensures real-time updates on task status within a two-stage AI processing system.

Instructions

Check the status of a response generation task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe task ID returned by generate_response

Implementation Reference

  • Main handler logic for the 'check_response_status' tool. Validates arguments, retrieves task status from activeTasks map, handles timeout and max attempts checks, updates polling metadata, and returns JSON status with suggested next check interval.
    } else if (request.params.name === "check_response_status") { if (!isValidCheckResponseStatusArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, "Invalid check_response_status arguments" ); } const taskId = request.params.arguments.taskId; const task = this.activeTasks.get(taskId); if (!task) { throw new McpError( ErrorCode.InvalidRequest, `No task found with ID: ${taskId}` ); } // Vérifier si la tâche a expiré const currentTime = Date.now(); if (currentTime - task.timestamp > TASK_TIMEOUT_MS) { const updatedTask = { ...task, status: "error" as const, error: `Tâche expirée après ${TASK_TIMEOUT_MS / 60000} minutes` }; this.activeTasks.set(taskId, updatedTask); return { content: [ { type: "text", text: JSON.stringify({ status: updatedTask.status, reasoning: updatedTask.showReasoning ? updatedTask.reasoning : undefined, response: undefined, error: updatedTask.error, timeoutAfter: TASK_TIMEOUT_MS / 60000 }) } ] }; } // Mettre à jour les propriétés de suivi const checkAttempts = (task.checkAttempts || 0) + 1; // Vérifier si nous avons atteint le nombre maximal de tentatives if (checkAttempts > MAX_STATUS_CHECK_ATTEMPTS && task.status !== "complete" && task.status !== "error") { const updatedTask = { ...task, status: "error" as const, error: `Nombre maximum de tentatives atteint (${MAX_STATUS_CHECK_ATTEMPTS})`, checkAttempts }; this.activeTasks.set(taskId, updatedTask); return { content: [ { type: "text", text: JSON.stringify({ status: updatedTask.status, reasoning: updatedTask.showReasoning ? updatedTask.reasoning : undefined, response: undefined, error: updatedTask.error, maxAttempts: MAX_STATUS_CHECK_ATTEMPTS }) } ] }; } // Calculer le délai avant la prochaine vérification (backoff exponentiel) let nextCheckDelay = task.nextCheckDelay || INITIAL_STATUS_CHECK_DELAY_MS; nextCheckDelay = Math.min(nextCheckDelay * STATUS_CHECK_BACKOFF_FACTOR, MAX_STATUS_CHECK_DELAY_MS); // Mettre à jour le statut de la tâche const updatedTask = { ...task, lastChecked: currentTime, nextCheckDelay, checkAttempts }; this.activeTasks.set(taskId, updatedTask); return { content: [ { type: "text", text: JSON.stringify({ status: task.status, reasoning: task.showReasoning ? task.reasoning : undefined, response: task.status === "complete" ? task.response : undefined, error: task.error, nextCheckIn: Math.round(nextCheckDelay / 1000), // Temps suggéré en secondes checkAttempts, elapsedTime: Math.round((currentTime - task.timestamp) / 1000) // Temps écoulé en secondes }), }, ], };
  • TypeScript interface defining the input arguments for the check_response_status tool (taskId: string).
    interface CheckResponseStatusArgs { taskId: string; }
  • src/index.ts:338-350 (registration)
    Tool registration in the ListToolsRequestSchema handler, including name, description, and inputSchema matching the CheckResponseStatusArgs interface.
    name: "check_response_status", description: "Check the status of a response generation task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "The task ID returned by generate_response", }, }, required: ["taskId"], }, },
  • Type guard function for validating input arguments conform to CheckResponseStatusArgs.
    const isValidCheckResponseStatusArgs = ( args: any ): args is CheckResponseStatusArgs => typeof args === "object" && args !== null && typeof args.taskId === "string";
  • Interface defining the structure of task status objects used by the check_response_status handler for polling and state management.
    interface TaskStatus { status: "pending" | "reasoning" | "responding" | "complete" | "error"; prompt: string; showReasoning?: boolean; reasoning?: string; response?: string; error?: string; timestamp: number; // Nouvelles propriétés pour gérer le polling lastChecked?: number; nextCheckDelay?: number; checkAttempts?: number; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/niko91i/MCP-deepseek-V3-et-claude-desktop'

If you have feedback or need assistance with the MCP directory API, please join our Discord server