ResourceLink class final

A resource that the server is capable of reading, included in a prompt or tool call result.

Note: resource links returned by tools are not guaranteed to appear in the results of ListResourcesRequestresources/list requests.

Revisions: 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.

Inheritance
Implemented types

Constructors

ResourceLink({Map<String, Object?>? meta, Annotations? annotations, String? description, String? mimeType, required String name, int? size, String? title, required String uri, List<McpIcon>? icons, Map<String, Object?>? extra})
ResourceLink.fromJson(Map<String, Object?> json)
Wraps json as received; nothing is dropped.

Properties

annotations → Annotations?
Optional annotations for the client.
no setter
description → String?
A description of what this resource represents.
no setter
extra → Map<String, Object?>
Keys outside the schema (newer revisions, extensions, applications).
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
icons → List<McpIcon>?
Optional set of sized icons that the client can display in a user interface.
no setter
meta → Map<String, Object?>?
no setter
mimeType → String?
The MIME type of this resource, if known.
no setter
name → String
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaKeys → Set<String>
Property names the schema defines for this type.
no setteroverride
size → int?
The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
no setter
title → String?
Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.
no setter
type → String
no setter
uri → String
The URI of this resource.
no setter

Methods

$optional<T>(String key, T? read(Object? value, String path)) → T?
Optional property key, converted by read; null when absent or null.
inherited
$required<T>(String key, T read(Object? value, String path)) → T
Required property key, converted by read.
inherited
check() → List<String>
Reads every property this type defines and returns what could not be read (missing required properties, wrong types), nested types included. Empty = the JSON matches the schema's shape for this type.
override
copyWith({Map<String, Object?>? meta, Annotations? annotations, String? description, String? mimeType, String? name, int? size, String? title, String? uri, List<McpIcon>? icons}) → ResourceLink
A copy with the given properties replaced; everything else, unknown keys included, is kept.
has(String key) → bool
Whether key is present (a null value counts as present).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The JSON form of this value.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
Equal when the JSON is equal; key order does not matter.
inherited
operator [](String key) → Object?
The raw JSON value of key.
inherited

Constants

keys → const Set<String>