associate_document_with_initiative
Link existing documents to initiatives for better project organization and tracking within the Helios-9 MCP Server.
Instructions
Link an existing document to an initiative
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| initiative_id | Yes | The initiative ID to associate the document with | |
| document_id | Yes | The document ID to associate with the initiative |
Implementation Reference
- src/tools/initiatives.ts:549-568 (handler)Main handler function that validates input parameters (initiative_id and document_id), logs the action, calls the supabaseService to perform the association, and returns a success response.export const associateDocumentWithInitiative = requireAuth(async (args: any) => { const { initiative_id, document_id } = z.object({ initiative_id: z.string().uuid(), document_id: z.string().uuid() }).parse(args) logger.info('Associating document with initiative', { initiative_id, document_id }) // Call the API to create the association const response = await supabaseService.associateDocumentWithInitiative(initiative_id, document_id) logger.info('Document associated with initiative successfully') return { success: true, message: `Document successfully associated with initiative`, initiative_id, document_id } })
- src/tools/initiatives.ts:528-547 (schema)Tool definition including name, description, and input schema requiring initiative_id and document_id as UUID strings.export const associateDocumentWithInitiativeTool: MCPTool = { name: 'associate_document_with_initiative', description: 'Link an existing document to an initiative', inputSchema: { type: 'object', properties: { initiative_id: { type: 'string', format: 'uuid', description: 'The initiative ID to associate the document with' }, document_id: { type: 'string', format: 'uuid', description: 'The document ID to associate with the initiative' } }, required: ['initiative_id', 'document_id'] } }
- src/tools/initiatives.ts:630-642 (registration)Registration of the tool handler in the initiativeHandlers object, mapping 'associate_document_with_initiative' to its handler function.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/tools/initiatives.ts:616-628 (registration)Registration of the tool schema in the initiativeTools object.export const initiativeTools = { listInitiativesTool, getInitiativeTool, createInitiativeTool, updateInitiativeTool, getInitiativeContextTool, getInitiativeInsightsTool, searchWorkspaceTool, getEnhancedProjectContextTool, getWorkspaceContextTool, associateDocumentWithInitiativeTool, disassociateDocumentFromInitiativeTool }
- src/lib/api-client.ts:566-574 (helper)Helper method in API client (supabaseService) that makes the HTTP POST request to the backend API to associate a document with an initiative.async associateDocumentWithInitiative(initiativeId: string, documentId: string): Promise<any> { const response = await this.request<{ success: boolean }>(`/api/mcp/initiatives/${initiativeId}/documents`, { method: 'POST', body: JSON.stringify({ document_id: documentId }), }) logger.info(`Document ${documentId} associated with initiative ${initiativeId}`) return response }