fix: skip debug log for high-frequency tool-input-partial notifications
These fire dozens of times per second during streaming and flood the console. All other JSON-RPC messages still log at debug level.
This commit is contained in:
parent
2b0d11e64c
commit
20d623f20c
1 changed files with 6 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import {
|
||||||
Transport,
|
Transport,
|
||||||
TransportSendOptions,
|
TransportSendOptions,
|
||||||
} from "@modelcontextprotocol/sdk/shared/transport.js";
|
} from "@modelcontextprotocol/sdk/shared/transport.js";
|
||||||
|
import { TOOL_INPUT_PARTIAL_METHOD } from "./spec.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON-RPC transport using `window.postMessage` for iframe↔parent communication.
|
* JSON-RPC transport using `window.postMessage` for iframe↔parent communication.
|
||||||
|
|
@ -123,7 +124,11 @@ export class PostMessageTransport implements Transport {
|
||||||
* @param options - Optional send options (currently unused)
|
* @param options - Optional send options (currently unused)
|
||||||
*/
|
*/
|
||||||
async send(message: JSONRPCMessage, options?: TransportSendOptions) {
|
async send(message: JSONRPCMessage, options?: TransportSendOptions) {
|
||||||
console.debug("Sending message", message);
|
// Skip debug log for high-frequency streaming notifications — these
|
||||||
|
// can fire dozens of times per second and flood the console.
|
||||||
|
if ((message as { method?: string }).method !== TOOL_INPUT_PARTIAL_METHOD) {
|
||||||
|
console.debug("Sending message", message);
|
||||||
|
}
|
||||||
this.eventTarget.postMessage(message, "*");
|
this.eventTarget.postMessage(message, "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue