Skip to content

Conversation

@yonaka15
Copy link
Owner

This pull request introduces the 'list_project_statuses' tool, enabling the retrieval of available issue statuses for a specific project and tracker within Redmine, and integrates it into the MCP server. This addresses issue #53.

Key Changes:

  • Tool Definition (src/tools/projects.ts):
    • Added PROJECT_LIST_STATUSES_TOOL definition.
  • Handler Implementation (src/handlers/projects.ts):
    • Implemented the list_project_statuses handler to fetch a representative issue and retrieve its allowed_statuses.
    • Incorporated dependency injection for the status formatting function (formatAllowedStatusesFn) to improve testability, as per the reference document.
    • Enhanced error handling in existing project handlers.
  • Type Definitions (src/lib/types/issues/):
    • Extended RedmineIssue interface in types.ts to include the optional allowed_statuses property.
    • Updated RedmineIssueSchema in schema.ts with the schema for allowed_statuses and adjusted nullability/optionality for fields like due_date, description, start_date, etc., based on the reference document and typical Redmine API behavior.
  • Formatting (src/formatters/projects.ts):
    • Added a new formatAllowedStatuses function to present the status list in a user-friendly format.
  • Integration (src/handlers/index.ts & src/tools/index.ts):
    • Modified src/handlers/index.ts to pass the formatAllowedStatuses formatter to createProjectsHandlers.
    • Updated src/handlers/index.ts to dynamically build the server's tool list from the tools module, ensuring automatic inclusion of new tools.
    • Exported PROJECT_LIST_STATUSES_TOOL from src/tools/index.ts.

Note on Testing:
The Jest test file src/handlers/__tests__/projects/list_statuses.test.ts, mentioned in the reference documentation as successfully passing, has not been created or included in this commit due to its absence in the provided sandbox environment. This will need to be addressed in a follow-up task to ensure full test coverage for the new functionality.

Related Issue: Closes #53

yonaka15 added 7 commits June 23, 2025 02:07
)

This commit introduces the 'list_project_statuses' tool, enabling the retrieval of available issue statuses for a specific project and tracker within Redmine, and integrates it into the MCP server.\n\nKey implementations include:\n- Definition of PROJECT_LIST_STATUSES_TOOL in 'src/tools/projects.ts'.\n- Handler logic in 'src/handlers/projects.ts' to fetch issues and extract 'allowed_statuses', with dependency injection for the formatter.\n- Type extensions for RedmineIssue (adding 'allowed_statuses') in 'src/lib/types/issues/types.ts'.\n- Zod schema updates for RedmineIssue (adding 'allowed_statuses') in 'src/lib/types/issues/schema.ts', along with minor adjustments to other fields for nullability/optionality.\n- Addition of 'formatAllowedStatuses' function in 'src/formatters/projects.ts'.\n- Updates to 'src/handlers/index.ts' to pass the formatter to 'createProjectsHandlers' and to dynamically build the server's tool list.\n- Export of PROJECT_LIST_STATUSES_TOOL in 'src/tools/index.ts'.\n\nThis functionality addresses the requirements outlined in issue #53 by providing a standardized way for the MCP server to interact with Redmine for status information.\n\nNote: The corresponding Jest test file (src/handlers/__tests__/projects/list_statuses.test.ts) mentioned in the reference document has not been created in this commit and needs to be addressed separately.
- Fix TypeScript compilation errors for Jest Mock type definitions
- Change Mock<any, any> to Mock<any> to match Jest's type signature
- Add explicit mockImplementation in beforeEach to ensure mock function behavior
- Clear and reset mocks properly between test runs
- All list_project_statuses tests now pass (10/10)

Resolves issue where mock function returned undefined instead of expected string output.
Test coverage remains stable at 40.25% with improved test reliability.
@yonaka15 yonaka15 merged commit bfd1b90 into main Jun 23, 2025
0 of 2 checks passed
@yonaka15 yonaka15 deleted the feature/GH-53-list-project-statuses branch June 23, 2025 12:35
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.

Feature: Add tools to list available trackers and statuses for a project

2 participants