Skip to main content
Glama

update_task

Modify task details like status, hours, and notes in the Revenue Engine MCP system to track progress and maintain accurate business management records.

Instructions

Update a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYes
statusNo
actualHoursNo
notesNo

Implementation Reference

  • Handler for the 'update_task' MCP tool. Dispatches to the shared callAPI helper with action 'updateTask' and tool arguments.
    case "update_task":
      result = await callAPI("updateTask", args);
      break;
  • Input schema defining parameters for the 'update_task' tool: taskId (required), status, actualHours, notes.
    inputSchema: {
      type: "object",
      properties: {
        taskId: { type: "number" },
        status: { type: "string", enum: ["To Do", "In Progress", "Completed", "Blocked"] },
        actualHours: { type: "number" },
        notes: { type: "string" },
      },
      required: ["taskId"],
    },
  • index.js:288-301 (registration)
    Registration of the 'update_task' tool in the MCP server's tool list, including name, description, and schema.
    {
      name: "update_task",
      description: "Update a task",
      inputSchema: {
        type: "object",
        properties: {
          taskId: { type: "number" },
          status: { type: "string", enum: ["To Do", "In Progress", "Completed", "Blocked"] },
          actualHours: { type: "number" },
          notes: { type: "string" },
        },
        required: ["taskId"],
      },
    },
  • Shared helper function callAPI used by update_task (and other tools) to POST requests to the Google Apps Script backend API with the specified action and parameters.
    async function callAPI(action, data = {}) {
      debugLog('=== API CALL START ===');
      debugLog(`Action: ${action}`);
      debugLog(`Data: ${JSON.stringify(data)}`);
    
      try {
        // Build form-encoded body for POST
        const formData = new URLSearchParams();
        formData.append('action', action);
    
        // Add all data fields to form
        for (const [key, value] of Object.entries(data)) {
          if (value !== undefined && value !== null) {
            formData.append(key, value.toString());
          }
        }
    
        const formString = formData.toString();
        debugLog(`FormData: ${formString}`);
        debugLog(`API_URL: ${API_URL}`);
    
        // Use POST with proper content type
        const response = await fetch(API_URL, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
          body: formString
        });
    
        debugLog(`Response status: ${response.status}`);
        debugLog(`Response ok: ${response.ok}`);
    
        if (!response.ok) {
          debugLog(`Response not OK: ${response.status} ${response.statusText}`);
          throw new Error(`API request failed: ${response.status} ${response.statusText}`);
        }
    
        const text = await response.text();
        debugLog(`Response text length: ${text.length}`);
        debugLog(`Response text: ${text}`);
    
        if (!text) {
          debugLog('ERROR: Empty response from API');
          throw new Error('Empty response from API');
        }
    
        const parsed = JSON.parse(text);
        debugLog(`Parsed successfully: ${JSON.stringify(parsed)}`);
        debugLog('=== API CALL END ===');
        return parsed;
    
      } catch (error) {
        debugLog(`ERROR in callAPI: ${error.message}`);
        debugLog(`ERROR stack: ${error.stack}`);
        throw error;
      }
    }

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/PromptishOperations/mcpSpec'

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