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

Function normalize_task_options

sdk/python/src/lib.rs:6257–6275  ·  view source on GitHub ↗
(mut value: serde_json::Value)

Source from the content-addressed store, hash-verified

6255}
6256
6257fn normalize_task_options(mut value: serde_json::Value) -> PyResult<serde_json::Value> {
6258 let obj = value
6259 .as_object_mut()
6260 .ok_or_else(|| PyValueError::new_err("task options must be a dict"))?;
6261
6262 for field in ["agent", "description", "prompt"] {
6263 if !obj.get(field).is_some_and(|v| v.is_string()) {
6264 return Err(PyValueError::new_err(format!(
6265 "task options must include string field '{field}'"
6266 )));
6267 }
6268 }
6269
6270 if let Some(value) = obj.remove("maxSteps") {
6271 obj.entry("max_steps".to_string()).or_insert(value);
6272 }
6273
6274 Ok(value)
6275}
6276
6277fn normalize_git_args(mut args: serde_json::Value) -> PyResult<serde_json::Value> {
6278 let obj = args

Callers 1

taskMethod · 0.85

Calls 2

removeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected