MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / mcp_resource_reminder

Method mcp_resource_reminder

crates/opencode-session/src/system.rs:28–40  ·  view source on GitHub ↗

Build a system-reminder block for MCP resource text content.

(filename: &str, uri: &str, content: &str)

Source from the content-addressed store, hash-verified

26
27 /// Build a system-reminder block for MCP resource text content.
28 pub fn mcp_resource_reminder(filename: &str, uri: &str, content: &str) -> String {
29 let (content, truncated) = trim_for_prompt(content, MAX_MCP_RESOURCE_CHARS);
30 let truncation_hint = if truncated {
31 "\n\n[Content truncated for prompt safety.]"
32 } else {
33 ""
34 };
35 let body = format!(
36 "MCP resource context from {} ({}):\n{}{}",
37 filename, uri, content, truncation_hint
38 );
39 Self::system_reminder(&body)
40 }
41
42 /// Select the appropriate system prompt based on model API ID.
43 /// TS: `SystemPrompt.provider(model)` in session/system.ts

Callers

nothing calls this directly

Calls 1

trim_for_promptFunction · 0.85

Tested by

no test coverage detected