spring-projects / spring-projects/spring-ai

How to set metadata data information when calling MCP?

Open
#3,363 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

hi, team.

When I read the source code of MCP Java SDK, I found:

@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonIgnoreProperties(ignoreUnknown = true)
public record CreateMessageRequest(// @formatter:off
	@JsonProperty("messages") List<SamplingMessage> messages,
	@JsonProperty("modelPreferences") ModelPreferences modelPreferences,
	@JsonProperty("systemPrompt") String systemPrompt,
	@JsonProperty("includeContext") ContextInclusionStrategy includeContext,
	@JsonProperty("temperature") Double temperature,
	@JsonProperty("maxTokens") int maxTokens,
	@JsonProperty("stopSequences") List<String> stopSequences, 			
	@JsonProperty("metadata") Map<String, Object> metadata) implements Request {

	public enum ContextInclusionStrategy {
		@JsonProperty("none") NONE,
		@JsonProperty("thisServer") THIS_SERVER,
		

but, I don't find where I can set the value.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown Java CreateMessageRequest record and trace the MCP sampling request construction to find where metadata can be supplied. Confirm whether the existing API exposes that value; done should be a documented, reproducible way to set metadata, or a clearly scoped gap if it does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.