-
Notifications
You must be signed in to change notification settings - Fork 545
Logging Capability #53
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
Merged
stephentoub
merged 6 commits into
modelcontextprotocol:main
from
PederHP:logging_capability_raw
Mar 21, 2025
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ba3f54
Logging Capability
PederHP 4223bf4
Merge branch 'modelcontextprotocol:main' into logging_capability_raw
PederHP 1d4e28a
Merge branch 'main' into logging_capability_raw
PederHP cb64136
Readability
PederHP 09853c1
Redundant using
PederHP 5bdf35f
Merge branch 'main' into logging_capability_raw
stephentoub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace ModelContextProtocol.Protocol.Types; | ||
|
||
/// <summary> | ||
/// The severity of a log message. | ||
/// These map to syslog message severities, as specified in RFC-5424: | ||
/// https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 | ||
/// </summary> | ||
public enum LoggingLevel | ||
{ | ||
/// <summary>Detailed debug information, typically only valuable to developers.</summary> | ||
[JsonPropertyName("debug")] | ||
Debug, | ||
|
||
/// <summary>Normal operational messages that require no action.</summary> | ||
[JsonPropertyName("info")] | ||
Info, | ||
|
||
/// <summary>Normal but significant events that might deserve attention.</summary> | ||
[JsonPropertyName("notice")] | ||
Notice, | ||
|
||
/// <summary>Warning conditions that don't represent an error but indicate potential issues.</summary> | ||
[JsonPropertyName("warning")] | ||
Warning, | ||
|
||
/// <summary>Error conditions that should be addressed but don't require immediate action.</summary> | ||
[JsonPropertyName("error")] | ||
Error, | ||
|
||
/// <summary>Critical conditions that require immediate attention.</summary> | ||
[JsonPropertyName("critical")] | ||
Critical, | ||
|
||
/// <summary>Action must be taken immediately to address the condition.</summary> | ||
[JsonPropertyName("alert")] | ||
Alert, | ||
|
||
/// <summary>System is unusable and requires immediate attention.</summary> | ||
[JsonPropertyName("emergency")] | ||
Emergency | ||
} |
30 changes: 30 additions & 0 deletions
30
src/ModelContextProtocol/Protocol/Types/LoggingMessageNotificationParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Text.Json; | ||
|
||
namespace ModelContextProtocol.Protocol.Types; | ||
|
||
/// <summary> | ||
/// Sent from the server as the payload of "notifications/message" notifications whenever a log message is generated. | ||
/// | ||
/// If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. | ||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see> | ||
/// </summary> | ||
public class LoggingMessageNotificationParams | ||
{ | ||
/// <summary> | ||
/// The severity of this log message. | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("level")] | ||
public LoggingLevel Level { get; init; } | ||
|
||
/// <summary> | ||
/// An optional name of the logger issuing this message. | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("logger")] | ||
public string? Logger { get; init; } | ||
|
||
/// <summary> | ||
/// The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("data")] | ||
public JsonElement? Data { get; init; } | ||
} |
15 changes: 15 additions & 0 deletions
15
src/ModelContextProtocol/Protocol/Types/SetLevelRequestParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace ModelContextProtocol.Protocol.Types; | ||
|
||
/// <summary> | ||
/// 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 | ||
{ | ||
/// <summary> | ||
/// The level of logging that the client wants to receive from the server. | ||
/// The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message. | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("level")] | ||
PederHP marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
public required LoggingLevel Level { get; init; } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.