MCPcopy Create free account
hub / github.com/AI45Lab/Code / to_xml

Method to_xml

core/src/context/mod.rs:286–301  ·  view source on GitHub ↗

Format as XML tag for system prompt injection

(&self)

Source from the content-addressed store, hash-verified

284
285 /// Format as XML tag for system prompt injection
286 pub fn to_xml(&self) -> String {
287 let source_attr = self
288 .source
289 .as_ref()
290 .map(|s| format!(" source=\"{}\"", s))
291 .unwrap_or_default();
292 let type_str = match self.context_type {
293 ContextType::Memory => "Memory",
294 ContextType::Resource => "Resource",
295 ContextType::Skill => "Skill",
296 };
297 format!(
298 "<context{} type=\"{}\">\n{}\n</context>",
299 source_attr, type_str, self.content
300 )
301 }
302}
303
304fn metadata_score(value: Option<&serde_json::Value>) -> f32 {

Calls

no outgoing calls