Skip to main content
Glama
niko91i

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

by niko91i

check_response_status

Monitor the progress of AI response generation tasks to track completion status and retrieve results when ready.

Instructions

Check the status of a response generation task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe task ID returned by generate_response

Implementation Reference

  • The handler logic for the 'check_response_status' tool within the CallToolRequestSchema request handler. It validates input, retrieves the task status from activeTasks map, checks for timeouts and maximum check attempts, implements exponential backoff for polling delays, updates task metadata, and returns the current status, reasoning/response if available, error if any, and 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
            }),
          },
        ],
      };
  • src/index.ts:337-350 (registration)
    Registration of the 'check_response_status' tool in the server's listTools response, specifying name, description, and input schema.
    {
      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"],
      },
    },
  • TypeScript interface defining the input schema for check_response_status arguments.
    interface CheckResponseStatusArgs {
      taskId: string;
    }
  • Helper function for validating check_response_status arguments against the CheckResponseStatusArgs interface.
    const isValidCheckResponseStatusArgs = (
      args: any
    ): args is CheckResponseStatusArgs =>
      typeof args === "object" && args !== null && typeof args.taskId === "string";
  • TypeScript interface defining the TaskStatus structure used by the check_response_status handler for tracking and returning task state.
    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;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool checks status but doesn't explain what the status values mean, whether it's read-only or has side effects, or any rate limits or authentication needs. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to grasp immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (checking task status) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what status information is returned, potential outcomes, or error conditions, leaving the agent without enough context to fully understand the tool's behavior and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'taskId' parameter clearly documented as 'The task ID returned by generate_response.' The description adds no additional parameter semantics beyond this, so it meets the baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('check') and resource ('status of a response generation task'), making it immediately understandable. However, it doesn't explicitly differentiate from its sibling tool 'generate_response' beyond the implied relationship, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by referencing 'taskId returned by generate_response,' suggesting this tool should be used after initiating a task with its sibling. However, it lacks explicit guidance on when to use it versus alternatives or any prerequisites beyond the task ID, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools