create_comment
Add comments to OpenProject work packages using markdown formatting, with options for internal visibility to document progress and facilitate team communication.
Instructions
Add a comment to a work package.
Args:
work_package_id: Work package ID
comment: Comment text in markdown format
internal: Whether the comment is internal (default: False)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| work_package_id | Yes | ||
| comment | Yes | ||
| internal | No |
Implementation Reference
- Core handler function that executes the logic to create a comment by posting to the OpenProject API endpoint for work package activities.async def create_comment( work_package_id: int, comment: str, internal: bool = False ) -> dict[str, Any]: """Add a comment to a work package. Args: work_package_id: Work package ID comment: Comment text in markdown format internal: Whether the comment is internal (default: False) Returns: Created activity object containing the comment """ client = OpenProjectClient() try: payload = { "comment": build_formattable(comment), } # Internal comments might be handled differently depending on OpenProject version # Adding it to the payload if requested if internal: payload["internal"] = internal result = await client.post( f"work_packages/{work_package_id}/activities", data=payload ) return result finally: await client.close()
- src/openproject_mcp/server.py:218-231 (registration)MCP tool registration and entry point using @mcp.tool() decorator, which delegates to the core handler in comments module.@mcp.tool() async def create_comment(work_package_id: int, comment: str, internal: bool = False): """Add a comment to a work package. Args: work_package_id: Work package ID comment: Comment text in markdown format internal: Whether the comment is internal (default: False) """ return await comments.create_comment( work_package_id=work_package_id, comment=comment, internal=internal, )