Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 7f25221

Browse files
committed
Improve MpcSchema structure
1 parent 9081b63 commit 7f25221

File tree

1 file changed

+40
-19
lines changed
  • spring-ai-mcp-core/src/main/java/org/springframework/ai/mcp/spec

1 file changed

+40
-19
lines changed

spring-ai-mcp-core/src/main/java/org/springframework/ai/mcp/spec/McpSchema.java

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,22 @@ public record SamplingMessage(// @formatter:off
451451

452452
// Sampling and Message Creation
453453
@JsonInclude(JsonInclude.Include.NON_ABSENT)
454-
public record CreateMessageRequest(List<SamplingMessage> messages, ModelPreferences modelPreferences,
455-
String systemPrompt, ContextInclusionStrategy includeContext, Double temperature, int maxTokens,
456-
List<String> stopSequences, Map<String, Object> metadata) implements Request {
457-
458-
public enum ContextInclusionStrategy {// @formatter:off
454+
public record CreateMessageRequest(// @formatter:off
455+
@JsonProperty("messages") List<SamplingMessage> messages,
456+
@JsonProperty("modelPreferences") ModelPreferences modelPreferences,
457+
@JsonProperty("systemPrompt") String systemPrompt,
458+
@JsonProperty("includeContext") ContextInclusionStrategy includeContext,
459+
@JsonProperty("temperature") Double temperature,
460+
@JsonProperty("maxTokens") int maxTokens,
461+
@JsonProperty("stopSequences") List<String> stopSequences,
462+
@JsonProperty("metadata") Map<String, Object> metadata) implements Request {
463+
464+
public enum ContextInclusionStrategy {
459465
@JsonProperty("none") NONE,
460466
@JsonProperty("this_server") THIS_SERVER,
461467
@JsonProperty("all_server") ALL_SERVERS
462-
} // @formatter:on
463-
}
468+
}
469+
}// @formatter:on
464470

465471
@JsonInclude(JsonInclude.Include.NON_ABSENT)
466472
public record CreateMessageResult(Role role, Content content, String model, StopReason stopReason) {
@@ -499,11 +505,17 @@ public record PaginatedResult(@JsonProperty("nextCursor") String nextCursor) {
499505
// ---------------------------
500506
// Progress and Logging
501507
// ---------------------------
502-
public record ProgressNotification(String progressToken, double progress, Double total) {
503-
}
508+
public record ProgressNotification(// @formatter:off
509+
@JsonProperty("progressToken") String progressToken,
510+
@JsonProperty("progress") double progress,
511+
@JsonProperty("total") Double total) {
512+
}// @formatter:on
504513

505-
public record LoggingMessageNotification(LoggingLevel level, String logger, Object data) {
506-
}
514+
public record LoggingMessageNotification(// @formatter:off
515+
@JsonProperty("level") LoggingLevel level,
516+
@JsonProperty("logger") String logger,
517+
@JsonProperty("data") Object data) {
518+
}// @formatter:on
507519

508520
// ---------------------------
509521
// Autocomplete
@@ -515,19 +527,28 @@ public sealed interface PromptOrResourceReference permits PromptReference, Resou
515527

516528
}
517529

518-
public record PromptReference(String type, String name) implements PromptOrResourceReference {
519-
}
530+
public record PromptReference(// @formatter:off
531+
@JsonProperty("type") String type,
532+
@JsonProperty("name") String name) implements PromptOrResourceReference {
533+
}// @formatter:on
520534

521-
public record ResourceReference(String type, String uri) implements PromptOrResourceReference {
522-
}
535+
public record ResourceReference(// @formatter:off
536+
@JsonProperty("type") String type,
537+
@JsonProperty("uri") String uri) implements PromptOrResourceReference {
538+
}// @formatter:on
523539

524-
public record CompleteArgument(String name, String value) {
525-
}
540+
public record CompleteArgument(// @formatter:off
541+
@JsonProperty("name") String name,
542+
@JsonProperty("value") String value) {
543+
}// @formatter:on
526544
}
527545

528546
public record CompleteResult(CompleteCompletion completion) {
529-
public record CompleteCompletion(List<String> values, Integer total, Boolean hasMore) {
530-
}
547+
public record CompleteCompletion(// @formatter:off
548+
@JsonProperty("values") List<String> values,
549+
@JsonProperty("total") Integer total,
550+
@JsonProperty("hasMore") Boolean hasMore) {
551+
}// @formatter:on
531552
}
532553

533554
// ---------------------------

0 commit comments

Comments
 (0)