Skip to main content
Glama
jakedx6
by jakedx6

get_document_collaboration

Retrieve collaboration history and current collaborators for a document, including recent activity within a specified time range.

Instructions

Get collaboration history and current collaborators for a document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesID of the document
include_activityNoWhether to include recent activity
time_rangeNoTime range for activityweek

Implementation Reference

  • Main handler function that executes the get_document_collaboration tool logic: validates input, fetches document and collaborations via supabaseService, retrieves activity, analyzes patterns, and returns structured response.
    export const getDocumentCollaboration = requireAuth(async (args: any) => { const { document_id, include_activity, time_range } = GetDocumentCollaborationSchema.parse(args) logger.info('Getting document collaboration', { document_id, time_range }) const document = await supabaseService.getDocument(document_id) if (!document) { throw new Error('Document not found') } // Get collaborators const collaborations = await supabaseService.getDocumentCollaborations(document_id) // Get activity if requested let activity = [] if (include_activity) { activity = await getDocumentActivity(document_id, time_range) } // Analyze collaboration patterns const collaborationStats = analyzeCollaborationPatterns(collaborations, activity) return { document: { id: document.id, title: document.title, created_by: document.created_by }, collaborators: collaborations.map(c => ({ user_id: c.user_id, permission_level: c.permission_level, status: c.status, joined_at: c.invited_at, last_activity: activity.filter(a => a.user_id === c.user_id)[0]?.timestamp })), activity: activity.slice(0, 50), // Limit to 50 recent activities statistics: collaborationStats } })
  • Zod schema used for input validation and parsing in the tool handler.
    const GetDocumentCollaborationSchema = z.object({ document_id: z.string().min(1), include_activity: z.boolean().default(true), time_range: z.enum(['day', 'week', 'month', 'all']).default('week') })
  • Registration of document tool handlers, mapping 'get_document_collaboration' to its handler function.
    export const documentHandlers = { list_documents: listDocuments, create_document: createDocument, get_document: getDocument, update_document: updateDocument, search_documents: searchDocuments, get_document_context: getDocumentContext, add_document_collaborator: addDocumentCollaborator, analyze_document_content: analyzeDocumentContent, get_document_collaboration: getDocumentCollaboration, generate_document_template: generateDocumentTemplate, bulk_document_operations: bulkDocumentOperations }
  • MCPTool definition for get_document_collaboration, including name, description, and input schema.
    export const getDocumentCollaborationTool: MCPTool = { name: 'get_document_collaboration', description: 'Get collaboration history and current collaborators for a document', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'ID of the document' }, include_activity: { type: 'boolean', default: true, description: 'Whether to include recent activity' }, time_range: { type: 'string', enum: ['day', 'week', 'month', 'all'], default: 'week', description: 'Time range for activity' } }, required: ['document_id'] } }
  • Helper method in supabaseService/apiClient called by the tool handler to fetch collaborations (currently stubbed).
    async getDocumentCollaborations(documentId: string): Promise<any[]> { logger.warn('Document collaborations not yet implemented in API') return [] }

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/jakedx6/helios9-MCP-Server'

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