Skip to content

Commit f3cd195

Browse files
committed
Add comprehensive tool annotations
Signed-off-by: jitokim <pigberger70@gmail.com>
1 parent 41c6bd9 commit f3cd195

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,18 +718,37 @@ public record JsonSchema( // @formatter:off
718718
* @param inputSchema A JSON Schema object that describes the expected structure of
719719
* the arguments when calling this tool. This allows clients to validate tool
720720
* arguments before sending them to the server.
721+
* @param title A human-readable title for the tool. Intended for display purposes and
722+
* not guaranteed to reflect actual tool behavior.
723+
* @param readOnlyHint If true, the tool does not modify its environment. This is a
724+
* hint and may not reflect the tool's actual behavior.
725+
* @param destructiveHint If true, the tool may perform destructive updates to its
726+
* environment if false, it only performs additive updates. Applicable only when
727+
* {@code readOnlyHint == false}.
728+
* @param idempotentHint If true, repeated calls to the tool with the same arguments
729+
* have no additional effects. Applicable only when {@code readOnlyHint == false}.
730+
* @param openWorldHint If true, the tool interacts with an open world of external
731+
* entities (e.g., web search); if false, the domain is closed (e.g., memory tools).
721732
*/
722733
@JsonInclude(JsonInclude.Include.NON_ABSENT)
723734
@JsonIgnoreProperties(ignoreUnknown = true)
724735
public record Tool( // @formatter:off
725736
@JsonProperty("name") String name,
726737
@JsonProperty("description") String description,
727-
@JsonProperty("inputSchema") JsonSchema inputSchema) {
738+
@JsonProperty("inputSchema") JsonSchema inputSchema,
739+
@JsonProperty("title") String title,
740+
@JsonProperty("readOnlyHint") Boolean readOnlyHint,
741+
@JsonProperty("destructiveHint") Boolean destructiveHint,
742+
@JsonProperty("idempotentHint") Boolean idempotentHint,
743+
@JsonProperty("openWorldHint") Boolean openWorldHint) {
728744

729745
public Tool(String name, String description, String schema) {
730-
this(name, description, parseSchema(schema));
746+
this(name, description, parseSchema(schema), null, null, null, null, null);
747+
}
748+
749+
public Tool(String name, String description, String schema, String title, Boolean readOnlyHint, Boolean destructiveHint, Boolean idempotentHint, Boolean openWorldHint) {
750+
this(name, description, parseSchema(schema), title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint);
731751
}
732-
733752
} // @formatter:on
734753

735754
private static JsonSchema parseSchema(String schema) {

0 commit comments

Comments
 (0)