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

Sign up
Appearance settings

_meta information present in the CallToolRequest #405

vignesh1234567 started this conversation in General
Discussion options

Pre-submission Checklist

  • I have checked that this question would not be more appropriate as an issue in a specific repository
  • I have searched existing discussions and documentation for answers

Question Category

  • Protocol Specification
  • SDK Usage
  • Server Implementation
  • General Implementation
  • Documentation
  • Other

Your Question

How can I access the _meta information present in the CallToolRequest and use it within the tool execution logic?
I need to send tokens through the _meta field and consume them during tool execution.

Currently, I'm using:

tool.call().apply(exchange, callToolRequest.arguments())

However, it seems that the full request (including _meta) isn't being passed through. Is there a way to retrieve the complete request, including the metadata?

private McpServerSession.RequestHandler toolsCallRequestHandler() {
return (exchange, params) -> {
McpSchema.CallToolRequest callToolRequest = objectMapper.convertValue(params,
new TypeReference<McpSchema.CallToolRequest>() {
});

		Optional<McpServerFeatures.AsyncToolSpecification> toolSpecification = this.tools.stream()
			.filter(tr -> callToolRequest.name().equals(tr.tool().name()))
			.findAny();
		if (toolSpecification.isEmpty()) {
			return Mono.error(new McpError("Tool not found: " + callToolRequest.name()));
		}
		return toolSpecification.map(tool -> tool.call().apply(exchange, callToolRequest.arguments()))
			.orElse(Mono.error(new McpError("Tool not found: " + callToolRequest.name())));
	};
}
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /