Skip to content

Commit 92859ef

Browse files
authored
mcp: rename LoggingMessage to Log (#42)
Use a verb for this method name.
1 parent 10dcf48 commit 92859ef

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

mcp/logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ func (h *LoggingHandler) handle(ctx context.Context, r slog.Record) error {
185185
// documentation says not to.
186186
// In this case logging is a service to clients, not a means for debugging the
187187
// server, so we want to cancel the log message.
188-
return h.ss.LoggingMessage(ctx, params)
188+
return h.ss.Log(ctx, params)
189189
}

mcp/mcp_test.go

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

371371
mustLog := func(level LoggingLevel, data any) {
372372
t.Helper()
373-
if err := ss.LoggingMessage(ctx, &LoggingMessageParams{
373+
if err := ss.Log(ctx, &LoggingMessageParams{
374374
Logger: "test",
375375
Level: level,
376376
Data: data,

mcp/server.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ func fileResourceHandler(dir string) ResourceHandler {
413413
}
414414
// TODO(jba): figure out mime type. Omit for now: Server.readResource will fill it in.
415415
return &ReadResourceResult{Contents: []*ResourceContents{
416-
&ResourceContents{URI: params.URI, Blob: data},
416+
{URI: params.URI, Blob: data},
417417
}}, nil
418418
}
419419
}
@@ -510,12 +510,10 @@ func (ss *ServerSession) CreateMessage(ctx context.Context, params *CreateMessag
510510
return handleSend[*CreateMessageResult](ctx, ss, methodCreateMessage, orZero[Params](params))
511511
}
512512

513-
// LoggingMessage sends a logging message to the client.
513+
// Log sends a log message to the client.
514514
// The message is not sent if the client has not called SetLevel, or if its level
515515
// is below that of the last SetLevel.
516-
//
517-
// TODO(jba): rename to Log or LogMessage. A logging message is the thing that is sent to logging.
518-
func (ss *ServerSession) LoggingMessage(ctx context.Context, params *LoggingMessageParams) error {
516+
func (ss *ServerSession) Log(ctx context.Context, params *LoggingMessageParams) error {
519517
ss.mu.Lock()
520518
logLevel := ss.logLevel
521519
ss.mu.Unlock()

0 commit comments

Comments
 (0)