Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0sec labs 0 Tool Exposure

From Leeroopedia
Knowledge Sources
Domains MCP, Tool_Exposure, Agent_Tools
Last Updated 2026-10-30 00:00 GMT

Overview

Technique for resolving the set of available tools for a given agent role, gated by scope authorization and feature flags, and dispatching tool calls to core implementations via a ToolExecutor.

Description

Tool exposure is the principle that an agent's tool surface must be dynamically assembled based on its role, scope authorization, and feature flags. The getToolsForRole function assembles common tools (query_findings, update_todos, done), network tools (http_request, crawl, submit_form, bash), browser tools, scanner tools, binary tools, cloud tools, and OAST tools — each gated by its feature flag and scope authorization. The ToolExecutor class dispatches tool calls to core implementations. For MCP, Zod schemas are built per-tool from ToolDefinition.parameters so the MCP protocol validates arguments before dispatch.

Usage

Use this principle when designing an agent system where different roles get different tool surfaces. The gating ensures offensive tools require scope, browser tools require a browser, and scanner tools require explicit permission.

Theoretical Basis

The tool assembly:

# Abstract algorithm (NOT real implementation)
def getToolsForRole(role, opts):
    authorized = not enforcement_enabled or opts.has_scope
    tools = ["query_findings", "update_todos", "done"]  # common

    tools += ["http_request", "crawl", "submit_form", "bash"]  # network

    if opts.has_browser:
        tools += ["browser"]
    if feature_flags.web_search:
        tools += ["web_search"]
    if opts.allow_scanners:
        tools += SCANNER_TOOLS
    if authorized:
        tools += OFFENSIVE_TOOLS
    if featureFlags.zeroverse:
        tools += BINARY_TOOLS

    return [get_definition(name) for name in tools]

The feature flag + scope gating implements defense in depth: a tool requires BOTH its feature flag to be on AND (for offensive tools) scope authorization. Deny-by-default: each weaponization/engine category needs its named feature flag AND active scope.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment