MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / maybePromptMCPTrust

Method maybePromptMCPTrust

agent/loop.go:217–267  ·  view source on GitHub ↗
(ctx context.Context, out chan<- StreamEvent)

Source from the content-addressed store, hash-verified

215 Description: "Forked skill runner for '" + skill.CanonicalName + "'.",
216 MaxTurns: 50,
217 PermissionMode: "inherit",
218 }
219 var state *AgentState
220 if typed, ok := parentState.(*AgentState); ok {
221 state = typed
222 }
223 modelOverride := ""
224 if skill.Frontmatter.Model != nil {
225 modelOverride = *skill.Frontmatter.Model
226 }
227 if extraContext == nil {
228 extraContext = coretools.ExecutionContext{}
229 }
230 if _, exists := extraContext["_memory_engine"]; !exists {
231 extraContext["_memory_engine"] = e.memoryEngineSnapshot()
232 }
233 extraContext["_skill_agent_scope"] = subagentScope
234 sub := NewSubAgent(e.Config, baseRegistry, definition, state, modelOverride, agentName, extraContext, thinkingBudgetTokens)
235 result, err := sub.Run(ctx, prompt)
236 return result, sub.TotalInputTokens, sub.TotalOutputTokens, err
237}
238
239func (e *CoreExecutionEngine) ensureMCPTools(execCtx coretools.ExecutionContext) {
240 e.mcpMu.Lock()
241 defer e.mcpMu.Unlock()
242 if e.mcpInitialized {
243 mergeExecutionContext(execCtx, e.mcpContext)
244 return
245 }
246 mcpCtx := coretools.ExecutionContext{}
247 if e.mcpContext != nil {
248 if approvals, ok := e.mcpContext["trusted_mcp_servers"]; ok {
249 mcpCtx["trusted_mcp_servers"] = approvals
250 }
251 }
252 _ = coretools.RegisterMCPTools(e.Registry, e.Config.CWD, mcpCtx)
253 e.mcpContext = mcpCtx
254 e.mcpInitialized = true
255 mergeExecutionContext(execCtx, e.mcpContext)
256}
257
258func (e *CoreExecutionEngine) maybePromptMCPTrust(ctx context.Context, out chan<- StreamEvent) {
259 e.mcpMu.Lock()
260 pending, _ := e.mcpContext["pending_mcp_trust"].([]map[string]any)
261 if len(pending) == 0 {
262 e.mcpMu.Unlock()
263 return
264 }
265 if e.Config.Yolo {
266 e.mcpMu.Unlock()
267 e.applyMCPTrustDecision(pending, true)
268 return
269 }
270 ch := make(chan bool, 1)

Callers 1

queryLoopMethod · 0.95

Calls 4

clearMCPTrustFutureMethod · 0.95
NewStreamEventFunction · 0.85
sendStreamFunction · 0.85
stringFromAnyFunction · 0.70

Tested by

no test coverage detected