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

Function createToolUseContext

src/tools/TaskToolBackgroundRuntime.test.ts:15–55  ·  view source on GitHub ↗
(
  tools: Array<{ name: string; userFacingName: () => string }>,
  tasks: Record<string, LocalShellTaskState>,
)

Source from the content-addressed store, hash-verified

13import type { LocalShellTaskState } from '../tasks/LocalShellTask/guards.js'
14
15function createToolUseContext(
16 tools: Array<{ name: string; userFacingName: () => string }>,
17 tasks: Record<string, LocalShellTaskState>,
18) {
19 let appState = {
20 ...getDefaultAppState(),
21 tasks,
22 }
23
24 const setAppState = (updater: (prev: typeof appState) => typeof appState) => {
25 appState = updater(appState)
26 }
27
28 return {
29 options: {
30 commands: [],
31 debug: false,
32 mainLoopModel: '/data/models/hf/moonshotai__Kimi-K2.7-Code',
33 tools: tools as never,
34 verbose: false,
35 thinkingConfig: {} as never,
36 mcpClients: [],
37 mcpResources: {},
38 isNonInteractiveSession: true,
39 agentDefinitions: {
40 activeAgents: [],
41 allAgents: [],
42 },
43 },
44 abortController: new AbortController(),
45 readFileState: {} as never,
46 getAppState: () => appState,
47 setAppState,
48 setAppStateForTasks: setAppState,
49 setInProgressToolUseIDs: () => {},
50 setResponseLength: () => {},
51 updateFileHistoryState: () => {},
52 updateAttributionState: () => {},
53 messages: [],
54 } as never
55}
56
57async function allowWithOriginalInput<T>(_tool: unknown, input: T) {
58 return {

Calls 1

getDefaultAppStateFunction · 0.85

Tested by

no test coverage detected