Skip to main content
Glama
jakedx6
by jakedx6

add_document_collaborator

Grant document access to users by assigning read, comment, edit, or admin permissions to enable collaborative work.

Instructions

Add a collaborator to a document with specific permissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesID of the document
user_idYesID of the user to add as collaborator
permission_levelNoPermission level for the collaboratoredit
notifyNoWhether to notify the user about collaboration invite

Implementation Reference

  • The main handler function that executes the tool logic: validates args, fetches document, creates collaboration record, and returns results.
    export const addDocumentCollaborator = requireAuth(async (args: any) => { const { document_id, user_id, permission_level, notify } = AddDocumentCollaboratorSchema.parse(args) logger.info('Adding document collaborator', { document_id, user_id, permission_level }) // Get document and verify permissions const document = await supabaseService.getDocument(document_id) if (!document) { throw new Error('Document not found') } // Create collaboration record const collaboration = await supabaseService.createDocumentCollaboration({ document_id, user_id, permission_level, status: 'active', invited_at: new Date().toISOString() }) // Note: metadata field doesn't exist in the database schema // Collaboration would be tracked in a separate table return { collaboration, document: await supabaseService.getDocument(document_id), message: `User added as ${permission_level} collaborator` } })
  • Zod input validation schema used by the handler for parsing arguments.
    const AddDocumentCollaboratorSchema = z.object({ document_id: z.string().min(1), user_id: z.string().min(1), permission_level: z.enum(['read', 'comment', 'edit', 'admin']).default('edit'), notify: z.boolean().default(true) })
  • MCPTool object definition exporting the tool name, description, and input schema for registration.
    export const addDocumentCollaboratorTool: MCPTool = { name: 'add_document_collaborator', description: 'Add a collaborator to a document with specific permissions', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'ID of the document' }, user_id: { type: 'string', description: 'ID of the user to add as collaborator' }, permission_level: { type: 'string', enum: ['read', 'comment', 'edit', 'admin'], default: 'edit', description: 'Permission level for the collaborator' }, notify: { type: 'boolean', default: true, description: 'Whether to notify the user about collaboration invite' } }, required: ['document_id', 'user_id'] } }
  • Registration of the handler function under its tool name in the documentHandlers export map.
    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 }
  • Export of all document tools including addDocumentCollaboratorTool for top-level registration.
    export const documentTools = { listDocumentsTool, createDocumentTool, getDocumentTool, updateDocumentTool, searchDocumentsTool, getDocumentContextTool, addDocumentCollaboratorTool, analyzeDocumentContentTool, getDocumentCollaborationTool, generateDocumentTemplateTool, bulkDocumentOperationsTool }

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