mcp: rename LoggingMessage to Log (#42)
Use a verb for this method name.
This commit is contained in:
parent
10dcf48fdb
commit
92859ef391
3 changed files with 5 additions and 7 deletions
|
|
@ -185,5 +185,5 @@ func (h *LoggingHandler) handle(ctx context.Context, r slog.Record) error {
|
||||||
// documentation says not to.
|
// documentation says not to.
|
||||||
// In this case logging is a service to clients, not a means for debugging the
|
// In this case logging is a service to clients, not a means for debugging the
|
||||||
// server, so we want to cancel the log message.
|
// server, so we want to cancel the log message.
|
||||||
return h.ss.LoggingMessage(ctx, params)
|
return h.ss.Log(ctx, params)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ func TestEndToEnd(t *testing.T) {
|
||||||
|
|
||||||
mustLog := func(level LoggingLevel, data any) {
|
mustLog := func(level LoggingLevel, data any) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if err := ss.LoggingMessage(ctx, &LoggingMessageParams{
|
if err := ss.Log(ctx, &LoggingMessageParams{
|
||||||
Logger: "test",
|
Logger: "test",
|
||||||
Level: level,
|
Level: level,
|
||||||
Data: data,
|
Data: data,
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ func fileResourceHandler(dir string) ResourceHandler {
|
||||||
}
|
}
|
||||||
// TODO(jba): figure out mime type. Omit for now: Server.readResource will fill it in.
|
// TODO(jba): figure out mime type. Omit for now: Server.readResource will fill it in.
|
||||||
return &ReadResourceResult{Contents: []*ResourceContents{
|
return &ReadResourceResult{Contents: []*ResourceContents{
|
||||||
&ResourceContents{URI: params.URI, Blob: data},
|
{URI: params.URI, Blob: data},
|
||||||
}}, nil
|
}}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -510,12 +510,10 @@ func (ss *ServerSession) CreateMessage(ctx context.Context, params *CreateMessag
|
||||||
return handleSend[*CreateMessageResult](ctx, ss, methodCreateMessage, orZero[Params](params))
|
return handleSend[*CreateMessageResult](ctx, ss, methodCreateMessage, orZero[Params](params))
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoggingMessage sends a logging message to the client.
|
// Log sends a log message to the client.
|
||||||
// The message is not sent if the client has not called SetLevel, or if its level
|
// The message is not sent if the client has not called SetLevel, or if its level
|
||||||
// is below that of the last SetLevel.
|
// is below that of the last SetLevel.
|
||||||
//
|
func (ss *ServerSession) Log(ctx context.Context, params *LoggingMessageParams) error {
|
||||||
// TODO(jba): rename to Log or LogMessage. A logging message is the thing that is sent to logging.
|
|
||||||
func (ss *ServerSession) LoggingMessage(ctx context.Context, params *LoggingMessageParams) error {
|
|
||||||
ss.mu.Lock()
|
ss.mu.Lock()
|
||||||
logLevel := ss.logLevel
|
logLevel := ss.logLevel
|
||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue