csharp-sdk/src/ModelContextProtocol.Core/Protocol/ListPromptsResult.cs
Tarek Mahmoud Sayed c021d0a4f8
Add SEP-2549 caching hints (ttlMs and cacheScope) to cacheable results (#1623)
Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com>
2026-06-15 14:44:01 -07:00

38 lines
1.5 KiB
C#

using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents a server's response to a <see cref="RequestMethods.PromptsList"/> request from the client, containing available prompts.
/// </summary>
/// <remarks>
/// <para>
/// This result is returned when a client sends a <see cref="RequestMethods.PromptsList"/> request to discover available prompts on the server.
/// </para>
/// <para>
/// It inherits from <see cref="PaginatedResult"/>, allowing for paginated responses when there are many prompts.
/// The server can provide the <see cref="PaginatedResult.NextCursor"/> property to indicate there are more
/// prompts available beyond what was returned in the current response.
/// </para>
/// <para>
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
/// </para>
/// </remarks>
public sealed class ListPromptsResult : PaginatedResult, ICacheableResult
{
/// <summary>
/// Gets or sets a list of prompts or prompt templates that the server offers.
/// </summary>
[JsonPropertyName("prompts")]
public IList<Prompt> Prompts { get; set; } = [];
/// <inheritdoc />
[JsonPropertyName("ttlMs")]
[JsonConverter(typeof(TimeSpanMillisecondsConverter))]
public TimeSpan? TimeToLive { get; set; }
/// <inheritdoc />
[JsonPropertyName("cacheScope")]
[JsonConverter(typeof(CacheScopeConverter))]
public CacheScope? CacheScope { get; set; }
}