toolSurfaceFor method

List<AgentTool> toolSurfaceFor(
  1. TaskAgentDefinition agent,
  2. List<AgentTool> pool
)

Computes agent's child tool surface from the parent pool (omp's child-tool wiring, reduced): the task tool is ALWAYS stripped (no nested task calls), then TaskAgentDefinition.toolNames and TaskAgentDefinition.readOnly filters apply. Pool order is preserved.

Implementation

List<AgentTool> toolSurfaceFor(
  TaskAgentDefinition agent,
  List<AgentTool> pool,
) {
  return [
    for (final tool in pool)
      if (tool.name != taskToolName &&
          (agent.toolNames == null || agent.toolNames!.contains(tool.name)) &&
          (!agent.readOnly || tool.tier == ApprovalTier.read))
        tool,
  ];
}