MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / format_tool_spec

Function format_tool_spec

crates/chat-cli/src/cli/chat/conversation.rs:965–979  ·  view source on GitHub ↗
(tool_spec: HashMap<String, ToolSpec>)

Source from the content-addressed store, hash-verified

963}
964
965pub fn format_tool_spec(tool_spec: HashMap<String, ToolSpec>) -> HashMap<ToolOrigin, Vec<Tool>> {
966 tool_spec
967 .into_values()
968 .fold(HashMap::<ToolOrigin, Vec<Tool>>::new(), |mut acc, v| {
969 let tool = Tool::ToolSpecification(ToolSpecification {
970 name: v.name,
971 description: v.description,
972 input_schema: v.input_schema.into(),
973 });
974 acc.entry(v.tool_origin)
975 .and_modify(|tools| tools.push(tool.clone()))
976 .or_insert(vec![tool]);
977 acc
978 })
979}
980
981/// Represents a conversation state that can be converted into a [FigConversationState] (the type
982/// used by the API client). Represents borrowed data, and reflects an exact [FigConversationState]

Callers 2

newMethod · 0.85
reload_builtin_toolsMethod · 0.85

Calls 2

ToolSpecificationClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected