Skip to content

feat: add customer management tools#176

Closed
david-colombo wants to merge 2 commits into
makeplane:mainfrom
david-colombo:feat/customer-management-tools
Closed

feat: add customer management tools#176
david-colombo wants to merge 2 commits into
makeplane:mainfrom
david-colombo:feat/customer-management-tools

Conversation

@david-colombo

@david-colombo david-colombo commented Jul 15, 2026

Copy link
Copy Markdown

Add customer management tools

Adds coverage for Plane's customers resource, which the server previously had no tools for. Implemented as a new plane_mcp/tools/customers.py module following the existing register_*_tools(mcp) pattern and using the plane-sdk client the same way the other tool modules do.

What's included

Customers (client.customers)

  • list_customers, create_customer, retrieve_customer, update_customer, delete_customer

Customer properties (workspace-level custom fields, client.customers.properties)

  • list_customer_properties, create_customer_property, retrieve_customer_property, update_customer_property, delete_customer_property
  • Reuses the existing TextAttributeSettings / DateAttributeSettings handling for TEXT/DATETIME types and relation_type for RELATION, matching work_item_properties.py.

Customer requests (per-customer, carry work_item_ids, client.customers.requests)

  • list_customer_requests, create_customer_request, retrieve_customer_request, update_customer_request, delete_customer_request

Wiring & tests

  • Registered register_customer_tools in plane_mcp/tools/__init__.py.
  • Added a full customer-lifecycle integration test (test_customer_integration) matching the style in tests/test_integration.py: create, retrieve, update, and list a customer; create/list/update/delete a customer property; create a project and work item, then create/list/retrieve/update/delete a customer request that references the work item; full teardown.
  • Added all 15 new tools to the EXPECTED_TOOLS availability check.

Verification

  • ruff check and ruff format pass on the new code.
  • Full tool set imports and registers cleanly; the offline suites (test_stateless_http, test_oauth_security, test_aws_secrets), which build the server with all tools registered, pass.
  • The live integration tests require a Plane instance (.env.test.local).

Follow-up needing direction: customer to work-item link/unlink

Plane's REST API exposes dedicated customer work-item endpoints:

  • POST /customers/{id}/work-items (link)
  • GET /customers/{id}/work-items (list)
  • DELETE /customers/{id}/work-items/{work-item-id} (unlink)

However, plane-sdk has no typed methods for these (confirmed absent in the pinned 0.2.19 and on the SDK's main). Every tool in this repo calls a typed SDK method and returns a Pydantic model, so these three are deliberately left out of this PR rather than reaching into the client's raw HTTP layer and returning untyped JSON. Work items can currently be associated through a customer request's work_item_ids.

Options for a follow-up:

  1. Add the link/unlink/list tools via the SDK client's HTTP layer (returning raw JSON) as an interim measure.
  2. Wait for plane-sdk to expose typed methods, then add them in the standard pattern.
  3. Upstream the endpoints to plane-sdk first, then wire them here.

Summary by CodeRabbit

  • New Features

    • Added customer management tools, including create, retrieve, update, delete, and list operations.
    • Added customer property management with support for property types, relationships, and settings.
    • Added customer request management linked to work items.
    • Customer lists and related records now return API results consistently.
  • Bug Fixes

    • Prevented customer property updates that provide settings without a property type.

Add a customers tool module covering the Plane customers resource via the
plane-sdk client, following the existing register_*_tools(mcp) pattern:

- Customers: list, create, retrieve, update, delete
- Customer properties (workspace-level custom fields): list, create,
  retrieve, update, delete
- Customer requests (per-customer, carry work_item_ids): list, create,
  retrieve, update, delete

Wire register_customer_tools into tools/__init__.py and add a customer
lifecycle integration test plus the new tools to the availability test,
matching the style in tests/test_integration.py.

Note: the SDK exposes no typed customer<->work-item link/unlink endpoint,
so those dedicated tools are intentionally omitted here and left as a
follow-up needing direction (see PR description).
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8a8101ec-8ac1-4f72-8a5c-be1363ee3d3f

📥 Commits

Reviewing files that changed from the base of the PR and between dbc960e and ac3af0d.

📒 Files selected for processing (2)
  • plane_mcp/tools/customers.py
  • tests/test_integration.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • plane_mcp/tools/customers.py
  • tests/test_integration.py

📝 Walkthrough

Walkthrough

Adds MCP tools for customer, customer-property, and customer-request CRUD operations, registers them with the server, normalizes property inputs, and adds end-to-end integration coverage.

Changes

Customer MCP tools

Layer / File(s) Summary
Register customer CRUD tools
plane_mcp/tools/__init__.py, plane_mcp/tools/customers.py
Registers customer tools and delegates customer CRUD operations through the shared Plane client context.
Normalize customer properties
plane_mcp/tools/customers.py
Adds customer-property CRUD tools with enum, relation, and settings normalization, including validation for settings-only updates.
Manage customer requests
plane_mcp/tools/customers.py
Adds customer-request CRUD tools scoped to individual customers and delegated to the customer requests API.
Exercise customer lifecycle
tests/test_integration.py
Adds tool-availability and end-to-end coverage for customers, properties, requests, projects, and work items, with teardown.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IntegrationTest
  participant MCPServer
  participant PlaneAPI
  IntegrationTest->>MCPServer: invoke customer and property tools
  MCPServer->>PlaneAPI: create, retrieve, update, and list resources
  PlaneAPI-->>MCPServer: return resource results
  MCPServer-->>IntegrationTest: return tool results
  IntegrationTest->>MCPServer: invoke request tools and teardown
  MCPServer->>PlaneAPI: create, update, list, and delete related resources
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding customer management tools and related MCP coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plane_mcp/tools/customers.py`:
- Around line 327-342: Update the customer property update flow around
processed_settings and UpdateCustomerProperty so settings-only updates cannot be
silently discarded: require property_type when settings is supplied, or resolve
the existing property type before constructing the update payload. Preserve the
existing TEXT and DATETIME settings conversion through TextAttributeSettings and
DateAttributeSettings.

In `@tests/test_integration.py`:
- Line 468: Make the integration test teardown around the Client context
failure-safe: initialize all resource ID variables before setup, then move
cleanup into a finally block and delete resources independently in reverse
dependency order, ensuring one deletion exception does not prevent subsequent
cleanup. Preserve the existing setup and test behavior while covering customers,
workspace properties, projects, and work items.
- Around line 525-530: Update the integration test’s update_customer_property
calls to capture each tool result and assert that the response contains the
expected updated property fields, including the new display_name. Apply the same
result extraction and field assertions to the additional update covered by the
comment, rather than only relying on the calls completing without errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87e51cdd-41a6-42d4-90b2-e105495b5bba

📥 Commits

Reviewing files that changed from the base of the PR and between b0fb136 and dbc960e.

📒 Files selected for processing (3)
  • plane_mcp/tools/__init__.py
  • plane_mcp/tools/customers.py
  • tests/test_integration.py

Comment thread plane_mcp/tools/customers.py
Comment thread tests/test_integration.py Outdated
Comment thread tests/test_integration.py Outdated
- update_customer_property: reject a settings-only update instead of
  silently dropping settings when property_type is omitted (settings can
  only be built once the TEXT/DATETIME type is known).
- customer integration test: tear down all created resources in a finally
  block in reverse dependency order so a mid-test failure does not leak
  data on the live workspace, and assert the update_customer_property and
  update_customer_request results reflect the requested changes.
@akhil-vamshi-konam

Copy link
Copy Markdown
Contributor

Thanks @david-colombo! We built on this in #177, which adds work item links, property values, and pagination support — closing this in favor of that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants