This repository was archived by the owner on Apr 11, 2026. It is now read-only.
feat: add _meta support to @McpTool and @McpResource annotations#102
Closed
apappascs wants to merge 1 commit intospring-ai-community:mainfrom
Closed
feat: add _meta support to @McpTool and @McpResource annotations#102apappascs wants to merge 1 commit intospring-ai-community:mainfrom
apappascs wants to merge 1 commit intospring-ai-community:mainfrom
Conversation
Add `meta` attribute to both annotations, enabling MCP Apps UI metadata (e.g. _meta.ui.resourceUri, _meta.ui.csp) to be declared directly on annotated methods. Meta propagates to tool/resource declarations and to resource content in ReadResourceResult. Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
e42f02a to
3dbf7c4
Compare
Contributor
Author
|
@tzolov do you have a standardized way to fully test this ? I realized this dependency is used from the one in Spring ai mcp annotations . |
tzolov
pushed a commit
that referenced
this pull request
Mar 2, 2026
…otations Adds a `metaProvider` attribute to the @mcptool, @McpPrompt, and @McpResource annotations, allowing users to attach arbitrary `_meta` data to MCP tool, prompt, and resource declarations. Meta is propagated to both the declarations and to resource content in ReadResourceResult. Introduces a `MetaProvider` interface and `DefaultMetaProvider` no-op implementation, along with a `MetaUtils` helper that instantiates the provider via a no-arg constructor and returns an unmodifiable metadata map. Usage: @mcptool(metaProvider = MyMetaProvider.class) String myTool() { ... } class MyMetaProvider implements MetaProvider { @OverRide public Map<String, Object> getMeta() { return Map.of( "openai/widgetPrefersBorder", true, "openai/widgetDomain", "https://chatgpt.com"); } } Combines #102 and #83 Resolves: #81 Signed-off-by: Alexandros Pappas <apappascs@gmail.com> Signed-off-by: Vadzim Shurmialiou <vadzim.shurmialiou@check24.de> Signed-off-by: Craig Walls <habuma@gmail.com> Co-authored-by: Alexandros Pappas <apappascs@gmail.com> Co-authored-by: Craig Walls <habuma@gmail.com>
tzolov
pushed a commit
that referenced
this pull request
Mar 2, 2026
…otations Adds a `metaProvider` attribute to the @mcptool, @McpPrompt, and @McpResource annotations, allowing users to attach arbitrary `_meta` data to MCP tool, prompt, and resource declarations. Meta is propagated to both the declarations and to resource content in ReadResourceResult. Introduces a `MetaProvider` interface and `DefaultMetaProvider` no-op implementation, along with a `MetaUtils` helper that instantiates the provider via a no-arg constructor and returns an unmodifiable metadata map. Usage: @mcptool(metaProvider = MyMetaProvider.class) String myTool() { ... } class MyMetaProvider implements MetaProvider { @OverRide public Map<String, Object> getMeta() { return Map.of( "openai/widgetPrefersBorder", true, "openai/widgetDomain", "https://chatgpt.com"); } } Combines #102 and #83 Resolves: #81 Signed-off-by: Alexandros Pappas <apappascs@gmail.com> Signed-off-by: Vadzim Shurmialiou <vadzim.shurmialiou@check24.de> Signed-off-by: Craig Walls <habuma@gmail.com> Co-authored-by: Alexandros Pappas <apappascs@gmail.com> Co-authored-by: Craig Walls <habuma@gmail.com>
Collaborator
|
This PR has been merged as part of the c7ffe98, thank you @apappascs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
metaattribute to both annotations, enabling MCP Apps UI metadata (e.g. _meta.ui.resourceUri, _meta.ui.csp) to be declared directly on annotated methods. Meta propagates to tool/resource declarations and to resource content in ReadResourceResult.