Skip to main content
Glama

decide_assign_context

Assign contexts to tasks or projects within the Decide realm of the ADD framework, enabling structured organization and workflow management.

Instructions

Assign contexts to tasks/projects in Decide realm.

Input Schema

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

Implementation Reference

  • Core handler for 'decide_assign_context' tool. Validates item exists and is in Decide realm (ID=2), simulates CloudKit update to set context reference on Task/Project, returns confirmation message. Uses mockFetchItem helper.
    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:428-439 (registration)
    Tool registration in ListToolsRequestSchema response. Defines name, description, and input schema for decide_assign_context.
    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'] } },
  • Dispatch handler in CallToolRequestSchema switch statement. Validates arguments and calls the main 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);
  • Helper function used by assignContextToItem to mock-fetch item data from CloudKit for realm validation. Simulates different realm states based on recordName patterns.
    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