MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _get_agent_definitions

Function _get_agent_definitions

src/tool_system/tools/agent.py:135–152  ·  view source on GitHub ↗

Resolve agents visible to this call. SDK / test callers can pre-populate ``options.agent_definitions ["active_agents"]`` to override discovery. Otherwise we walk the managed / user / project ``agents`` directories via ``get_agent_definitions_with_overrides`` and appl

(context: ToolContext)

Source from the content-addressed store, hash-verified

133 discovered agent unfiltered.
134 """
135 def _get_agent_definitions(context: ToolContext) -> list[AgentDefinition]:
136 """Resolve agents visible to this call.
137
138 SDK / test callers can pre-populate ``options.agent_definitions
139 ["active_agents"]`` to override discovery. Otherwise we walk the
140 managed / user / project ``agents`` directories via
141 ``get_agent_definitions_with_overrides`` and apply the MCP filter
142 keyed on the context's available MCP server inventory.
143 """
144 agent_defs = getattr(context.options, "agent_definitions", None)
145 if agent_defs and isinstance(agent_defs, dict):
146 active = agent_defs.get("active_agents")
147 if active and isinstance(active, list):
148 return active
149 cwd = str(context.cwd or context.workspace_root)
150 agents = get_agent_definitions_with_overrides(cwd)
151 available_mcp = list(context.mcp_clients.keys()) if context.mcp_clients else []
152 return filter_agents_by_mcp_requirements(agents, available_mcp)
153
154 def _agent_call(tool_input: dict[str, Any], context: ToolContext) -> ToolResult:
155 prompt = tool_input.get("prompt", "")

Callers 1

_agent_callFunction · 0.85

Calls 3

getMethod · 0.45

Tested by

no test coverage detected