Reports Module
The reports module generates evaluation reports in various formats.
JSON Reports
- toolscore.reports.generate_json_report(result, output_path='toolscore.json')[source]
Generate JSON report from evaluation result.
- Parameters:
result (
EvaluationResult) – Evaluation result to report.
- Return type:
- Returns:
Path to the generated report file.
HTML Reports
- toolscore.reports.generate_html_report(result, output_path='toolscore.html')[source]
Generate HTML report from evaluation result.
- Parameters:
result (
EvaluationResult) – Evaluation result to report.
- Return type:
- Returns:
Path to the generated report file.
Markdown and CSV Reports
- toolscore.reports.generate_markdown_report(result, output_path='toolscore.md')[source]
Generate Markdown report from evaluation result.
Creates a Markdown file perfect for embedding in GitHub issues, PRs, wikis, or documentation. Includes formatted tables and emoji indicators.
- Parameters:
result (
EvaluationResult) – Evaluation result to report.output_path (
str|Path) – Path to save the Markdown report.
- Return type:
- Returns:
Path to the generated report file.
- toolscore.reports.generate_csv_report(result, output_path='toolscore.csv')[source]
Generate CSV report from evaluation result.
Creates a CSV file with metrics that can be opened in Excel or Google Sheets. Perfect for sharing results with non-technical stakeholders.
- Parameters:
result (
EvaluationResult) – Evaluation result to report.
- Return type:
- Returns:
Path to the generated report file.
Behavior and Safety Findings
- toolscore.reports.findings.behavior_findings(result)[source]
Collect behavior and safety findings from an evaluation result.
- Parameters:
result (
EvaluationResult) – The evaluation result.- Return type:
- Returns:
(severity, message)pairs,"error"first (forbidden calls, credentials, false success claims, escape hatches), then"warning"(failed calls, blind retries, undisclosed warnings). Call numbers are 1-based positions in the actual trace.
SARIF and JUnit
SARIF 2.1.0 and JUnit XML for the commands that produce findings.
One model, two formats. Each command turns what it found into a list of
Outcome objects (one per check: a scenario, a lint issue, a probe, a
pin difference, an honesty rule…) with a tri-state status, and
write_ci_reports() writes them as:
SARIF 2.1.0 (
--sarif PATH), for GitHub code scanning and other SARIF viewers. A failed check is a result withkind: "fail"and the level of its severity (error,warningornote); a check that could not be decided iskind: "open"withlevel: "none"(SARIF’s “not enough information”), never a pass; passing checks are left out.JUnit XML (
--junit PATH), for GitLab, Jenkins, Azure DevOps and any test-report viewer. Every check is a test case: a failed error-severity check is a<failure>, an unknown one is<skipped>, and a passing one is a plain test case. JUnit has no warning state, so a warning or note is a passing test case whose<system-out>sayswarning: ....
Code scanning shows a SARIF result only when it has a location. Results point
at the file the check is about (a config or instruction file with its line,
the lock file, the trace) or, for a server, at the file passed with
--report-location, the --config file, or the server script in the
command; see default_location().
- toolscore.reports.ci.STATUSES = ('fail', 'warn', 'note', 'unknown', 'pass')
Outcome statuses, worst first.
- class toolscore.reports.ci.Outcome(check, status, message, subject='', location=None, line=None, fix='')[source]
One check and what came of it.
- Variables:
check (
str) – A stable name for the check (the rule ID for a finding).status (
str) –"fail"(error severity),"warn","note","unknown"(could not be decided) or"pass".message (
str) – What was found, or what passed.subject (
str) – What the check is about (a tool, a call), for grouping.location (
str|None) – A file path the check is about, orNone.fix (
str) – How to fix a failure (the SARIF rule help).
- Parameters:
- toolscore.reports.ci.rule_description(rule)[source]
The one-line meaning of a Toolscore rule ID, from the rule tables.
- toolscore.reports.ci.default_location(explicit, config=None, command=(), pin=None)[source]
The file SARIF results about a server point to.
The first that applies:
--report-location, the--configfile, a file under the working directory named in the server command (python server.pygivesserver.py), the lock file.Nonewhen there is none (a remote URL with no config file): code scanning then does not display the results.
- toolscore.reports.ci.to_junit(outcomes, suite)[source]
A JUnit XML document with one test suite and one test case per check.
- toolscore.reports.ci.write_ci_reports(outcomes, command, sarif=None, junit=None)[source]
Write the SARIF and/or JUnit files a command was asked for.
- Parameters:
- Return type:
- Returns:
(format, path)for each file written ("SARIF","JUnit").
- toolscore.reports.ci.outcomes_from_lint(issues, tools, location)[source]
Lint issues, plus one passing check per tool without any.
- toolscore.reports.ci.outcomes_from_scorecard(card, location)[source]
Scenarios, lint issues, scenario findings and effect probes of a scorecard.
- Return type:
- Parameters:
card (MCPScorecard)
location (str | None)
- toolscore.reports.ci.outcomes_from_pin(report, location)[source]
Pin differences: the ones that fail under
--fail-onare errors, the rest notes.
- toolscore.reports.ci.outcomes_from_diff(diff, fail_on, location)[source]
Breaking changes, other differences and new lint issues between two servers.
- Return type:
- Parameters:
diff (ServerDiff)
fail_on (str)
location (str | None)
- toolscore.reports.ci.outcomes_from_config_lint(report)[source]
Config-lint issues with their file and line; skipped rules are unknown.
- Return type:
- Parameters:
report (ConfigLintReport)
- toolscore.reports.ci.outcomes_from_honesty(report, location)[source]
Honesty findings, and for each rule that did not fire: pass, or unknown without evidence.
- toolscore.reports.ci.outcomes_from_evaluation(result, location)[source]
The tri-state evidence checks of an evaluation (
toolscore eval).- Return type:
- Parameters:
result (EvaluationResult)
location (str | None)