intersystems-community / intersystems-community/iris-agentic-dev

feat: MCP sampling for log analysis with progressive disclosure

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
40
Forks
14
Avg merge
1d 23h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing debug_get_error_logs tool and the rmcp 1.2 sampling types, especially CreateMessageRequestParams and context.peer().create_message(params). Define how the new iris_analyze_logs tool handles summary versus detail, client capability checks, and raw-entry fallback. Done means progressive disclosure works, sampling produces the requested diagnosis, and debug_get_error_logs remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai, api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.