MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / get_tools

Method get_tools

aiscript-vm/src/ai/agent.rs:169–200  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

167 }
168
169 fn get_tools(&self) -> Vec<Tool> {
170 let mut tool_calls = Vec::new();
171 for (name, fn_def) in &self.tools {
172 let properties = fn_def
173 .params
174 .iter()
175 .map(|(name, ty)| {
176 (
177 name.to_owned(),
178 Box::new(JSONSchemaDefine {
179 schema_type: Some(JSONSchemaType::from(*ty)),
180 ..Default::default()
181 }),
182 )
183 })
184 .collect();
185 let tool_call = Tool {
186 r#type: ToolType::Function,
187 function: types::Function {
188 name: name.clone(),
189 description: Some(fn_def.doc.clone()),
190 parameters: FunctionParameters {
191 schema_type: JSONSchemaType::Object,
192 properties: Some(properties),
193 required: Some(fn_def.params.keys().cloned().collect()),
194 },
195 },
196 };
197 tool_calls.push(tool_call);
198 }
199 tool_calls
200 }
201
202 fn handle_tool_call(
203 &self,

Callers 1

_run_agentFunction · 0.80

Calls 2

pushMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected