copyWith method
A copy with the given properties replaced; everything else, unknown keys included, is kept.
Implementation
Tool copyWith({
String? description,
Map<String, Object?>? inputSchema,
String? name,
ToolAnnotations? annotations,
Map<String, Object?>? meta,
Map<String, Object?>? outputSchema,
String? title,
ToolExecution? execution,
List<McpIcon>? icons,
}) =>
Tool.fromJson({
...toJson(),
if (description != null) 'description': $encode(description),
if (inputSchema != null) 'inputSchema': $encode(inputSchema),
if (name != null) 'name': $encode(name),
if (annotations != null) 'annotations': $encode(annotations),
if (meta != null) '_meta': $encode(meta),
if (outputSchema != null) 'outputSchema': $encode(outputSchema),
if (title != null) 'title': $encode(title),
if (execution != null) 'execution': $encode(execution),
if (icons != null) 'icons': $encode(icons),
});