MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / list_schemas

Method list_schemas

crates/opencode-tool/src/registry.rs:56–84  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

54 }
55
56 pub async fn list_schemas(&self) -> Vec<ToolSchema> {
57 let tools = self.tools.read().await;
58 let mut schemas: Vec<ToolSchema> = tools
59 .values()
60 .map(|t| ToolSchema {
61 name: t.id().to_string(),
62 description: t.description().to_string(),
63 parameters: t.parameters(),
64 })
65 .collect();
66
67 // Trigger tool.definition hook for each schema so plugins can transform them
68 for schema in &mut schemas {
69 let hook_outputs = opencode_plugin::trigger_collect(
70 HookContext::new(HookEvent::ToolDefinition)
71 .with_data("tool_id", serde_json::json!(&schema.name))
72 .with_data("description", serde_json::json!(&schema.description))
73 .with_data("parameters", schema.parameters.clone()),
74 )
75 .await;
76 for output in hook_outputs {
77 if let Some(payload) = output.payload.as_ref() {
78 apply_tool_definition_payload(schema, payload);
79 }
80 }
81 }
82
83 schemas
84 }
85
86 pub async fn execute(
87 &self,

Callers 2

execute_inlineMethod · 0.80
resolve_tools_with_mcpFunction · 0.80

Calls 9

trigger_collectFunction · 0.85
newFunction · 0.85
readMethod · 0.80
with_dataMethod · 0.80
idMethod · 0.45
descriptionMethod · 0.45
parametersMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected