Skip to main content
Glama

decide_assign_context

Assign specified contexts to tasks or projects within the Decide realm, ensuring proper organization and alignment with the ADD (Assess-Decide-Do) framework for efficient task management.

Instructions

Assign contexts to tasks/projects in Decide realm.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextRecordNameYesRecord name of the context to assign
itemRecordNameYesRecord name of the task or project
itemTypeYesType of item (Task or Project)

Implementation Reference

  • Core handler function that implements the 'decide_assign_context' tool logic: validates the target item is in Decide realm (ID 2), then assigns the context (currently mock implementation).
    private async assignContextToItem(itemRecordName: string, itemType: 'Task' | 'Project', contextRecordName: string) { // Validate that item is in Decide realm before assigning context const item = await this.mockFetchItem(itemRecordName, itemType); if (!item) { throw new McpError(ErrorCode.InvalidParams, `${itemType} ${itemRecordName} not found`); } if (item.realmId !== REALM_DECIDE_ID) { throw new McpError(ErrorCode.InvalidParams, `${itemType} ${itemRecordName} must be in Decide realm to assign context. Current realm: ${item.realmId}`); } // Mock update: console.log('Mock CloudKit: Assigning context', contextRecordName, 'to', itemType, itemRecordName); return { content: [{ type: 'text', text: `Context ${contextRecordName} assigned to ${itemType} ${itemRecordName} in Decide realm.` }] };
  • src/index.ts:703-708 (registration)
    MCP CallToolRequestSchema switch case that handles 'decide_assign_context' calls and dispatches to the assignContextToItem handler.
    case 'decide_assign_context': this.validateArgs(args, ['itemRecordName', 'itemType', 'contextRecordName']); if (!['Task', 'Project'].includes(args.itemType)) { throw new McpError(ErrorCode.InvalidParams, "itemType must be 'Task' or 'Project'."); } return await this.assignContextToItem(args.itemRecordName, args.itemType as 'Task' | 'Project', args.contextRecordName);
  • Tool schema and metadata definition returned in ListToolsRequestSchema response.
    name: 'decide_assign_context', description: 'Assign contexts to tasks/projects in Decide realm.', inputSchema: { type: 'object', properties: { itemRecordName: { type: 'string', description: 'Record name of the task or project' }, itemType: { type: 'string', enum: ['Task', 'Project'], description: 'Type of item (Task or Project)' }, contextRecordName: { type: 'string', description: 'Record name of the context to assign' } }, required: ['itemRecordName', 'itemType', 'contextRecordName'] }
  • Helper function mockFetchItem called by the handler to simulate fetching item data from CloudKit for realm validation.
    private async mockFetchItem(itemRecordName: string, itemType: 'Task' | 'Project'): Promise<any> { // Mock different scenarios based on record name patterns const baseItem = { recordName: itemRecordName, type: itemType, lastModified: new Date().toISOString() }; // Simulate different states for validation testing if (itemRecordName.includes('assess')) { return { ...baseItem, realmId: REALM_ASSESS_ID, contextRecordName: null, endDate: null }; } else if (itemRecordName.includes('undecided')) { return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: null, endDate: null }; } else if (itemRecordName.includes('stalled')) { const yesterday = new Date(Date.now() - 86400000).toISOString(); return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: 'context_work', endDate: yesterday }; } else if (itemRecordName.includes('ready')) { const tomorrow = new Date(Date.now() + 86400000).toISOString(); return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: 'context_work', endDate: tomorrow }; } else if (itemRecordName.includes('do')) { const today = new Date().toISOString(); return { ...baseItem, realmId: REALM_DO_ID, contextRecordName: 'context_work', endDate: today }; } else { // Default to Assess realm item return { ...baseItem, realmId: REALM_ASSESS_ID, contextRecordName: null, endDate: null }; }

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/dragosroua/addtaskmanager-mcp-server'

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