Skip to content

Commit 52734fd

Browse files
authored
mcp: rename logging symbols (#321)
Fixes #279.
1 parent 75f9999 commit 52734fd

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

mcp/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ func (e unsupportedProtocolVersionError) Error() string {
103103
}
104104

105105
// ClientSessionOptions is reserved for future use.
106-
type ClientSessionOptions struct {
107-
}
106+
type ClientSessionOptions struct{}
108107

109108
// Connect begins an MCP session by connecting to a server over the given
110109
// transport, and initializing the session.
@@ -398,7 +397,7 @@ func (cs *ClientSession) CallTool(ctx context.Context, params *CallToolParams) (
398397
return handleSend[*CallToolResult](ctx, methodCallTool, newClientRequest(cs, orZero[Params](params)))
399398
}
400399

401-
func (cs *ClientSession) SetLevel(ctx context.Context, params *SetLevelParams) error {
400+
func (cs *ClientSession) SetLoggingLevel(ctx context.Context, params *SetLoggingLevelParams) error {
402401
_, err := handleSend[*emptyResult](ctx, methodSetLevel, newClientRequest(cs, orZero[Params](params)))
403402
return err
404403
}

mcp/mcp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func TestEndToEnd(t *testing.T) {
404404

405405
// Nothing should be logged until the client sets a level.
406406
mustLog("info", "before")
407-
if err := cs.SetLevel(ctx, &SetLevelParams{Level: "warning"}); err != nil {
407+
if err := cs.SetLoggingLevel(ctx, &SetLoggingLevelParams{Level: "warning"}); err != nil {
408408
t.Fatal(err)
409409
}
410410
mustLog("warning", want[0].Data)

mcp/protocol.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ func (m *SamplingMessage) UnmarshalJSON(data []byte) error {
826826
return nil
827827
}
828828

829-
type SetLevelParams struct {
829+
type SetLoggingLevelParams struct {
830830
// This property is reserved by the protocol to allow clients and servers to
831831
// attach additional metadata to their responses.
832832
Meta `json:"_meta,omitempty"`
@@ -836,9 +836,9 @@ type SetLevelParams struct {
836836
Level LoggingLevel `json:"level"`
837837
}
838838

839-
func (x *SetLevelParams) isParams() {}
840-
func (x *SetLevelParams) GetProgressToken() any { return getProgressToken(x) }
841-
func (x *SetLevelParams) SetProgressToken(t any) { setProgressToken(x, t) }
839+
func (x *SetLoggingLevelParams) isParams() {}
840+
func (x *SetLoggingLevelParams) GetProgressToken() any { return getProgressToken(x) }
841+
func (x *SetLoggingLevelParams) SetProgressToken(t any) { setProgressToken(x, t) }
842842

843843
// Definition for a tool the client can call.
844844
type Tool struct {

mcp/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ func (ss *ServerSession) cancel(context.Context, *CancelledParams) (Result, erro
857857
return nil, nil
858858
}
859859

860-
func (ss *ServerSession) setLevel(_ context.Context, params *SetLevelParams) (*emptyResult, error) {
860+
func (ss *ServerSession) setLevel(_ context.Context, params *SetLoggingLevelParams) (*emptyResult, error) {
861861
ss.updateState(func(state *ServerSessionState) {
862862
state.LogLevel = params.Level
863863
})

0 commit comments

Comments
 (0)