pub struct ScriptToolEntry {
pub name: String,
pub description: String,
pub parameters: BTreeMap<String, ParamSpec>,
pub run: Vec<String>,
pub timeout_ms: Option<u64>,
pub env: BTreeMap<String, String>,
pub cwd: Option<PathBuf>,
pub exposure: ExposureSpec,
}Expand description
A script tool entry (one row of tools.json / one row of the plugin manifest script form).
JSON form (the design’s “global script tool entry”):
{
"name": "deploy",
"description": "部署当前项目到 staging",
"parameters": { "env": { "type": "string", "description": "目标环境" } },
"run": ["/Users/me/proj/deploy.sh", "--env", "${env}"],
"timeout_secs": 120
}serde parsing enforces the path law and the name law (fail-closed: failing to parse a legal entry = parse failure).
Fields§
§name: StringName (script.{name} / the plugin’s tool segment). [a-z0-9_-]{1,32}, not a reserved word.
description: StringModel-visible description.
parameters: BTreeMap<String, ParamSpec>Parameter table (scalars only).
run: Vec<String>argv template: ${param} substitution per element, no shell. The path law has already been enforced.
timeout_ms: Option<u64>Hard timeout (milliseconds). None = DEFAULT_TIMEOUT_MS.
env: BTreeMap<String, String>Environment variable overrides (layered on top of the inherited process env).
cwd: Option<PathBuf>Working directory (the current project root; pinned at product-layer registration, the framework does not sniff paths). Not stored in tools.json (machine-specific path, injected at product-layer load time).
exposure: ExposureSpecTool-table budget tier, defaults to direct.
Implementations§
Source§impl ScriptToolEntry
impl ScriptToolEntry
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
run: Vec<String>,
) -> Result<Self, ScriptLawError>
pub fn new( name: impl Into<String>, description: impl Into<String>, run: Vec<String>, ) -> Result<Self, ScriptLawError>
Construct + enforce the laws (name law + path law). Manual construction also goes through here; never assemble the struct bare.
Sourcepub fn check_laws(&self) -> Result<(), ScriptLawError>
pub fn check_laws(&self) -> Result<(), ScriptLawError>
Name law + path law (called at definition/install time; at execution time only check whether the script file is still there).
Sourcepub fn timeout_ms(&self) -> u64
pub fn timeout_ms(&self) -> u64
Hard timeout (milliseconds): the entry’s value, defaulting to DEFAULT_TIMEOUT_MS.
Sourcepub fn parameters_envelope(&self) -> Value
pub fn parameters_envelope(&self) -> Value
LLM parameter envelope (MCP inputSchema form: object + properties + required=all).
Sourcepub fn identity(&self) -> ToolIdentity
pub fn identity(&self) -> ToolIdentity
Identity key (global-script form script.{name}). The plugin form is assembled by the plugin provider itself.
Trait Implementations§
Source§impl Clone for ScriptToolEntry
impl Clone for ScriptToolEntry
Source§impl Debug for ScriptToolEntry
impl Debug for ScriptToolEntry
Source§impl<'de> Deserialize<'de> for ScriptToolEntry
impl<'de> Deserialize<'de> for ScriptToolEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ScriptToolEntry
Source§impl PartialEq for ScriptToolEntry
impl PartialEq for ScriptToolEntry
Source§impl Serialize for ScriptToolEntry
impl Serialize for ScriptToolEntry
impl StructuralPartialEq for ScriptToolEntry
Auto Trait Implementations§
impl Forget for ScriptToolEntry
impl Freeze for ScriptToolEntry
impl RefUnwindSafe for ScriptToolEntry
impl Send for ScriptToolEntry
impl Sync for ScriptToolEntry
impl Unpin for ScriptToolEntry
impl UnsafeUnpin for ScriptToolEntry
impl UnwindSafe for ScriptToolEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.