Feat - Multiple tool enhancements for managing work package tasks#1
Open
WSJUSA wants to merge 18 commits intowidjis:mainfrom
Open
Feat - Multiple tool enhancements for managing work package tasks#1WSJUSA wants to merge 18 commits intowidjis:mainfrom
WSJUSA wants to merge 18 commits intowidjis:mainfrom
Conversation
- Add extractDescriptionText utility method to convert description objects to readable strings - Fix getWorkPackages to extract description text for all work packages in collection - Fix getWorkPackage to extract description text for individual work packages - Fix createWorkPackage to transform string descriptions to proper OpenProject API format - Fix updateWorkPackage to transform string descriptions to proper OpenProject API format - Add comprehensive logging and error handling for all methods This resolves the '[object Object]' display issue and ensures descriptions are properly stored and retrieved in both create and update operations.
## � Core Features Implemented ### 1. Membership Management (CRUD Operations) - **List Memberships**: Retrieve all project memberships with filtering/pagination support - **Get Membership**: Retrieve specific membership details by ID - **Create Membership**: Add users to projects with specific roles - **Update Membership**: Modify existing user roles within projects - **Delete Membership**: Remove user access from projects ### 2. Role Management - **List Roles**: Retrieve all available system roles - **Get Role**: Retrieve specific role details by ID ### 3. MCP Tool Integration - **7 New MCP Tools**: Complete tool set for membership and role operations - **Zod Schema Validation**: Type-safe argument validation for all tools - **Comprehensive Error Handling**: Proper error responses and logging ### 4. Technical Implementation - **TypeScript Types**: Complete type definitions for Membership and Role entities - **OpenProject Client**: New client methods for all membership operations - **Tool Handlers**: MCP tool handlers with proper response formatting - **API Integration**: Direct OpenProject API integration with authentication ### 5. Schema & Validation - **Membership Schema**: Proper _links structure matching OpenProject API - **Role Schema**: Simplified schema matching actual API responses - **Collection Responses**: Support for paginated membership and role lists ## � Files Modified - src/types/openproject.ts: Added Membership and Role schemas/types - src/tools/index.ts: Added 7 new MCP tool definitions - src/client/openproject-client.ts: Added membership CRUD client methods - src/handlers/tool-handlers.ts: Added comprehensive tool handlers ## ✅ Testing & Validation - **Direct API Testing**: Verified all endpoints with curl before implementation - **End-to-End Testing**: All 7 tools tested and working correctly - **Schema Validation**: Zod validation passing for all operations - **Real-World Usage**: Successfully used to solve project assignment issues ## � Production Ready - Complete membership lifecycle management - Proper error handling and logging - Following repository development standards - Ready for production deployment Resolves: Ticket #50 - Add User Project Membership Management to OpenProject MCP Server
…property display - Fix getWorkPackage and getWorkPackages methods to properly transform _links.status, _links.project, _links.type, etc. - Resolves bug where status, project, and type fields showed "Unknown" instead of actual values - Ensures MCP tools display meaningful work package information from OpenProject API responses
Transform OpenProject API response data to properly display status, project, and type information
Extract common transformation logic into utility method, eliminating code duplication across work package methods
- Add upload_attachment tool for uploading files to work packages
- Add get_attachments tool for retrieving work package attachments
- Implement AttachmentSchema and AttachmentCollectionResponseSchema types
- Add uploadAttachment() and getWorkPackageAttachments() methods to OpenProjectClient
- Add proper multipart form data handling using FormData
- Add form-data dependency and types
- Full TypeScript support with Zod validation
- Comprehensive error handling and logging
- Follows OpenProject REST API standards for file uploads
API Endpoints:
- POST /api/v3/work_packages/{id}/attachments - Upload files
- GET /api/v3/work_packages/{id}/attachments - List attachments
Implementation is complete and ready for testing.
… content - Updated UploadAttachmentArgsSchema to use filePath instead of fileName/fileContent/contentType - Modified uploadAttachment method in OpenProjectClient to read files from filesystem - Added automatic content type detection based on file extension - Updated tool handler to use new signature - MCP server now handles all file reading and encoding requirements
- Add formatSortByParameter method to handle different API endpoint formats - Projects API: sort=field:direction format - Work Packages API: sortBy=[[field,direction]] format - Support multiple sort criteria and direction normalization - Fix API errors when using sortBy parameter - Tested with projects and work packages sorting Resolves ticket 121 - OpenProject Projects SortBy bug
- Add upload_attachment tool to upload files to work packages - Add get_attachments tool to retrieve work package attachments - Implement manual multipart form data construction for API compliance - Add comprehensive MIME type detection for 25+ file formats - Update attachment schemas to match OpenProject API response format - Add proper error handling and logging for file operations - Fix attachment description handling for string/object formats Closes ticket #120: Feat - add upload tool to OpenProject MCP
- Add upload attachment tools for OpenProject MCP - Implements file upload and attachment retrieval functionality - Fixes merge conflicts by choosing feature branch implementation
- Add CreateTaskArgsSchema for task creation parameters - Add create_task tool definition with simplified interface - Implement handleCreateTask method that automatically sets typeId to 1 (Task) - Register the new tool and handler in the MCP server - Update exports to include CreateTaskArgsSchema The create_task tool provides a convenient wrapper around create_work_package that automatically sets the work package type to Task (ID: 1), eliminating the need for users to remember type IDs and avoiding parameter validation issues with other type IDs. Task ID: 140 - Feat - Add create_task tool to OpenProject MCP
… handling; implement handler; tests via MCP complete (ticket 139)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solution: Implemented comprehensive description handling across all work package operations:
Added extractDescriptionText utility to convert OpenProject's object-based descriptions to readable strings
Fixed getWorkPackages to properly extract description text for display
Fixed createWorkPackage & updateWorkPackage to transform string descriptions to proper OpenProject API format ({ format: 'text', raw: 'content' })
Result:
✅ Descriptions now display correctly instead of [object Object]
✅ Description updates work reliably for both new and existing work packages
✅ Consistent behavior across all work package operations
Testing: Verified with test ticket creation, update, and retrieval operations. All description formatting now works as expected.
Also has a supporting tool to get global status list. Not all statuses are valid and it tries to exit gracefully. No known way to get a list of valid status transitions via API. Is what it is.
4 New MCP Tools for project membership and role management /assignments. Makes it easier to add a user to a project to be able to assign them to a ticket.