Tool constructor

Tool({
  1. required String name,
  2. String? title,
  3. String? description,
  4. required ObjectSchema inputSchema,
  5. ObjectSchema? outputSchema,
  6. ToolAnnotations? annotations,
  7. Meta? meta,
})

Implementation

factory Tool({
  required String name,
  String? title,
  String? description,
  required ObjectSchema inputSchema,
  // Only supported since version `ProtocolVersion.v2025_06_18`.
  ObjectSchema? outputSchema,
  // Only supported since version `ProtocolVersion.v2025_03_26`.
  ToolAnnotations? annotations,
  // Only supported since version `ProtocolVersion.v2025_03_26`.
  Meta? meta,
}) => Tool.fromMap({
  'name': name,
  if (title != null) 'title': title,
  if (description != null) 'description': description,
  'inputSchema': inputSchema,
  if (outputSchema != null) 'outputSchema': outputSchema,
  if (annotations != null) 'annotations': annotations,
  if (meta != null) '_meta': meta,
});