create_work_package
Create a new work package in OpenProject by specifying project, title, description, assignee, and other task details to organize project work.
Instructions
Create a new work package in a project.
Args:
project_id: Project identifier or ID
subject: Work package title (required)
description: Work package description in markdown format
type_id: Type ID (default: 1 for Task)
status_id: Status ID (optional, uses project default if not provided)
priority_id: Priority ID (optional, uses default if not provided)
assignee_id: User ID to assign the work package to
notify: Whether to send notifications (default: True)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| subject | Yes | ||
| description | No | ||
| type_id | No | ||
| status_id | No | ||
| priority_id | No | ||
| assignee_id | No | ||
| notify | No |
Implementation Reference
- Core implementation of the create_work_package tool: constructs payload and performs POST request to OpenProject API to create the work package.async def create_work_package( project_id: str, subject: str, description: str | None = None, type_id: int = 1, status_id: int | None = None, priority_id: int | None = None, assignee_id: int | None = None, notify: bool = True, ) -> dict[str, Any]: """Create a new work package in a project. Args: project_id: Project identifier or ID subject: Work package title (required) description: Work package description in markdown format type_id: Type ID (default: 1 for Task) status_id: Status ID (optional, uses project default if not provided) priority_id: Priority ID (optional, uses default if not provided) assignee_id: User ID to assign the work package to notify: Whether to send notifications (default: True) Returns: Created work package object with ID, subject, and all properties """ client = OpenProjectClient() try: payload: dict[str, Any] = { "subject": subject, "_links": { "type": build_link(f"/api/v3/types/{type_id}"), }, } if description: payload["description"] = build_formattable(description) if status_id: payload["_links"]["status"] = build_link(f"/api/v3/statuses/{status_id}") if priority_id: payload["_links"]["priority"] = build_link( f"/api/v3/priorities/{priority_id}" ) if assignee_id: payload["_links"]["assignee"] = build_link(f"/api/v3/users/{assignee_id}") params = {"notify": str(notify).lower()} result = await client.post( f"projects/{project_id}/work_packages", data=payload ) return result finally: await client.close()
- src/openproject_mcp/server.py:14-46 (registration)Registers the create_work_package tool with the MCP server using @mcp.tool() decorator. Delegates execution to the implementation in work_packages module.@mcp.tool() async def create_work_package( project_id: str, subject: str, description: str | None = None, type_id: int = 1, status_id: int | None = None, priority_id: int | None = None, assignee_id: int | None = None, notify: bool = True, ): """Create a new work package in a project. Args: project_id: Project identifier or ID subject: Work package title (required) description: Work package description in markdown format type_id: Type ID (default: 1 for Task) status_id: Status ID (optional, uses project default if not provided) priority_id: Priority ID (optional, uses default if not provided) assignee_id: User ID to assign the work package to notify: Whether to send notifications (default: True) """ return await work_packages.create_work_package( project_id=project_id, subject=subject, description=description, type_id=type_id, status_id=status_id, priority_id=priority_id, assignee_id=assignee_id, notify=notify, )