Summary
Use MCP sampling (sampling/createMessage) to delegate log analysis to the agent's LLM — no API key or LLM connection needed on the server side.
Suggested by Tim Leavitt.
The idea
debug_get_error_logs currently returns raw log entries. The agent has to read them and figure out what's wrong. With sampling, the MCP server can send the logs to the client's LLM and get back a structured diagnosis — root cause, affected class, suggested fix — as part of the tool response.
Progressive disclosure: the tool returns a summary first (3 errors, all in MyApp.Service, last 5 min), then the agent can call again with detail=true to trigger a sampling request that returns the full diagnosis. Avoids spending tokens on detailed analysis when the agent just needs a quick status check.
Proposed tools
iris_analyze_logs
Fetches error log entries, then uses sampling/createMessage to request diagnosis from the client LLM.
iris_analyze_logs(
namespace: "USER",
limit: 50, // entries to analyze
detail: bool, // false = summary only, true = sampling analysis
focus: Option<String> // optional class/package to focus on
)
Returns:
detail: false → summary: count, top error types, most-affected classes (no sampling call)
detail: true → sampling: root cause analysis, correlation, suggested fix
Sampling prompt design
System: "You are an IRIS ObjectScript error analyst. Given the following error log entries, identify: (1) root cause, (2) affected component, (3) whether errors are correlated or independent, (4) suggested fix. Be concise."
User: the raw log JSON
Implementation notes
- Check
peer_info.capabilities.sampling.is_some() before attempting — if client doesn't support sampling, fall back to returning raw entries
rmcp 1.2 has CreateMessageRequestParams with messages: Vec\<SamplingMessage> and max_tokens: u32
- The server calls
context.peer().create_message(params).await to invoke sampling
- Keep
debug_get_error_logs as-is for backward compat — iris_analyze_logs is a new tool
Why this matters
- No LLM credentials needed on the iris-dev server — reuses whatever model the agent is already connected to
- Works with Copilot, Claude Code, Cursor — any MCP client that supports sampling
- Turns a raw data dump into an actionable diagnosis
- Progressive disclosure keeps it efficient — summary is cheap, analysis is on-demand
Summary
Use MCP sampling (
sampling/createMessage) to delegate log analysis to the agent's LLM — no API key or LLM connection needed on the server side.Suggested by Tim Leavitt.
The idea
debug_get_error_logscurrently returns raw log entries. The agent has to read them and figure out what's wrong. With sampling, the MCP server can send the logs to the client's LLM and get back a structured diagnosis — root cause, affected class, suggested fix — as part of the tool response.Progressive disclosure: the tool returns a summary first (3 errors, all in
MyApp.Service, last 5 min), then the agent can call again withdetail=trueto trigger a sampling request that returns the full diagnosis. Avoids spending tokens on detailed analysis when the agent just needs a quick status check.Proposed tools
iris_analyze_logsFetches error log entries, then uses
sampling/createMessageto request diagnosis from the client LLM.Returns:
detail: false→ summary: count, top error types, most-affected classes (no sampling call)detail: true→ sampling: root cause analysis, correlation, suggested fixSampling prompt design
System: "You are an IRIS ObjectScript error analyst. Given the following error log entries, identify: (1) root cause, (2) affected component, (3) whether errors are correlated or independent, (4) suggested fix. Be concise."
User: the raw log JSON
Implementation notes
peer_info.capabilities.sampling.is_some()before attempting — if client doesn't support sampling, fall back to returning raw entriesrmcp 1.2hasCreateMessageRequestParamswithmessages: Vec\<SamplingMessage>andmax_tokens: u32context.peer().create_message(params).awaitto invoke samplingdebug_get_error_logsas-is for backward compat —iris_analyze_logsis a new toolWhy this matters