Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ContentBlock.cs
1using System;
3using System.Threading.Tasks;
4
6{
10 public abstract class ContentBlock : Annotations, IContentBlock
11 {
15 public ContentBlock()
16 : base()
17 {
18 }
19
23 public ContentBlock(McpRole[]? Audience, double? Priority, DateTime? LastModified,
24 Dictionary<string, object>? MetaData)
26 {
27 this.MetaData = MetaData;
28 }
29
33 public Dictionary<string, object>? MetaData { get; }
34
38 public abstract Type[] Encodes { get; }
39
43 public abstract bool IsStructuredContent { get; }
44
51 public abstract Task<Dictionary<string, object>> Encode(object Content);
52
57 public override void Annotate(Dictionary<string, object> Object)
58 {
59 base.Annotate(Object);
60
61 if (!(this.MetaData is null))
62 Object["_meta"] = this.MetaData;
63 }
64 }
65}
Abstract base class for annotated objects.
Definition: Annotations.cs:11
DateTime? LastModified
The moment the resource was last modified, as an ISO 8601 formatted string.
Definition: Annotations.cs:61
double? Priority
Describes how important this data is for operating the server.
Definition: Annotations.cs:53
McpRole?[] Audience
Describes who the intended audience of this object or data is.
Definition: Annotations.cs:44
Abstract base class for an MCP Content Block.
Definition: ContentBlock.cs:11
override void Annotate(Dictionary< string, object > Object)
Annotates an object.
Definition: ContentBlock.cs:57
abstract Type[] Encodes
What types the content block encodes.
Definition: ContentBlock.cs:38
ContentBlock()
Abstract base class for an MCP Content Block.
Definition: ContentBlock.cs:15
abstract bool IsStructuredContent
If the content block is encoded as structured content.
Definition: ContentBlock.cs:43
abstract Task< Dictionary< string, object > > Encode(object Content)
Encodes a content block, given the content to encode and available annotations and meta-data.
ContentBlock(McpRole[]? Audience, double? Priority, DateTime? LastModified, Dictionary< string, object >? MetaData)
Abstract base class for an MCP Content Block.
Definition: ContentBlock.cs:23
McpRole
Identifies a Role in a Model Context Protocol (MCP) context.
Definition: McpRole.cs:7