Annotation Interface MetaField
_meta object in MCP definitions.
This annotation can be used on @Tool,
@Prompt,
@Resource,
or @ResourceTemplate methods to add custom metadata that will be
included in the _meta field of the definition sent to clients.
Example:
@MetaField(name = "version", value = "1.0")
@MetaField(prefix = "myapp.io/", name = "customField", value = "customValue")
@Tool(name = "myTool", description = "Example tool")
public String myTool() {
return "result";
}
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceContainer annotation for multipleMetaFieldannotations.static enumThe type of metadata value. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionOptional prefix for the metadata key.The type of the metadata value.
-
Element Details
-
prefix
String prefixOptional prefix for the metadata key.Must be a series of labels separated by dots (
.), followed by a slash (/). Labels must start with a letter and end with a letter or digit; interior characters can be letters, digits, or hyphens (-).Some prefixes are reserved for the MCP spec, e.g.
modelcontextprotocol.io/ortools.mcp.com/.Examples:
"modelcontextprotocol.io/","myapp.io/"- Returns:
- the key prefix
- Default:
""
-
name
String nameThe name of the metadata field.Must begin and end with an alphanumeric character (
[a-z0-9A-Z]). May contain hyphens (-), underscores (_), dots (.), and alphanumerics in between.- Returns:
- the field name
-
type
MetaField.Type typeThe type of the metadata value.- Returns:
- the value type
- Default:
STRING
-
value
String valueThe value of the metadata field as a string.The value will be converted to the appropriate type based on
type().- Returns:
- the field value
-