AuditMcpExtensions Class
Assembly: CodeEffects.Rule.Mcp.dll
Namespace: CodeEffects.Rule.Mcp
Summary
Adds the tools of the Audit library to the MCP server. It holds the extension method WithAudit(..).
Syntax
public static class AuditMcpExtensions
Call WithAudit(..) on the CodeEffectsMcpBuilder that AddCodeEffectsMcp(..) returned. With it, AI clients can find, read and summarize the evaluations that the Audit library recorded: each time your application ran a rule.
You can add the Audit library alone, the Repository alone, or both. With Audit alone, the evaluation tools read the recorded evaluations directly, and the server runs without the Rule Repository. With both, the tools of the same names that the Repository serves take their place, and the Repository adds evaluation_explain.
A caller sees the evaluation tools only when their permission set allows viewing evaluations: with ActionPermissionMode.AllowAllExcept when ActionPermissionType.EvaluationView is not in Actions, with ActionPermissionMode.AllowOnly when it is, and never with ActionPermissionMode.ViewOnly.
Methods
WithAudit(..)
Returns: CodeEffects.Rule.Mcp.CodeEffectsMcpBuilder - The same builder, so calls can be chained.
public static CodeEffectsMcpBuilder WithAudit(this CodeEffectsMcpBuilder builder, Action<AuditMcpOptions> configure)
An extension method of CodeEffectsMcpBuilder. Adds the evaluation tools of the Audit library, evaluation_find, evaluation_get and evaluation_summarize, together with evaluation_analyze, which totals evaluations by rule, result, period or the analytics values your application recorded. The configure delegate is called at once with a new AuditMcpOptions, and its values are read when the method runs.
Parameters
Exceptions
System.ArgumentNullException - builder or configure is null.
System.ArgumentException - DbProvider is not set.
System.InvalidOperationException - The Audit library was already added to the server.
Example
using CodeEffects.Rule.Mcp;
// Audit alone: the server offers the evaluation tools and nothing of the Rule Repository
builder.Services
.AddCodeEffectsMcp(o => o.MapCaller = mapCaller)
.WithAudit(a => a.DbProvider = dbProvider);