MCPcopy Index your code
hub / github.com/AI45Lab/Code / parse_tool_arguments

Method parse_tool_arguments

core/src/llm/openai.rs:33–51  ·  view source on GitHub ↗
(tool_name: &str, arguments: &str)

Source from the content-addressed store, hash-verified

31
32impl OpenAiClient {
33 pub(crate) fn parse_tool_arguments(tool_name: &str, arguments: &str) -> serde_json::Value {
34 if arguments.trim().is_empty() {
35 return serde_json::Value::Object(Default::default());
36 }
37
38 serde_json::from_str(arguments).unwrap_or_else(|e| {
39 tracing::warn!(
40 "Failed to parse tool arguments JSON for tool '{}': {}",
41 tool_name,
42 e
43 );
44 serde_json::json!({
45 "__parse_error": format!(
46 "Malformed tool arguments: {}. Raw input: {}",
47 e, arguments
48 )
49 })
50 })
51 }
52
53 fn merge_stream_text(text_content: &mut String, incoming: &str) -> Option<String> {
54 if incoming.is_empty() {

Callers

nothing calls this directly

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected