-
Notifications
You must be signed in to change notification settings - Fork 2k
Localized tool definitions #4492
Unanswered
marshalhayes
asked this question in
Q&A
-
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"
}
}
}
}Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment