File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ export class AppBridge extends ProtocolWithEvents<
372372
373373 // Default handler for requestDisplayMode - returns current mode from host context.
374374 // Hosts can override this by setting bridge.onrequestdisplaymode = ...
375- this . setDefaultRequestHandler (
375+ this . replaceRequestHandler (
376376 McpUiRequestDisplayModeRequestSchema ,
377377 ( request ) => {
378378 const currentMode = this . _hostContext . displayMode ?? "inline" ;
Original file line number Diff line number Diff line change @@ -415,9 +415,9 @@ export class App extends ProtocolWithEvents<
415415 }
416416 this . _toolHandlersInitialized = true ;
417417
418- // Register via setDefaultRequestHandler so users can still override with
418+ // Register via replaceRequestHandler so users can still override with
419419 // their own oncalltool/onlisttools after calling registerTool.
420- this . setDefaultRequestHandler (
420+ this . replaceRequestHandler (
421421 CallToolRequestSchema ,
422422 async ( request , extra ) => {
423423 const tool = this . _registeredTools [ request . params . name ] ;
@@ -427,7 +427,7 @@ export class App extends ProtocolWithEvents<
427427 return ( tool . handler as any ) ( request . params . arguments as any , extra ) ;
428428 } ,
429429 ) ;
430- this . setDefaultRequestHandler ( ListToolsRequestSchema , async ( ) => {
430+ this . replaceRequestHandler ( ListToolsRequestSchema , async ( ) => {
431431 const tools : Tool [ ] = Object . entries ( this . _registeredTools )
432432 . filter ( ( [ _ , tool ] ) => tool . enabled )
433433 . map ( ( [ name , tool ] ) => {
Original file line number Diff line number Diff line change @@ -188,19 +188,6 @@ export abstract class ProtocolWithEvents<
188188
189189 // ── Handler registration with double-set protection ─────────────────
190190
191- /**
192- * Register a request handler without tracking it. Subclass constructors
193- * use this for overridable defaults — a later `setRequestHandler` call
194- * (or `on*` setter) for the same method will succeed, replacing the
195- * default.
196- */
197- protected setDefaultRequestHandler : Protocol <
198- SendRequestT ,
199- SendNotificationT ,
200- SendResultT
201- > [ "setRequestHandler" ] = ( schema , handler ) =>
202- super . setRequestHandler ( schema , handler ) ;
203-
204191 // The two overrides below are arrow-function class fields rather than
205192 // prototype methods so that Protocol's constructor — which registers its
206193 // own ping/cancelled/progress handlers via `this.setRequestHandler`
You can’t perform that action at this time.
0 commit comments