Package akka.javasdk.annotations.mcp
Annotation Interface McpPrompt
Annotation to expose a method as an MCP prompt that clients can fetch and use.
MCP prompts provide template prompts that can be customized with input parameters. They help standardize common prompting patterns and make them reusable across different AI interactions.
Method Requirements:
- Must be public
- Must return a
String
- Can have zero or more parameters
- Must be in a class annotated with
McpEndpoint
Parameter Types: All parameters must be either String
for required
parameters or Optional<String>
for optional parameters. Use Description
annotations to describe the purpose of each parameter.
Prompt Roles: Prompts can be designated as "user" prompts (default) or
"assistant" prompts using the role()
attribute. This helps clients understand how to use
the prompt in their conversation flow.
Use Cases:
- Code review templates
- Analysis frameworks
- Structured questioning patterns
- Domain-specific prompt templates
-
Optional Element Summary
Optional Elements
-
Element Details
-
name
String name- Returns:
- The name of the prompt or prompt template. If it is undefined, the annotated method name is used.
- Default:
""
-
description
String description- Returns:
- An optional description of what this prompt provides
- Default:
""
-
role
String role- Returns:
- Either "user" for user prompts or "assistant". Default if undefined is "user".
- Default:
"user"
-