Skip to content

Commit fe25c66

Browse files
committed
MCP-78 Support new schema properties
1 parent cb459d0 commit fe25c66

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/org/sonarsource/sonarqube/mcp/tools/SchemaToolBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ public class SchemaToolBuilder {
2929
private static final String ITEMS_PROPERTY_NAME = "items";
3030
private final Map<String, Object> properties;
3131
private final List<String> requiredProperties;
32+
private final Map<String, Object> def;
33+
private final Map<String, Object> definitions;
3234
private String name;
3335
private String description;
3436
private boolean additionalProperties;
3537

3638
public SchemaToolBuilder() {
3739
this.properties = new HashMap<>();
3840
this.requiredProperties = new ArrayList<>();
41+
this.def = new HashMap<>();
42+
this.definitions = new HashMap<>();
3943
}
4044

4145
public SchemaToolBuilder setName(String name) {
@@ -99,6 +103,6 @@ public McpSchema.Tool build() {
99103
throw new IllegalStateException("Cannot set a required property that does not exist.");
100104
}
101105

102-
return new McpSchema.Tool(name, description, new McpSchema.JsonSchema("object", properties, requiredProperties, additionalProperties));
106+
return new McpSchema.Tool(name, description, new McpSchema.JsonSchema("object", properties, requiredProperties, additionalProperties, def, definitions));
103107
}
104108
}

src/test/java/org/sonarsource/sonarqube/mcp/tools/ToolExecutorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void prepare() {
3939

4040
@Test
4141
void it_should_register_telemetry_after_the_tool_call_succeeds() {
42-
toolExecutor.execute(new Tool(new McpSchema.Tool("tool_name", null, new McpSchema.JsonSchema("object", Map.of(), List.of(), false))) {
42+
toolExecutor.execute(new Tool(new McpSchema.Tool("tool_name", null, new McpSchema.JsonSchema("object", Map.of(), List.of(), false, Map.of(), Map.of()))) {
4343
@Override
4444
public Result execute(Arguments arguments) {
4545
return Result.success("Success!");
@@ -51,7 +51,7 @@ public Result execute(Arguments arguments) {
5151

5252
@Test
5353
void it_should_register_telemetry_after_the_tool_call_fails() {
54-
toolExecutor.execute(new Tool(new McpSchema.Tool("tool_name", null, new McpSchema.JsonSchema("object", Map.of(), List.of(), false))) {
54+
toolExecutor.execute(new Tool(new McpSchema.Tool("tool_name", null, new McpSchema.JsonSchema("object", Map.of(), List.of(), false, Map.of(), Map.of()))) {
5555
@Override
5656
public Result execute(Arguments arguments) {
5757
return Result.failure("Failure!");

0 commit comments

Comments
 (0)