Skip to content

feat(work_packages): support custom fields on create/update (port upstream #16) #14

Description

@AndreaV-Lsi

Problem / motivation

create_work_package / update_work_package cannot set custom fields.
OpenProject work packages routinely carry custom fields (customField1, customField2,
…) — cost centers, categories, list/enumeration values, etc. Today there is no way
to write them through the MCP server, which blocks real project-management use.

Source / attribution

Based on upstream PR AndyEverything#16 by @roromedia
("Fix custom fields not being sent in API payload"). That PR patches the legacy
monolith
and adds only the client-side passthrough. This fork's tools build the
API data dict from explicit Pydantic model fields, so a client-only change would
be dead code — nothing would ever put customField* into data. So this issue ports
the client passthrough and adds the missing tool-level entry point. Author to be
credited in NOTICE.

Scope / proposed approach

  • Client (src/client.py, create_work_package + update_work_package): after
    the standard fields, pass through any data key starting with customField
    a {"href": …} value goes under _links (list/user/version-type fields), any
    other value is set directly (text/number/date). (This is feat(sprints): native sprint & backlog management tools (clean implementation) #16's logic, adapted to
    our form-based payload builder.)
  • Tools/models (src/tools/work_packages.py): add an optional
    custom_fields: Dict[str, Any] field to CreateWorkPackageInput and
    UpdateWorkPackageInput, and merge it into data before calling the client.

Usage: {"custom_fields": {"customField1": "ACME", "customField5": {"href": "/api/v3/custom_options/12"}}}

Acceptance criteria

  • Creating/updating a WP with custom_fields sets both a text/number custom field
    (direct value) and a list-type custom field (_links href) in the same request.
  • Omitting custom_fields changes nothing (no customField*/empty _links noise).
  • Network-free unit test: given custom_fields, the client payload places text
    values directly and href values under _links.
  • Live smoke on ephemeral OpenProject: define a WP custom field, set it via the
    tool, read it back.

Out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions