Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2501,6 +2501,7 @@ public CompleteResult(CompleteCompletion completion) {
* @param hasMore Indicates whether there are additional completion options beyond
* those provided in the current response, even if the exact total is unknown
*/
@JsonInclude(JsonInclude.Include.ALWAYS)
public record CompleteCompletion( // @formatter:off
@JsonProperty("values") List<String> values,
@JsonProperty("total") Integer total,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.modelcontextprotocol.spec;

import io.modelcontextprotocol.json.McpJsonMapper;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;

class CompleteCompletionSerializationTest {

@Test
void codeCompletionSerialization() throws IOException {
McpJsonMapper jsonMapper = McpJsonMapper.getDefault();
McpSchema.CompleteResult.CompleteCompletion codeComplete = new McpSchema.CompleteResult.CompleteCompletion(
Collections.emptyList(), 0, false);
String json = jsonMapper.writeValueAsString(codeComplete);
String expected = """
{"values":[],"total":0,"hasMore":false}""";
assertEquals(expected, json, json);

McpSchema.CompleteResult completeResult = new McpSchema.CompleteResult(codeComplete);
json = jsonMapper.writeValueAsString(completeResult);
expected = """
{"completion":{"values":[],"total":0,"hasMore":false}}""";
assertEquals(expected, json, json);
}

}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.