Skip to content

Commit 334f369

Browse files
committed
.
Signed-off-by: He-Pin <[email protected]>
1 parent 9f7c564 commit 334f369

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,17 @@ private static JsonSchema parseSchema(McpJsonMapper jsonMapper, String schema) {
16681668
}
16691669
}
16701670

1671+
/**
1672+
* Metadata about a task.
1673+
* */
1674+
@JsonInclude(JsonInclude.Include.NON_ABSENT)
1675+
@JsonIgnoreProperties(ignoreUnknown = true)
1676+
public record TaskMetaData(@JsonProperty("ttl") long ttl,
1677+
@JsonProperty("extensions") Object extensions,
1678+
@JsonProperty("bizContext") Object bizContext) {
1679+
1680+
}
1681+
16711682
/**
16721683
* Used by the client to call a tool provided by the server.
16731684
*
@@ -1683,14 +1694,15 @@ private static JsonSchema parseSchema(McpJsonMapper jsonMapper, String schema) {
16831694
public record CallToolRequest( // @formatter:off
16841695
@JsonProperty("name") String name,
16851696
@JsonProperty("arguments") Map<String, Object> arguments,
1697+
@JsonProperty("task") TaskMetaData task,
16861698
@JsonProperty("_meta") Map<String, Object> meta) implements Request { // @formatter:on
16871699

16881700
public CallToolRequest(McpJsonMapper jsonMapper, String name, String jsonArguments) {
1689-
this(name, parseJsonArguments(jsonMapper, jsonArguments), null);
1701+
this(name, parseJsonArguments(jsonMapper, jsonArguments), null, null);
16901702
}
16911703

16921704
public CallToolRequest(String name, Map<String, Object> arguments) {
1693-
this(name, arguments, null);
1705+
this(name, arguments, null, null);
16941706
}
16951707

16961708
private static Map<String, Object> parseJsonArguments(McpJsonMapper jsonMapper, String jsonArguments) {
@@ -1712,6 +1724,8 @@ public static class Builder {
17121724

17131725
private Map<String, Object> arguments;
17141726

1727+
private TaskMetaData task;
1728+
17151729
private Map<String, Object> meta;
17161730

17171731
public Builder name(String name) {
@@ -1742,9 +1756,14 @@ public Builder progressToken(Object progressToken) {
17421756
return this;
17431757
}
17441758

1759+
public Builder task(TaskMetaData task) {
1760+
this.task = task;
1761+
return this;
1762+
}
1763+
17451764
public CallToolRequest build() {
17461765
Assert.hasText(name, "name must not be empty");
1747-
return new CallToolRequest(name, arguments, meta);
1766+
return new CallToolRequest(name, arguments, task, meta);
17481767
}
17491768

17501769
}

0 commit comments

Comments
 (0)