Skip to main content
Glama
dev-in-black

OpenProject MCP Server

by dev-in-black

list_work_packages

Retrieve and filter work packages from OpenProject with pagination options to manage project tasks efficiently.

Instructions

List work packages with optional filtering and pagination.

Args:
    project_id: Optional project ID to filter work packages
    filters: Optional JSON filter string
    page: Page number (default: 1)
    page_size: Items per page (default: 20)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo
filtersNo
pageNo
page_sizeNo

Implementation Reference

  • Core handler implementation that queries the OpenProject API for work packages with optional project filter, JSON filters, and pagination, then formats the results into a markdown list.
    async def list_work_packages(
        project_id: str | None = None,
        filters: str | None = None,
        page: int = 1,
        page_size: int = 20,
    ) -> str:
        """List work packages with optional filtering and pagination.
    
        Args:
            project_id: Optional project ID to filter work packages
            filters: Optional JSON filter string (e.g., '[{"status_id":{"operator":"=","values":["1"]}}]')
            page: Page number (default: 1)
            page_size: Items per page (default: 20)
    
        Returns:
            Formatted markdown string with work packages list
        """
        client = OpenProjectClient()
    
        try:
            params: dict[str, Any] = {
                "pageSize": page_size,
                "offset": (page - 1) * page_size,
            }
    
            if filters:
                params["filters"] = filters
    
            if project_id:
                endpoint = f"projects/{project_id}/work_packages"
                title = f"Work Packages in Project '{project_id}'"
            else:
                endpoint = "work_packages"
                title = "All Work Packages"
    
            result = await client.get(endpoint, params=params)
    
            # Extract metadata
            total = result.get("total", 0)
            count = result.get("count", 0)
    
            # Get work packages
            work_packages = get_embedded_collection(result, "elements")
    
            # Format as markdown
            markdown = f"""# {title}
    
    **Total:** {total} | **Showing:** {count} | **Page:** {page}
    
    ---
    """
    
            if not work_packages:
                markdown += "\n*No work packages found.*\n"
            else:
                for wp in work_packages:
                    markdown += "\n" + _format_work_package_list_item(wp) + "\n"
    
            return markdown
    
        finally:
            await client.close()
  • MCP tool registration via @mcp.tool() decorator on the entry-point function that delegates to the core implementation.
    @mcp.tool()
    async def list_work_packages(
        project_id: str | None = None,
        filters: str | None = None,
        page: int = 1,
        page_size: int = 20,
    ):
        """List work packages with optional filtering and pagination.
    
        Args:
            project_id: Optional project ID to filter work packages
            filters: Optional JSON filter string
            page: Page number (default: 1)
            page_size: Items per page (default: 20)
        """
        return await work_packages.list_work_packages(
            project_id=project_id,
            filters=filters,
            page=page,
            page_size=page_size,
        )
  • Supporting function that formats a single work package dictionary into a detailed markdown list item, extracting embedded entities and links.
    def _format_work_package_list_item(wp: dict[str, Any]) -> str:
        """Format a work package as a concise list item.
    
        Args:
            wp: Work package object from OpenProject API
    
        Returns:
            Formatted markdown string for list display
        """
        wp_id = wp.get("id", "N/A")
        subject = wp.get("subject", "No subject")
    
        # Get embedded resources
        embedded = wp.get("_embedded", {})
        links = wp.get("_links", {})
    
        # Type
        type_obj = embedded.get("type", {})
        type_name = type_obj.get("name", "N/A")
    
        # Status
        status_obj = embedded.get("status", {})
        status_name = status_obj.get("name", "N/A")
    
        # Priority
        priority_obj = embedded.get("priority", {})
        priority_name = priority_obj.get("name", "N/A")
    
        # Project
        project_obj = embedded.get("project", {})
        project_name = project_obj.get("name", "N/A")
    
        # Assignee
        assignee_link = links.get("assignee", {})
        assignee_name = assignee_link.get("title") if assignee_link.get("href") else "Unassigned"
    
        # Parent
        parent_link = links.get("parent", {})
        parent_name = parent_link.get("title") if parent_link.get("href") else None
    
        # Due date
        due_date = wp.get("dueDate", "No due date")
    
        markdown = f"""### #{wp_id}: {subject}
    - **Type:** {type_name} | **Status:** {status_name} | **Priority:** {priority_name}
    - **Project:** {project_name} | **Assignee:** {assignee_name}
    - **Due Date:** {due_date}"""
    
        if parent_name:
            markdown += f" | **Parent:** {parent_name}"
    
        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 'optional filtering and pagination,' which gives some behavioral context about the tool's capabilities. However, it lacks critical details such as whether this is a read-only operation (implied but not stated), what authentication is required, rate limits, error conditions, or the format of returned data. For a list tool with no annotations, this leaves significant gaps in understanding its behavior.

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 well-structured and front-loaded with the core purpose in the first sentence, followed by a bullet-point-like list of parameters. Every sentence earns its place by providing essential information without redundancy. It's appropriately sized for a tool with four parameters and no annotations.

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 the tool's moderate complexity (4 parameters, no annotations, no output schema), the description is partially complete. It covers the purpose and parameters adequately but lacks details on behavioral aspects like authentication, error handling, and return format. Without an output schema, the description should ideally hint at what data is returned, but it doesn't, leaving gaps in full contextual understanding.

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?

The schema description coverage is 0%, so the description must compensate. It provides clear semantics for all four parameters: 'project_id' for filtering by project, 'filters' as a JSON filter string, and 'page'/'page_size' for pagination with defaults. This adds meaningful context beyond the schema's basic titles, though it doesn't detail the exact JSON structure for filters or validation rules.

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 ('List') and resource ('work packages'), making the purpose immediately understandable. It distinguishes itself from sibling tools like 'get_work_package' by indicating it returns multiple items with filtering capabilities. However, it doesn't explicitly differentiate from other list tools like 'list_projects' or 'list_work_package_relations' beyond the resource name.

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

Usage Guidelines3/5

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

The description implies usage through the mention of 'optional filtering and pagination,' suggesting this tool is for retrieving multiple work packages rather than single items. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'get_work_package' for single items or how filtering interacts with other parameters. No when-not-to-use scenarios or prerequisites are mentioned.

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