MCPcopy Create free account
hub / github.com/Noumena-Network/code / getOrCreatePythonReplManager

Function getOrCreatePythonReplManager

src/tools/REPLTool/pyReplFactory.tsx:524–543  ·  view source on GitHub ↗
(
  toolUseContext: ToolUseContext,
  toolName: string,
)

Source from the content-addressed store, hash-verified

522}
523
524function getOrCreatePythonReplManager(
525 toolUseContext: ToolUseContext,
526 toolName: string,
527): PythonReplManager {
528 const existing = toolUseContext.getAppState().pythonReplContexts?.get(toolName)
529 if (existing) {
530 return existing
531 }
532
533 const created = new PythonReplManager()
534 toolUseContext.setAppState(prev => {
535 const contexts = new Map(prev.pythonReplContexts ?? [])
536 contexts.set(toolName, created)
537 return {
538 ...prev,
539 pythonReplContexts: contexts,
540 }
541 })
542 return created
543}
544
545export async function clearPythonReplContext(
546 toolUseContext: ToolUseContext,

Callers 1

callFunction · 0.85

Calls 2

setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected