use crate::mcp::registry::{ToolCost, ToolExposure, ToolSpec, ToolStability};
use crate::mcp::schemas::*;
use crate::tools::*;
pub const PATCH_TOOLS: &[ToolSpec] = &[
ToolSpec {
name: "patch_apply_check",
description: "Validate and simulate a unified diff against provided in-memory files/text without touching the filesystem. Reports parse status, application success, failed hunks with context, and optional result fingerprint.",
handler: patch_apply_check,
input_schema: patch_apply_check_input,
output_schema: patch_apply_check_output,
category: "patch",
tier: 2,
profiles: &["full", "codegg_preflight", "codegg_patch"],
tags: &["patch", "diff", "unified", "validation", "apply"],
exposure: ToolExposure::HarnessOnly,
harness_use: &["edit_preflight"],
aliases: &[],
cost: ToolCost::Moderate,
stability: ToolStability::Stable,
composite: false,
},
ToolSpec {
name: "patch_summary",
description: "Summarize a unified diff without applying it: file counts, hunks, additions, deletions, renames, and line ranges. Prefer over patch_contract_check for size/scope stats and over diff_risk_classify for review routing.",
handler: patch_summary,
input_schema: patch_summary_input,
output_schema: patch_summary_output,
category: "patch",
tier: 2,
profiles: &["full", "codegg_patch"],
tags: &["patch", "diff", "unified", "summary", "statistics"],
exposure: ToolExposure::Contextual,
harness_use: &["none"],
aliases: &[],
cost: ToolCost::Moderate,
stability: ToolStability::Stable,
composite: false,
},
ToolSpec {
name: "edit_preflight",
description: "Validate a proposed text edit in memory and return an ok_to_apply verdict with findings. Prefer over text_replace_check for multi-hunk or patch-shaped edits and over patch_summary when you need an apply decision rather than stats. Inspects only; never writes files.",
handler: edit_preflight,
input_schema: edit_preflight_input,
output_schema: edit_preflight_output,
category: "patch",
tier: 1,
profiles: &["full", "codegg_core", "codegg_core_min", "codegg_preflight", "codegg_patch"],
tags: &["patch", "edit", "preflight", "composite", "text"],
exposure: ToolExposure::Default,
harness_use: &["edit_preflight"],
aliases: &[],
cost: ToolCost::Heavy,
stability: ToolStability::Stable,
composite: true,
},
ToolSpec {
name: "patch_contract_check",
description: "Classify a unified diff by contract-relevant categories (lockfiles, manifests, scope escapes, large deletions, security paths) for automated routing. Prefer over patch_summary when you need a policy verdict rather than stats.",
handler: patch_contract_check,
input_schema: patch_contract_check_input,
output_schema: patch_contract_check_output,
category: "patch",
tier: 2,
profiles: &["full", "codegg_patch", "codegg_preflight", "codegg_repo_audit"],
tags: &["patch", "diff", "contract", "classify", "routing"],
exposure: ToolExposure::Contextual,
harness_use: &[],
aliases: &[],
cost: ToolCost::Moderate,
stability: ToolStability::Stable,
composite: false,
},
ToolSpec {
name: "diff_risk_classify",
description: "Classify unified diffs by review risk and routing category with focus items. Prefer over patch_summary for reviewer triage and over patch_contract_check for heuristic risk rather than contract policy.",
handler: diff_risk_classify,
input_schema: diff_risk_classify_input,
output_schema: diff_risk_classify_output,
category: "patch",
tier: 2,
profiles: &["full", "codegg_patch", "codegg_repo_audit"],
tags: &["patch", "diff", "risk", "classify", "review", "routing"],
exposure: ToolExposure::Contextual,
harness_use: &[],
aliases: &[],
cost: ToolCost::Moderate,
stability: ToolStability::Stable,
composite: false,
},
];