get_projects
Retrieve a list of JIRA projects using the Personal JIRA MCP server, enabling efficient project management and task tracking through a standardized interface.
Instructions
获取JIRA项目列表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/jira_mcp/server.py:392-420 (handler)The primary handler function for the 'get_projects' MCP tool. It is decorated with @mcp.tool which also serves as the registration. The function fetches all JIRA projects using the JIRA client API and formats them into a dictionary containing a list of projects with their id, key, name, and lead information. Handles exceptions by returning an error message.@mcp.tool( description="获取JIRA项目列表", ) def get_projects() -> Dict[str, Any]: """获取所有项目列表. Returns: Dict[str, Any]: 项目列表 """ logger.info("获取项目列表") try: client = get_jira_client() projects = client.projects() result = [ { "id": project.id, "key": project.key, "name": project.name, "lead": getattr(project, "lead", {}).get("displayName", ""), } for project in projects ] return {"projects": result} except Exception as e: logger.error(f"获取项目列表失败: {str(e)}") return {"error": str(e)}