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

Localized tool definitions #4492

Unanswered
marshalhayes asked this question in Q&A
Discussion options

Is there a way to register localized tool definitions on a per-request basis when using the webmvc transport?

For example, if I registered a tool with parameterized names and descriptions:

@Component
public class MyTool {
 @Tool(name = "{tools.mytool.name}", description = "{tools.mytool.description}")
 public String myToolMethod(@ToolParam(description = "{tools.mytool.params.input.description}") String input) {
 return "Processed input: " + input;
 }
}

And then defined a MessageSource , LocaleResolver, and some message properties:

@Configuration
class MessageConfig {
 @Bean
 MessageSource messageSource() {
 var source = new ReloadableResourceBundleMessageSource();
 source.setBasename("classpath:messages/messages");
 return source;
 }
 @Bean
 LocaleResolver localeResolver() {
 var resolver = new AcceptHeaderLocaleResolver();
 resolver.setDefaultLocale(Locale.ENGLISH);
 return resolver;
 }
}
# /src/main/resources/messages/messages_en.properties
tools.mytool.name=My tool name
tools.mytool.description=This is a description of my tool
tools.mytool.params.input.description=This is a description of the input parameter

How would I then replace the tool definition properties when the client lists them?

This is what I'm hoping to accomplish from a client standpoint:

{
	"servers": {
		"my-mcp-server": {
			"url": "http://localhost:8080/mcp",
			"type": "http",
			"headers": {
				"Accept-Language": "en"
			}
		}
	}
}
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
Category
Q&A
Labels
None yet
1 participant

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