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

Function createToolUseContext

src/tools/AgentToolRuntime.test.ts:576–648  ·  view source on GitHub ↗
({
  activeAgents = [],
  allAgents = activeAgents,
  allowedAgentTypes,
  permissionMode = 'default',
  denyRules,
  mcpTools = [],
  mcpClients = [],
  teamName,
}: {
  activeAgents?: MockAgentDefinition[]
  allAgents?: MockAgentDefinition[]
  allowedAgentTypes?: string[]
  permissionMode?: 'default' | 'plan' | 'auto'
  denyRules?: string[]
  mcpTools?: Array<{ name?: string }>
  mcpClients?: Array<{ name: string; type: string }>
  teamName?: string
} = {})

Source from the content-addressed store, hash-verified

574}
575
576function createToolUseContext({
577 activeAgents = [],
578 allAgents = activeAgents,
579 allowedAgentTypes,
580 permissionMode = 'default',
581 denyRules,
582 mcpTools = [],
583 mcpClients = [],
584 teamName,
585}: {
586 activeAgents?: MockAgentDefinition[]
587 allAgents?: MockAgentDefinition[]
588 allowedAgentTypes?: string[]
589 permissionMode?: 'default' | 'plan' | 'auto'
590 denyRules?: string[]
591 mcpTools?: Array<{ name?: string }>
592 mcpClients?: Array<{ name: string; type: string }>
593 teamName?: string
594} = {}) {
595 let appState = getDefaultAppState()
596 appState = {
597 ...appState,
598 mcp: {
599 ...appState.mcp,
600 tools: mcpTools as never,
601 clients: mcpClients as never,
602 },
603 teamContext: teamName ? ({ teamName } as never) : undefined,
604 toolPermissionContext: {
605 ...appState.toolPermissionContext,
606 mode: permissionMode,
607 alwaysDenyRules: denyRules
608 ? {
609 ...appState.toolPermissionContext.alwaysDenyRules,
610 localSettings: denyRules,
611 }
612 : appState.toolPermissionContext.alwaysDenyRules,
613 },
614 }
615
616 const setAppState = (updater: (prev: typeof appState) => typeof appState) => {
617 appState = updater(appState)
618 }
619
620 return {
621 options: {
622 commands: [],
623 debug: false,
624 mainLoopModel: '/data/models/hf/moonshotai__Kimi-K2.7-Code',
625 tools: [AgentTool] as never,
626 verbose: false,
627 thinkingConfig: {} as never,
628 mcpClients: [],
629 mcpResources: {},
630 isNonInteractiveSession: true,
631 agentDefinitions: {
632 activeAgents,
633 allAgents,

Callers 1

Calls 1

getDefaultAppStateFunction · 0.85

Tested by

no test coverage detected