Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a base class for request params that exposes the progressToken #99

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Used by the client to invoke a tool provided by the server.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class CallToolRequestParams
public class CallToolRequestParams : RequestParams
{
/// <summary>
/// Tool name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// A request from the client to the server, to ask for completion options.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class CompleteRequestParams
public class CompleteRequestParams : RequestParams
{
/// <summary>
/// The reference's information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// clients have full discretion over model selection and should inform users before sampling.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class CreateMessageRequestParams
public class CreateMessageRequestParams : RequestParams
{
/// <summary>
/// A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Used by the client to get a prompt provided by the server.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class GetPromptRequestParams
public class GetPromptRequestParams : RequestParams
{
/// <summary>
/// he name of the prompt or prompt template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types;
/// Parameters for an initialization request sent to the server.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public record InitializeRequestParams
public class InitializeRequestParams : RequestParams
{
/// <summary>
/// The version of the Model Context Protocol that the client wants to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Sent from the client to the server, to read a specific resource URI.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class ReadResourceRequestParams
public class ReadResourceRequestParams : RequestParams
{
/// <summary>
/// The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
Expand Down
17 changes: 17 additions & 0 deletions src/ModelContextProtocol/Protocol/Types/RequestParams.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace ModelContextProtocol.Protocol.Types;

/// <summary>
/// Base class for all request parameters.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json#L771-L806">See the schema for details</see>
/// </summary>
public abstract class RequestParams
{
/// <summary>
/// Metadata related to the tool invocation.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("_meta")]
public RequestParamsMetadata? Meta { get; init; }
}
16 changes: 16 additions & 0 deletions src/ModelContextProtocol/Protocol/Types/RequestParamsMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace ModelContextProtocol.Protocol.Types;

/// <summary>
/// Metadata related to the request.
/// </summary>
public class RequestParamsMetadata
{
/// <summary>
/// If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("progressToken")]
public object ProgressToken { get; set; } = default!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types;
/// A request from the client to the server, to enable or adjust logging.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class SetLevelRequestParams
public class SetLevelRequestParams : RequestParams
{
/// <summary>
/// The level of logging that the client wants to receive from the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Sent from the client to request updated notifications from the server whenever a particular primitive changes.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class SubscribeRequestParams
public class SubscribeRequestParams : RequestParams
{
/// <summary>
/// The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Sent from the client to request not receiving updated notifications from the server whenever a primitive resource changes.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
/// </summary>
public class UnsubscribeRequestParams
public class UnsubscribeRequestParams : RequestParams
{
/// <summary>
/// The URI of the resource to unsubscribe fro. The URI can use any protocol; it is up to the server how to interpret it.
Expand Down