Skip to main content
Glama
dev-in-black

OpenProject MCP Server

by dev-in-black

get_work_package_activities

Retrieve activities and comments for a work package to track progress and collaboration history.

Instructions

Retrieve all activities and comments for a work package.

Args:
    work_package_id: Work package ID
    page: Page number (default: 1)
    page_size: Items per page (default: 20)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
work_package_idYes
pageNo
page_sizeNo

Implementation Reference

  • The core handler function that retrieves activities for the specified work package using the OpenProject API, formats them into a markdown summary, and returns it.
    async def get_work_package_activities(
        work_package_id: int, page: int = 1, page_size: int = 20
    ) -> str:
        """Retrieve all activities and comments for a work package.
    
        Args:
            work_package_id: Work package ID
            page: Page number (default: 1)
            page_size: Items per page (default: 20)
    
        Returns:
            Formatted markdown string with activities summary
        """
        client = OpenProjectClient()
    
        try:
            params = {
                "pageSize": page_size,
                "offset": (page - 1) * page_size,
            }
    
            result = await client.get(
                f"work_packages/{work_package_id}/activities", params=params
            )
    
            # Extract metadata
            total = result.get("total", 0)
            count = result.get("count", 0)
    
            # Get activities
            activities = get_embedded_collection(result, "elements")
    
            # Format as markdown
            markdown = f"""# Work Package #{work_package_id} Activities
    
    **Total Activities:** {total}
    **Showing:** {count} (Page {page})
    
    ---
    """
    
            if not activities:
                markdown += "\n*No activities found.*\n"
            else:
                for activity in activities:
                    markdown += _format_activity_markdown(activity)
                    markdown += "\n---\n"
    
            return markdown
    
        finally:
            await client.close()
  • MCP server registration of the tool using @mcp.tool() decorator, which delegates to the implementation in comments.py.
    @mcp.tool()
    async def get_work_package_activities(
        work_package_id: int, page: int = 1, page_size: int = 20
    ):
        """Retrieve all activities and comments for a work package.
    
        Args:
            work_package_id: Work package ID
            page: Page number (default: 1)
            page_size: Items per page (default: 20)
        """
        return await comments.get_work_package_activities(
            work_package_id=work_package_id,
            page=page,
            page_size=page_size,
        )
  • Supporting helper function used by the handler to format individual activity items into markdown.
    def _format_activity_markdown(activity: dict[str, Any]) -> str:
        """Format a single activity as markdown.
    
        Args:
            activity: Activity object from OpenProject API
    
        Returns:
            Formatted markdown string
        """
        activity_id = activity.get("id", "N/A")
        activity_type = activity.get("_type", "Activity")
        version = activity.get("version", "N/A")
        internal = activity.get("internal", False)
        created_at = activity.get("createdAt", "N/A")
        updated_at = activity.get("updatedAt", "N/A")
    
        # Get comment text
        comment_obj = activity.get("comment", {})
        comment_text = comment_obj.get("raw", "") if comment_obj else ""
    
        # Get user information
        user_link = activity.get("_links", {}).get("user", {})
        user_title = user_link.get("title", "Unknown User")
    
        # Get details (changes)
        details = activity.get("details", [])
        details_summary = []
        for detail in details[:3]:  # Show first 3 details
            if isinstance(detail, dict):
                detail_format = detail.get("format", "")
                detail_html = detail.get("html", "")
                if detail_html:
                    details_summary.append(f"  - {detail_html}")
    
        markdown = f"""
    ### Activity #{activity_id} - {activity_type}
    **Created:** {created_at}
    """
    
        if comment_text:
            markdown += f"\n**Comment:**\n```\n{comment_text}\n```\n"
    
        if details_summary:
            markdown += f"\n**Changes:**\n" + "\n".join(details_summary) + "\n"
    
        return markdown
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions pagination behavior (page and page_size with defaults), which is useful, but lacks details on permissions, rate limits, error handling, or what 'retrieve all' entails (e.g., if it includes deleted comments). For a read operation with zero annotation coverage, this leaves significant gaps in behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a structured Args section that efficiently documents parameters. Every sentence earns its place with no redundant or vague language, making it appropriately sized and well-organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters, no annotations, and no output schema, the description is moderately complete. It covers the purpose and parameters adequately but lacks behavioral details (e.g., response format, error cases) and usage guidelines. For a tool with this complexity, it meets minimum viability but has clear gaps in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters: work_package_id specifies the target, page and page_size control pagination with defaults. This adds meaningful context beyond the bare schema, though it doesn't explain format constraints (e.g., integer ranges) or usage nuances.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and the resource 'activities and comments for a work package', making the purpose specific and understandable. It doesn't explicitly distinguish from siblings like 'get_activity' or 'get_work_package', but the focus on 'all activities and comments' provides some differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_activity' (which might retrieve a single activity) or 'get_work_package' (which might retrieve work package details without activities). There's no mention of prerequisites, context, or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/dev-in-black/openproject-mcp'

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