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)
| 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", "") |
no test coverage detected