feat: add customer management tools#176
Conversation
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).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds 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. ChangesCustomer MCP tools
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
plane_mcp/tools/__init__.pyplane_mcp/tools/customers.pytests/test_integration.py
- 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.
|
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. |
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.pymodule following the existingregister_*_tools(mcp)pattern and using theplane-sdkclient the same way the other tool modules do.What's included
Customers (
client.customers)list_customers,create_customer,retrieve_customer,update_customer,delete_customerCustomer properties (workspace-level custom fields,
client.customers.properties)list_customer_properties,create_customer_property,retrieve_customer_property,update_customer_property,delete_customer_propertyTextAttributeSettings/DateAttributeSettingshandling for TEXT/DATETIME types andrelation_typefor RELATION, matchingwork_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_requestWiring & tests
register_customer_toolsinplane_mcp/tools/__init__.py.test_customer_integration) matching the style intests/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.EXPECTED_TOOLSavailability check.Verification
ruff checkandruff formatpass on the new code.test_stateless_http,test_oauth_security,test_aws_secrets), which build the server with all tools registered, pass..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-sdkhas no typed methods for these (confirmed absent in the pinned0.2.19and on the SDK'smain). 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'swork_item_ids.Options for a follow-up:
plane-sdkto expose typed methods, then add them in the standard pattern.plane-sdkfirst, then wire them here.Summary by CodeRabbit
New Features
Bug Fixes