pub struct ToolDefinition {Show 18 fields
pub tool_id: String,
pub name: String,
pub version: String,
pub tool_type: String,
pub endpoint: String,
pub description: String,
pub capabilities: Vec<String>,
pub category: String,
pub creator_did: Option<String>,
pub creator_wallet: Option<Address>,
pub price_per_call: u128,
pub status: ToolStatus,
pub created_at: u64,
pub invocation_count: u64,
pub last_seen_at: u64,
pub upstream_auth: Option<UpstreamAuth>,
pub spawn_spec: Option<StdioSpawnSpec>,
pub allowed_to_subjects: Option<Vec<String>>,
}Expand description
A tool (MCP server, API endpoint, or native capability) published to the Tenzro Network tools registry.
Tools are discovered by agents and invoked to take real-world actions: web search, code execution, file access, API calls, etc. Unlike skills (which encode reasoning/logic), tools are the actual external interfaces agents connect to.
Tool types:
"mcp"— MCP server atendpoint(JSON-RPC 2.0 Streamable HTTP)"api"— OpenAPI-compatible REST endpoint"native"— built-in node capability
Fields§
§tool_id: StringUnique tool identifier (UUID v4)
name: StringHuman-readable tool name (e.g., “web-search-mcp”, “code-executor”)
version: StringSemantic version string (e.g., “1.0.0”)
tool_type: StringTool type: “mcp”, “api”, or “native”
endpoint: StringMCP/API endpoint URL (required for mcp and api types)
description: StringDescription of what this tool does
capabilities: Vec<String>Capabilities provided by this tool (e.g., [“web-search”, “read-url”])
category: StringCategory for discovery (e.g., “search”, “code”, “data”, “automation”)
creator_did: Option<String>DID of the agent or human who registered this tool
creator_wallet: Option<Address>Payout wallet for the creator’s share of paid invocations.
Mandatory for any non-zero price_per_call; registration
fails (ToolError::MissingCreatorWallet) if omitted for a paid
tool. Free tools (price_per_call == 0) may leave this None.
price_per_call: u128Price per invocation in TNZO atto-tokens (1 TNZO = 10^18 atto).
Set to 0 for a free tool. The split is identical to the agent
template marketplace: MARKETPLACE_COMMISSION_BPS (5%) to the
treasury, remainder to creator_wallet.
status: ToolStatusCurrent status of the tool
created_at: u64Unix timestamp (seconds) when the tool was registered
invocation_count: u64Number of times this tool has been invoked
last_seen_at: u64Unix timestamp (seconds) of the last liveness signal. Liveness
sweeper flips status to Inactive once the tool stays silent past
the configured TTL. Charitable serde default keeps pre-upgrade rows
alive until they actually go silent.
upstream_auth: Option<UpstreamAuth>Upstream credential injection for this tool. When Some, the
operator’s sealed secret (looked up by sealed_secret_ref at
invocation time) is injected per the variant rules — into a
request header for Mcp / McpSse / Api, into an env var
for McpStdio. Tenants NEVER see the underlying secret.
Default None means no credentials are injected (public MCPs).
spawn_spec: Option<StdioSpawnSpec>Subprocess spawn specification for McpStdio transport.
Required when tool_type == "mcp-stdio". Ignored for other
transports.
allowed_to_subjects: Option<Vec<String>>Optional subject-level access list. When Some(vec), only
API-key subjects whose subject appears in vec are permitted
to invoke this tool. None (the default) means the tool is
open to any API key that is allowed by AgentDelegation.
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn new(
name: String,
version: String,
tool_type: String,
endpoint: String,
description: String,
category: String,
) -> Self
pub fn new( name: String, version: String, tool_type: String, endpoint: String, description: String, category: String, ) -> Self
Creates a new tool definition with default values
Sourcepub fn transport_mode(&self) -> Option<ToolTransportMode>
pub fn transport_mode(&self) -> Option<ToolTransportMode>
Returns the typed transport mode derived from the legacy
tool_type string. Returns None for unknown strings so the
caller can refuse to invoke an unknown transport safely.
Sourcepub fn set_transport_mode(&mut self, mode: ToolTransportMode)
pub fn set_transport_mode(&mut self, mode: ToolTransportMode)
Sets both the typed transport mode and the legacy tool_type
string field in lockstep. Use this from the registration RPC
when the caller passes a strongly-typed transport mode.
Sourcepub fn is_subject_allowed(&self, subject: Option<&str>) -> bool
pub fn is_subject_allowed(&self, subject: Option<&str>) -> bool
Returns true when subject is permitted to invoke this tool
per the optional subject-level access list. When the list is
None, the tool is open to any API key (subject-gating is
disabled). When Some(vec), only subjects in vec are allowed.
Sourcepub fn validate_for_registration(&self) -> Result<(), &'static str>
pub fn validate_for_registration(&self) -> Result<(), &'static str>
Validate registration invariants. Any paid tool must declare a
creator_wallet to receive the creator share of each invocation.
Free tools (price_per_call == 0) may omit creator_wallet.
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Returns true if the tool is available for invocation
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more