PromptArgument class

Annotation to provide rich metadata for individual arguments in a Prompt.

Use this annotation to customize how prompt arguments are presented to MCP clients, including human-readable titles, descriptions, and requirement status.

Example:

@Prompt(description: 'Generate documentation for code')
PromptResult documentCode({
  @PromptArgument(
    title: 'Source Code',
    description: 'The code to generate documentation for',
  )
  required String code,

  @PromptArgument(
    title: 'Language',
    description: 'Programming language of the code',
    required: true,
  )
  String? language,
}) {
  // ...
}
Annotations
  • @immutable

Constructors

PromptArgument({String? alias, String? title, String? description, bool? required})
Creates a PromptArgument annotation.
const

Properties

alias String?
Custom external name for this argument.
final
description String?
Detailed description of what this argument represents.
final
hashCode int
The hash code for this object.
no setterinherited
required bool?
Whether this argument is required.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String?
Human-readable title for this argument.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited