Skip to main content
Glama
landicefu

Divide and Conquer MCP Server

by landicefu

update_context

Update context information across all tasks to maintain consistency and alignment in complex workflows.

Instructions

Updates the context information for all tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_for_all_tasksYesThe new context information for all tasks

Implementation Reference

  • The handler function that implements the logic for the 'update_context' tool. It validates input, reads current task data, updates the context_for_all_tasks field, persists the changes, and returns a success or error response.
    // Update the context for all tasks
    private async updateContext(args: any): Promise<any> {
      if (!args?.context_for_all_tasks) {
        throw new McpError(ErrorCode.InvalidParams, 'Context for all tasks is required');
      }
    
      try {
        const taskData = await this.readTaskData();
        
        // Update the context for all tasks
        taskData.context_for_all_tasks = args.context_for_all_tasks;
        
        // Write the updated task data to the file
        await this.writeTaskData(taskData);
        
        return {
          content: [
            {
              type: 'text',
              text: 'Context updated successfully.',
            },
          ],
        };
      } catch (error) {
        console.error('Error updating context:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error updating context: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema definition for the 'update_context' tool, specifying that it takes a 'context_for_all_tasks' string.
    {
      name: 'update_context',
      description: 'Updates the context information for all tasks.',
      inputSchema: {
        type: 'object',
        properties: {
          context_for_all_tasks: {
            type: 'string',
            description: 'The new context information for all tasks'
          }
        },
        required: ['context_for_all_tasks']
      }
    },
  • src/index.ts:428-429 (registration)
    The switch case in the CallToolRequestSchema handler that dispatches calls to the 'update_context' tool to the updateContext method.
    case 'update_context':
      return await this.updateContext(request.params.arguments);

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/landicefu/divide-and-conquer-mcp-server'

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