Parameter class

Annotation to provide rich metadata for individual parameters in a Tool.

Use this annotation to customize how parameters are presented to MCP clients, including human-readable titles, descriptions, validation hints, and examples.

Example:

@Tool(description: 'Create a new user')
Future<User> createUser({
  @Parameter(
    title: 'Full Name',
    description: 'The user\'s complete name including first and last name',
    example: 'John Doe',
  )
  required String name,

  @Parameter(
    title: 'Email Address',
    description: 'A valid email address for the user',
    example: 'john.doe@example.com',
  )
  required String email,

  @Parameter(
    title: 'Age',
    description: 'User age in years',
    minimum: 0,
    maximum: 150,
    example: 25,
  )
  int? age,
}) async { ... }
Annotations
  • @immutable

Constructors

Parameter({String? alias, String? title, String? description, Object? example, num? minimum, num? maximum, String? pattern, int? maxLength, bool sensitive = false, List<Object?>? enumValues})
Creates a Parameter annotation.
const

Properties

alias → String?
Custom name for this parameter in generated REST APIs, MCP tool schemas, and OpenAPI specifications.
final
description → String?
Detailed description of what this parameter represents.
final
enumValues → List<Object?>?
Allowed values for enum-like parameters.
final
example → Object?
Example value for this parameter.
final
hashCode → int
The hash code for this object.
no setterinherited
maximum → num?
Maximum value for numeric parameters.
final
maxLength → int?
Maximum length for string parameters.
final
minimum → num?
Minimum value for numeric parameters.
final
pattern → String?
Regular expression pattern for string validation.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sensitive → bool
Whether this parameter should be marked as sensitive.
final
title → String?
Human-readable title for this parameter.
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