@@ -19,7 +19,7 @@ type CachedScopedTools = {
1919 time : number ;
2020} ;
2121
22- export function resolveMcpLoopbackScopedTools ( params : {
22+ type McpLoopbackScopeParams = {
2323 cfg : OpenClawConfig ;
2424 sessionKey : string ;
2525 messageProvider : string | undefined ;
@@ -30,18 +30,13 @@ export function resolveMcpLoopbackScopedTools(params: {
3030 inboundEventKind : InboundEventKind | undefined ;
3131 sourceReplyDeliveryMode : SourceReplyDeliveryMode | undefined ;
3232 senderIsOwner : boolean | undefined ;
33- } ) : { agentId : string | undefined ; tools : McpLoopbackTool [ ] } {
33+ } ;
34+
35+ export function resolveMcpLoopbackScopedTools (
36+ params : McpLoopbackScopeParams ,
37+ ) : { agentId : string | undefined ; tools : McpLoopbackTool [ ] } {
3438 const scoped = resolveGatewayScopedTools ( {
35- cfg : params . cfg ,
36- sessionKey : params . sessionKey ,
37- messageProvider : params . messageProvider ,
38- currentChannelId : params . currentChannelId ,
39- currentThreadTs : params . currentThreadTs ,
40- currentMessageId : params . currentMessageId ,
41- accountId : params . accountId ,
42- inboundEventKind : params . inboundEventKind ,
43- sourceReplyDeliveryMode : params . sourceReplyDeliveryMode ,
44- senderIsOwner : params . senderIsOwner ,
39+ ...params ,
4540 surface : "loopback" ,
4641 excludeToolNames : NATIVE_TOOL_EXCLUDE ,
4742 } ) ;
@@ -54,18 +49,7 @@ export function resolveMcpLoopbackScopedTools(params: {
5449export class McpLoopbackToolCache {
5550 #entries = new Map < string , CachedScopedTools > ( ) ;
5651
57- resolve ( params : {
58- cfg : OpenClawConfig ;
59- sessionKey : string ;
60- messageProvider : string | undefined ;
61- currentChannelId : string | undefined ;
62- currentThreadTs : string | undefined ;
63- currentMessageId : string | number | undefined ;
64- accountId : string | undefined ;
65- inboundEventKind : InboundEventKind | undefined ;
66- sourceReplyDeliveryMode : SourceReplyDeliveryMode | undefined ;
67- senderIsOwner : boolean | undefined ;
68- } ) : CachedScopedTools {
52+ resolve ( params : McpLoopbackScopeParams ) : CachedScopedTools {
6953 const cacheKey = [
7054 params . sessionKey ,
7155 params . messageProvider ?? "" ,
@@ -83,18 +67,7 @@ export class McpLoopbackToolCache {
8367 return cached ;
8468 }
8569
86- const next = resolveMcpLoopbackScopedTools ( {
87- cfg : params . cfg ,
88- sessionKey : params . sessionKey ,
89- messageProvider : params . messageProvider ,
90- currentChannelId : params . currentChannelId ,
91- currentThreadTs : params . currentThreadTs ,
92- currentMessageId : params . currentMessageId ,
93- accountId : params . accountId ,
94- inboundEventKind : params . inboundEventKind ,
95- sourceReplyDeliveryMode : params . sourceReplyDeliveryMode ,
96- senderIsOwner : params . senderIsOwner ,
97- } ) ;
70+ const next = resolveMcpLoopbackScopedTools ( params ) ;
9871 const nextEntry : CachedScopedTools = {
9972 agentId : next . agentId ,
10073 tools : next . tools ,
0 commit comments