Skip to content

Commit a88f920

Browse files
committed
chore: With taskInfo
Signed-off-by: He-Pin <[email protected]>
1 parent 0ff73cb commit a88f920

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpSchema.java

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,51 @@ public record TaskMetaData(@JsonProperty("ttl") Long ttl) {
17011701
public record RelatedTaskMetaData(@JsonProperty("taskId") String taskId) {
17021702
}
17031703

1704+
/**
1705+
* Task information interface.
1706+
*/
1707+
public interface TaskInfo {
1708+
1709+
/**
1710+
* The task identifier.
1711+
*/
1712+
String taskId();
1713+
1714+
/**
1715+
* Current task state.
1716+
*/
1717+
TaskStatus status();
1718+
1719+
/**
1720+
* Optional human-readable message describing the current task state. This can
1721+
* provide context for any status, including:
1722+
* <p>
1723+
* - Reasons for "cancelled" status
1724+
* <p>
1725+
* - Summaries for "completed" status
1726+
* <p>
1727+
* - Diagnostic information for "failed" status (e.g., error details, what went
1728+
* wrong)
1729+
*/
1730+
String statusMessage();
1731+
1732+
/**
1733+
* ISO 8601 timestamp when the task was created.
1734+
*/
1735+
String createdAt();
1736+
1737+
/**
1738+
* Actual retention duration from creation in milliseconds, null for unlimited.
1739+
*/
1740+
Long ttl();
1741+
1742+
/**
1743+
* Suggested polling interval in milliseconds, null if no suggestion.
1744+
*/
1745+
Long pollInterval();
1746+
1747+
}
1748+
17041749
/**
17051750
* The server's response to a tools/call request from the client when invoked as a
17061751
* task.
@@ -1713,7 +1758,7 @@ public record Task( //@formatter:off
17131758
@JsonProperty("statusMessage") String statusMessage,
17141759
@JsonProperty("createdAt") String createdAt,
17151760
@JsonProperty("ttl") Long ttl,
1716-
@JsonProperty("pollInterval") Long pollInterval) { // @formatter:on
1761+
@JsonProperty("pollInterval") Long pollInterval) implements TaskInfo { // @formatter:on
17171762

17181763
public Task(String taskId, TaskStatus status, String statusMessage, String createdAt) {
17191764
this(taskId, status, statusMessage, createdAt, null, null);
@@ -1820,7 +1865,7 @@ public record GetTaskResult( // @formatter:off
18201865
@JsonProperty("createdAt") String createdAt,
18211866
@JsonProperty("ttl") Long ttl,
18221867
@JsonProperty("pollInterval") Long pollInterval,
1823-
@JsonProperty("_meta") Map<String, Object> meta) implements Result { // @formatter:on
1868+
@JsonProperty("_meta") Map<String, Object> meta) implements TaskInfo, Result { // @formatter:on
18241869
}
18251870

18261871
/**
@@ -1867,7 +1912,7 @@ public record CancelTaskResult( // @formatter:off
18671912
@JsonProperty("createdAt") String createdAt,
18681913
@JsonProperty("ttl") Long ttl,
18691914
@JsonProperty("pollInterval") Long pollInterval,
1870-
@JsonProperty("_meta") Map<String, Object> meta) implements Result { // @formatter:on
1915+
@JsonProperty("_meta") Map<String, Object> meta) implements TaskInfo, Result { // @formatter:on
18711916
}
18721917

18731918
/**
@@ -1905,7 +1950,7 @@ public record TaskStatusNotification( // @formatter:off
19051950
@JsonProperty("createdAt") String createdAt,
19061951
@JsonProperty("ttl") Long ttl,
19071952
@JsonProperty("pollInterval") Long pollInterval,
1908-
@JsonProperty("_meta") Map<String, Object> meta) implements Notification { // @formatter:on
1953+
@JsonProperty("_meta") Map<String, Object> meta) implements TaskInfo, Notification { // @formatter:on
19091954
}
19101955

19111956
/**

0 commit comments

Comments
 (0)