Skip to main content
Glama

dooray_files

Manage Dooray project files by listing task attachments, retrieving file metadata, and downloading content from tasks or drive storage.

Instructions

Manage Dooray files and images - list task files, get file metadata, download file content from tasks or directly by content ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform on files
taskIdNoTask ID (required for task file actions)
fileIdNoFile ID (required for file operations)
projectIdNoProject ID (optional - uses default from environment if not provided, required for task file actions)

Implementation Reference

  • Core handler function for the dooray_files tool. Dispatches to specific action handlers based on the 'action' parameter.
    async def handle(self, arguments: Dict[str, Any]) -> str: """Handle files tool requests. Args: arguments: Tool arguments containing action and parameters Returns: JSON string with results """ action = arguments.get("action") if not action: return json.dumps({"error": "Action parameter is required"}) try: if action == "list_task_files": return await self._list_task_files(arguments) elif action == "get_task_file_metadata": return await self._get_task_file_metadata(arguments) elif action == "get_task_file_content": return await self._get_task_file_content(arguments) elif action == "get_drive_file_metadata": return await self._get_drive_file_metadata(arguments) elif action == "get_drive_file_content": return await self._get_drive_file_content(arguments) else: return json.dumps({"error": f"Unknown action: {action}"}) except Exception as e: logger.error(f"Error in files tool: {e}") return json.dumps({"error": str(e)})
  • Input schema and tool description for dooray_files, defining available actions and parameters.
    types.Tool( name="dooray_files", description="Manage Dooray files and images - list task files, get file metadata, download file content from tasks or directly by content ID", inputSchema={ "type": "object", "properties": { "action": { "type": "string", "enum": ["list_task_files", "get_task_file_metadata", "get_task_file_content", "get_drive_file_metadata", "get_drive_file_content"], "description": "Action to perform on files" }, "taskId": { "type": "string", "description": "Task ID (required for task file actions)" }, "fileId": { "type": "string", "description": "File ID (required for file operations)" }, "projectId": { "type": "string", "description": "Project ID (optional - uses default from environment if not provided, required for task file actions)" } }, "required": ["action"] } ),
  • Registration in the tool dispatcher: instantiates FilesTool and calls its handle method for dooray_files invocations.
    elif name == "dooray_files": tool = FilesTool(dooray_client) result = await tool.handle(args)
  • Helper method implementing file download from task attachments, including saving to temporary directory with safe filename.
    async def _get_task_file_content(self, arguments: Dict[str, Any]) -> str: """Get content of a file attached to a task and save to temporary file.""" project_id = arguments.get("projectId") task_id = arguments.get("taskId") file_id = arguments.get("fileId") if not project_id or not task_id or not file_id: return json.dumps({"error": "projectId, taskId, and fileId are required for get_task_file_content action"}) try: # Get file metadata first to get filename metadata = await self.client.get_task_file_metadata(project_id, task_id, file_id) filename = metadata.get("result", {}).get("name", f"file_{file_id}") # Download file content content = await self.client.get_task_file_content(project_id, task_id, file_id) # Create temporary file temp_dir = tempfile.gettempdir() dooray_temp_dir = os.path.join(temp_dir, "dooray_files") os.makedirs(dooray_temp_dir, exist_ok=True) # Use original filename but ensure it's safe safe_filename = self._make_safe_filename(filename) temp_file_path = os.path.join(dooray_temp_dir, f"{task_id}_{file_id}_{safe_filename}") # Write content to file with open(temp_file_path, 'wb') as f: f.write(content) result = { "file_path": temp_file_path, "filename": filename, "size": len(content), "content_type": "file", "task_id": task_id, "file_id": file_id } return json.dumps(result, ensure_ascii=False) except Exception as e: logger.error(f"Error downloading task file: {e}") return json.dumps({"error": f"Failed to download file: {str(e)}"})
  • Helper method to list files attached to a specific task.
    async def _list_task_files(self, arguments: Dict[str, Any]) -> str: """List files attached to a task.""" project_id = arguments.get("projectId") task_id = arguments.get("taskId") if not project_id or not task_id: return json.dumps({"error": "projectId and taskId are required for list_task_files action"}) result = await self.client.list_task_files(project_id, task_id) return json.dumps(result, ensure_ascii=False)

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/tallpizza/dooray-mcp'

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