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

Method PostToolUse

agent/loop.go:965–992  ·  view source on GitHub ↗
(tc coretools.ToolCall, state *AgentState)

Source from the content-addressed store, hash-verified

963 if tool := executor.Registry.Get(slot.TC.Name); tool != nil && tool.SupportsSiblingAbort() {
964 executor.AbortSiblings(tid)
965 }
966 } else {
967 e.PostToolUse(slot.TC, state)
968 delete(state.DeniedToolCalls, slot.TC.Name)
969 delete(state.ToolErrors, slot.TC.Name)
970 }
971 sendStream(ctx, out, NewStreamEvent("tool_result", "", map[string]any{
972 "tool_use_id": tid,
973 "tool_name": slot.TC.Name,
974 "result": TruncateResult(slot.Truncated, 500),
975 "is_error": slot.IsError,
976 }))
977 }
978 CommitToolResultsTurn(state, toolResults, executor)
979 e.recordFabricToolEvents(ctx, state, toolResults, executor)
980 e.injectMemoryRecallAfterTools(ctx, state, toolResults, executor)
981 if pending, ok := executor.Context["_pending_skill_messages"].([]map[string]any); ok && len(pending) > 0 {
982 state.Messages = append(state.Messages, pending...)
983 executor.Context["_pending_skill_messages"] = []map[string]any{}
984 }
985}
986
987func (e *CoreExecutionEngine) injectMemoryRecallAfterTools(ctx context.Context, state *AgentState,
988 toolResults []map[string]any, executor *StreamingToolExecutor) {
989 if e == nil || state == nil || !e.Config.LongTermMemoryEnabled || len(toolResults) == 0 {
990 return
991 }
992 query := toolMemoryRecallQuery(state.LastQuery, toolResults, executor)
993 if query == "" {
994 return
995 }

Calls 4

WriteMemoryIndexFunction · 0.92
resolveToolPathForHookFunction · 0.85
isPathInsideFunction · 0.85
stringFromAnyFunction · 0.70