Skip to content

Conversation

@Aias00
Copy link
Contributor

@Aias00 Aias00 commented Dec 17, 2025

AgentScope-Java Version

[The version of AgentScope-Java you are working on, e.g. 1.0.2, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]

Description

This commit adds a comprehensive task management system to the MCP client wrappers, enabling asynchronous handling of long-running operations. Key changes include:

  • Implementation of TaskManager interface for managing tasks, including methods for retrieving task status, results, listing tasks, and cancelling tasks.
  • Introduction of DefaultTaskManager as the default implementation, which caches task statuses and notifies listeners of status changes.
  • New classes for task representation (Task, ListTasksResult, TaskParameters, and TaskStatus) to encapsulate task data and status.
  • Updates to McpAsyncClientWrapper and McpSyncClientWrapper to integrate task management functionality.
  • Comprehensive unit tests for the new task management features to ensure reliability and correctness.

These enhancements improve the MCP client’s ability to manage and monitor tasks effectively, supporting more complex workflows in agent applications.

fixes #217

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

This commit adds a comprehensive task management system to the MCP client wrappers, enabling asynchronous handling of long-running operations. Key changes include:

- Implementation of `TaskManager` interface for managing tasks, including methods for retrieving task status, results, listing tasks, and cancelling tasks.
- Introduction of `DefaultTaskManager` as the default implementation, which caches task statuses and notifies listeners of status changes.
- New classes for task representation (`Task`, `ListTasksResult`, `TaskParameters`, and `TaskStatus`) to encapsulate task data and status.
- Updates to `McpAsyncClientWrapper` and `McpSyncClientWrapper` to integrate task management functionality.
- Comprehensive unit tests for the new task management features to ensure reliability and correctness.

These enhancements improve the MCP client’s ability to manage and monitor tasks effectively, supporting more complex workflows in agent applications.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive task management capabilities to the MCP client wrappers, enabling asynchronous handling of long-running operations through the Model Context Protocol. The implementation introduces a complete task management framework including domain models, interfaces, and integration with both synchronous and asynchronous client wrappers. The MCP SDK dependency is also upgraded from version 0.14.1 to 0.17.0 to support these features.

Key changes:

  • Introduction of task management domain model classes (Task, TaskStatus, TaskParameters, ListTasksResult) with comprehensive builder patterns and validation
  • Implementation of TaskManager interface and DefaultTaskManager with caching, listener notification, and reactive programming support
  • Integration of task management into McpAsyncClientWrapper and McpSyncClientWrapper with placeholder implementations for future SDK support

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
agentscope-dependencies-bom/pom.xml Updates MCP SDK dependency from version 0.14.1 to 0.17.0
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/TaskStatus.java Adds enum for task execution states with terminal state detection
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/TaskParameters.java Adds parameters class for task creation with TTL configuration
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/Task.java Adds task domain model with builder pattern and comprehensive metadata
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/ListTasksResult.java Adds pagination result wrapper for task listing operations
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/TaskManager.java Defines interface for task lifecycle management operations
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/task/DefaultTaskManager.java Implements task manager with caching, listener notification, and type conversion
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/McpClientWrapper.java Adds abstract getTaskManager() method to base wrapper class
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/McpAsyncClientWrapper.java Integrates task manager with placeholder implementation for async client
agentscope-core/src/main/java/io/agentscope/core/tool/mcp/McpSyncClientWrapper.java Integrates task manager with placeholder implementation for sync client
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/McpClientWrapperTest.java Updates test wrapper to implement new getTaskManager() method
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/task/TaskTest.java Adds comprehensive unit tests for Task class
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/task/TaskStatusTest.java Adds comprehensive unit tests for TaskStatus enum
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/task/TaskParametersTest.java Adds comprehensive unit tests for TaskParameters class
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/task/ListTasksResultTest.java Adds comprehensive unit tests for ListTasksResult class
agentscope-core/src/test/java/io/agentscope/core/tool/mcp/task/DefaultTaskManagerTest.java Adds comprehensive unit tests for DefaultTaskManager implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 17, 2025

…ure ListTasksResult returns unmodifiable task lists.
…ntWrapper, verifying instance retrieval and unsupported task operations.
@Aias00 Aias00 marked this pull request as draft December 17, 2025 11:52
@Aias00
Copy link
Contributor Author

Aias00 commented Dec 17, 2025

The official Java SDK does not yet support task. We'll add support for it after the new version is released.

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]: MCP Task Support

1 participant