Skip to main content
Glama

download_all_attachments

Download all attachments from a specified JIRA issue to your local system. Simplifies file management and ensures quick access to related documents.

Instructions

下载JIRA问题的所有附件到本地

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_keyYes

Implementation Reference

  • The main MCP tool handler function `download_all_attachments` that downloads all attachments for the given JIRA issue key to the local directory `~/.jira_mcp/<issue_key>/`, reporting success/failures and local paths.
    @mcp.tool( description="下载JIRA问题的所有附件到本地", ) def download_all_attachments( issue_key: str, ) -> Dict[str, Any]: """下载JIRA问题的所有附件到本地. Args: issue_key: JIRA问题键 Returns: Dict[str, Any]: 下载结果 """ logger.info(f"下载问题所有附件: {issue_key}") try: client = get_jira_client() issue = client.issue(issue_key) downloads = [] failed = [] # 获取附件列表 attachments = [] if hasattr(issue.fields, "attachment") and issue.fields.attachment: attachments = issue.fields.attachment if not attachments: return { "issue_key": issue_key, "message": "此问题没有附件", "total": 0, "downloads": [] } # 为此问题创建目录 issue_dir = os.path.join(ATTACHMENTS_DIR, issue_key) os.makedirs(issue_dir, exist_ok=True) # 下载每个附件 for attachment in attachments: try: file_path = os.path.join(issue_dir, attachment.filename) # 下载内容 content = attachment.get() # 保存到文件 with open(file_path, "wb") as f: f.write(content) downloads.append({ "id": attachment.id, "filename": attachment.filename, "size": os.path.getsize(file_path), "content_type": attachment.mimeType, "local_path": file_path }) except Exception as e: logger.error(f"下载附件 {attachment.filename} 失败: {str(e)}") failed.append({ "filename": attachment.filename, "error": str(e) }) return { "issue_key": issue_key, "total": len(attachments), "success": len(downloads), "failed": len(failed), "download_dir": issue_dir, "downloads": downloads, "failures": failed if failed else None } except Exception as e: logger.error(f"下载问题 {issue_key} 的所有附件失败: {str(e)}") return {"error": str(e)}

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/yuezheng2006/mcp-server-jira'

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