get_initiative_context
Retrieve in-depth context about an initiative, including its place in the project hierarchy and associated documents, for AI-powered project management.
Instructions
Get rich context about an initiative for AI understanding
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| initiative_id | Yes | The unique identifier of the initiative |
Implementation Reference
- src/tools/initiatives.ts:371-379 (handler)The getInitiativeContext handler function that executes the tool logic. It parses the initiative_id from args using GetInitiativeSchema, logs the request, calls supabaseService.getInitiativeContext(initiative_id), and returns {context}.
export const getInitiativeContext = requireAuth(async (args: any) => { const { initiative_id } = GetInitiativeSchema.parse(args) logger.info('Getting initiative context for AI', { initiative_id }) const context = await supabaseService.getInitiativeContext(initiative_id) return { context } }) - src/tools/initiatives.ts:355-369 (schema)Tool registration/definition with name 'get_initiative_context', description, and inputSchema requiring initiative_id (UUID format).
export const getInitiativeContextTool: MCPTool = { name: 'get_initiative_context', description: 'Get rich context about an initiative for AI understanding', inputSchema: { type: 'object', properties: { initiative_id: { type: 'string', format: 'uuid', description: 'The unique identifier of the initiative' } }, required: ['initiative_id'] } } - src/tools/initiatives.ts:22-24 (helper)The GetInitiativeSchema Zod schema used for input validation. It validates that initiative_id is a UUID string. This schema is shared with the getInitiative handler.
const GetInitiativeSchema = z.object({ initiative_id: z.string().uuid() }) - src/tools/initiatives.ts:630-642 (registration)Registration of getInitiativeContext under the 'get_initiative_context' key in the initiativeHandlers object, which gets merged into allHandlers in src/index.ts.
export const initiativeHandlers = { list_initiatives: listInitiatives, get_initiative: getInitiative, create_initiative: createInitiative, update_initiative: updateInitiative, get_initiative_context: getInitiativeContext, get_initiative_insights: getInitiativeInsights, search_workspace: searchWorkspace, get_enhanced_project_context: getEnhancedProjectContext, get_workspace_context: getWorkspaceContext, associate_document_with_initiative: associateDocumentWithInitiative, disassociate_document_from_initiative: disassociateDocumentFromInitiative } - src/lib/api-client.ts:543-546 (helper)The SupabaseService.getInitiativeContext method that makes an API request to /api/mcp/initiatives/${initiativeId}/context and returns the context data.
async getInitiativeContext(initiativeId: string): Promise<any> { const response = await this.request<{ context: any }>(`/api/mcp/initiatives/${initiativeId}/context`) return response.context }