Skip to content

Commit 7a4b7ac

Browse files
Copilotedburns
andauthored
fix: add @JsonIgnore to InputOptions, rollback McpServerConfig/ModelLimits changes
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent c708aa2 commit 7a4b7ac

6 files changed

Lines changed: 15 additions & 40 deletions

File tree

src/main/java/com/github/copilot/sdk/json/InputOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package com.github.copilot.sdk.json;
66

7+
import com.fasterxml.jackson.annotation.JsonIgnore;
78
import java.util.OptionalInt;
89

910
/**
@@ -49,6 +50,7 @@ public InputOptions setDescription(String description) {
4950
}
5051

5152
/** Gets the minimum character length. @return the min length */
53+
@JsonIgnore
5254
public OptionalInt getMinLength() {
5355
return minLength == null ? OptionalInt.empty() : OptionalInt.of(minLength);
5456
}
@@ -73,6 +75,7 @@ public InputOptions clearMinLength() {
7375
}
7476

7577
/** Gets the maximum character length. @return the max length */
78+
@JsonIgnore
7679
public OptionalInt getMaxLength() {
7780
return maxLength == null ? OptionalInt.empty() : OptionalInt.of(maxLength);
7881
}

src/main/java/com/github/copilot/sdk/json/McpHttpServerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public McpHttpServerConfig setTools(List<String> tools) {
9999
}
100100

101101
@Override
102-
public McpHttpServerConfig setTimeout(int timeout) {
102+
public McpHttpServerConfig setTimeout(Integer timeout) {
103103
super.setTimeout(timeout);
104104
return this;
105105
}

src/main/java/com/github/copilot/sdk/json/McpServerConfig.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import com.fasterxml.jackson.annotation.JsonProperty;
1212
import com.fasterxml.jackson.annotation.JsonSubTypes;
1313
import com.fasterxml.jackson.annotation.JsonTypeInfo;
14-
import com.fasterxml.jackson.annotation.JsonIgnore;
15-
import java.util.OptionalInt;
1614

1715
/**
1816
* Abstract base class for MCP (Model Context Protocol) server configurations.
@@ -70,34 +68,21 @@ public McpServerConfig setTools(List<String> tools) {
7068
/**
7169
* Gets the optional timeout in milliseconds for tool calls to this server.
7270
*
73-
* @return an {@link OptionalInt} containing the timeout in milliseconds, or
74-
* empty for the default
71+
* @return the timeout in milliseconds, or {@code null} for the default
7572
*/
76-
@JsonIgnore
77-
public OptionalInt getTimeout() {
78-
return timeout == null ? OptionalInt.empty() : OptionalInt.of(timeout);
73+
public Integer getTimeout() {
74+
return timeout;
7975
}
8076

8177
/**
8278
* Sets an optional timeout in milliseconds for tool calls to this server.
8379
*
8480
* @param timeout
85-
* the timeout in milliseconds
81+
* the timeout in milliseconds, or {@code null} for the default
8682
* @return this config for method chaining
8783
*/
88-
public McpServerConfig setTimeout(int timeout) {
84+
public McpServerConfig setTimeout(Integer timeout) {
8985
this.timeout = timeout;
9086
return this;
9187
}
92-
93-
/**
94-
* Clears the timeout setting, reverting to the default behavior.
95-
*
96-
* @return this instance for method chaining
97-
*/
98-
public McpServerConfig clearTimeout() {
99-
this.timeout = null;
100-
return this;
101-
}
102-
10388
}

src/main/java/com/github/copilot/sdk/json/McpStdioServerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public McpStdioServerConfig setTools(List<String> tools) {
148148
}
149149

150150
@Override
151-
public McpStdioServerConfig setTimeout(int timeout) {
151+
public McpStdioServerConfig setTimeout(Integer timeout) {
152152
super.setTimeout(timeout);
153153
return this;
154154
}

src/main/java/com/github/copilot/sdk/json/ModelLimits.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
88
import com.fasterxml.jackson.annotation.JsonProperty;
9-
import com.fasterxml.jackson.annotation.JsonIgnore;
10-
import java.util.OptionalInt;
119

1210
/**
1311
* Model limits.
@@ -26,26 +24,15 @@ public class ModelLimits {
2624
@JsonProperty("vision")
2725
private ModelVisionLimits vision;
2826

29-
@JsonIgnore
30-
public OptionalInt getMaxPromptTokens() {
31-
return maxPromptTokens == null ? OptionalInt.empty() : OptionalInt.of(maxPromptTokens);
27+
public Integer getMaxPromptTokens() {
28+
return maxPromptTokens;
3229
}
3330

34-
public ModelLimits setMaxPromptTokens(int maxPromptTokens) {
31+
public ModelLimits setMaxPromptTokens(Integer maxPromptTokens) {
3532
this.maxPromptTokens = maxPromptTokens;
3633
return this;
3734
}
3835

39-
/**
40-
* Clears the maxPromptTokens setting, reverting to the default behavior.
41-
*
42-
* @return this instance for method chaining
43-
*/
44-
public ModelLimits clearMaxPromptTokens() {
45-
this.maxPromptTokens = null;
46-
return this;
47-
}
48-
4936
public int getMaxContextWindowTokens() {
5037
return maxContextWindowTokens;
5138
}

src/test/java/com/github/copilot/sdk/DataObjectCoverageTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void mcpHttpServerConfigCoversGettersAndFluentSetters() {
194194
assertEquals("https://mcp.example.com/sse", cfg.getUrl());
195195
assertEquals("Bearer token", cfg.getHeaders().get("Authorization"));
196196
assertEquals(tools, cfg.getTools());
197-
assertEquals(45, cfg.getTimeout().getAsInt());
197+
assertEquals(45, cfg.getTimeout());
198198
}
199199

200200
@Test
@@ -212,7 +212,7 @@ void mcpStdioServerConfigCoversGettersAndFluentSetters() {
212212
assertEquals("1", cfg.getEnv().get("DEBUG"));
213213
assertEquals("/tmp", cfg.getWorkingDirectory());
214214
assertEquals(tools, cfg.getTools());
215-
assertEquals(30, cfg.getTimeout().getAsInt());
215+
assertEquals(30, cfg.getTimeout());
216216
}
217217

218218
@Test

0 commit comments

Comments
 (0)