Guardian Engine

Deterministic recipe verification engine — validates AI-generated recipes against master SOPs.

我該用這個嗎

品質與安全性

A
說明品質
100%
結構描述完整度
87%
命名品質
97%
汙染風險
100%
權限相符程度
100%
協定合規性
100%

根據工具定義與協定合規性的自動化分析。

上下文成本

~3,302Token(工具定義)
~3.7 KB典型回應大小
顯著的注意力影響(128k 上下文的 2.58%)

這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。

安裝

一鍵安裝

將以下內容加入你的 `claude_desktop_config.json` 檔案:

{
  "mcpServers": {
    "guardian-engine": {
      "url": "https://api.kaimeilabs.dev/mcp"
    }
  }
}

遠端端點

https://api.kaimeilabs.dev/mcpstreamable-http

它能做什麼

工具清單

工具(7)

🟢 唯讀🟡 寫入🔴 刪除⚪ 未知
🟢verify_recipe(dish_name, candidate_json, original_prompt, response_format, session_id, ...)

Verify a candidate recipe against a Guardian master recipe. Uses deterministic graph-based verification to check technique, temperature, timing, cooking medium, and required ingredients. **Verdict**: `verdict` is strictly PASSED or FAILED and is policy-driven — any CRITICAL finding fails the recipe; more than 5 WARNINGs also fail. There is no score in the response (ADR-013): gate on `verdict` and explain failures from `findings`. **Field audience**: `issue` is a machine-readable code for programmatic handling — never show it to end users. Use `title` and `suggested_correction` as the user-facing fields. Returns structured JSON by default (machine-actionable findings and patches); response_format="text" renders a human-readable report. Both formats are transparent (ADR-009 / ADR-018): exact values and ingredient names included.

輸入結構描述

{
  "type": "object",
  "properties": {
    "dish_name": {
      "default": "",
      "description": "Name of the dish to verify against (e.g. 'carbonara', 'rendang', 'roast-chicken', 'confit', 'cheesecake', 'kung-pao', 'fried-chicken', 'brisket', 'wellington', 'cheese-souffle'). Use list_dishes() to see all available recipes and their aliases.",
      "type": "string"
    },
    "candidate_json": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ],
      "default": "",
      "description": "The full candidate recipe as a JSON string or object. Expected schema: {\"title\": \"<string>\", \"cuisine\": \"<string>\", \"serves\": <int>, \"ingredients\": [{\"name\": \"<string>\", \"quantity\": \"<string>\"}], \"steps\": [{\"step_number\": <int>, \"title\": \"<string>\", \"instruction_english\": \"<string>\", \"technique\": \"<string>\", \"estimated_temperature_c\": <number or [min, max]>, \"duration_minutes\": <number or [min, max]>, \"cooking_medium\": \"<string>\"}]}"
    },
    "original_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "RECOMMENDED for best results. Include the user's original cooking request. Copy the user's exact message that triggered this recipe (e.g., 'Make me a spicy vegan rendang' or 'Generate a traditional carbonara, but healthier'). WITHOUT this parameter: Guardian returns actionable findings with specific ingredient names and technique details — enough to fix most recipes. WITH this parameter: Guardian additionally activates safety context awareness (e.g., flagging honey for infants, raw egg for pregnant users) and personalised feedback matched to dietary needs and flavour preferences. Include it when the user's context matters for safety or personalisation."
    },
    "response_format": {
      "default": "json",
      "description": "Response format: 'json' (default — machine-actionable verdict, findings, and patches) or 'text' (human-readable report).",
      "type": "string"
    },
    "session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional session ID to track an agent's improvement loop across multiple attempts."
    },
    "dish": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Alias for dish_name — for backward compatibility with production clients."
    },
    "operator_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional audit identifier for the calling operator (letters, digits, hyphens; max 64 chars). Tags the verification in the tamper-evident log and compliance record. Defaults to 'anonymous'."
    },
    "master_json": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional user-supplied master SOP to verify against (BYO master, ADR-018), as a JSON string or object using the same schema as catalog masters (dish_name, steps[], required_ingredients[]; see get_master() for a live example). When provided, the bundled catalog is bypassed — the candidate is checked against YOUR spec — and dish_name may be omitted. The response pins the spec via master_hash (sha256) and master_source='user' so the verdict is replayable."
    }
  },
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "properties": {
    "result": {
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "x-fastmcp-wrap-result": true
}
⚪fix_recipe(dish_name, candidate_json, original_prompt, response_format, dish, ...)

Deterministically repair a candidate recipe against a Guardian master. Verifies the candidate, applies every machine-actionable correction the symbolic engine produced (missing ingredients, quantities, temperatures, durations, cooking media, ingredient substitutions), then re-verifies the result. No LLM is used — the repair is a deterministic function of the candidate recipe and the master ruleset. Findings that need recipe-authoring judgement — adding a whole cooking phase, rewriting step instructions, ingredient-ratio rebalancing — are not auto-applied; they are returned under `patches_skipped`. Allergen findings are never auto-fixed. The response reports the verdict before and after so the caller can see exactly what was resolved. Note: `verdict_after` may still be FAILED when structural changes (e.g. adding a cooking step, rebalancing ingredient ratios) are needed. These require recipe-authoring judgement and are returned under `patches_skipped`. Callers should NOT assume a fixed recipe will pass verification.

輸入結構描述

{
  "type": "object",
  "properties": {
    "dish_name": {
      "default": "",
      "description": "Name of the dish to repair against (e.g. 'carbonara', 'rendang', 'roast-chicken'). Use list_dishes() to see all available recipes and their aliases.",
      "type": "string"
    },
    "candidate_json": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ],
      "default": "",
      "description": "The full candidate recipe as a JSON string or object — same schema as verify_recipe's candidate_json (title, cuisine, ingredients[], steps[])."
    },
    "original_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional. The user's original cooking request, used only for safety-context awareness during verification. Does not change which fixes are applied."
    },
    "response_format": {
      "default": "json",
      "description": "Response format: 'json' (default — includes the full fixed_recipe object) or 'text' (human-readable report).",
      "type": "string"
    },
    "dish": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Alias for dish_name — for backward compatibility with production clients."
    },
    "master_json": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional user-supplied master SOP to repair against (BYO master, ADR-018), same schema as catalog masters. When provided, the catalog is bypassed and dish_name may be omitted; patches (including suggested_step templates) are built from THIS spec."
    }
  },
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "properties": {
    "result": {
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "x-fastmcp-wrap-result": true
}
🟢list_dishes(cuisine_filter)

List all available master dishes with rich metadata. This is a browse/discovery step, not the verification itself — after picking a dish, call verify_recipe(dish_name=<slug>, candidate_json=<your recipe>) to actually check a candidate against it (or fix_recipe to auto-repair it). Returns: Dictionary with `schema_version`, a `dishes` list (slug, title, cuisine, region, aliases, complexity per dish), and a `next_step` hint describing how to proceed to verification.

輸入結構描述

{
  "type": "object",
  "properties": {
    "cuisine_filter": {
      "default": "",
      "description": "Optional cuisine to filter by. Case-insensitive exact match against the dish's cuisine field. Valid values: italian | french | spanish | british | thai | chinese | indian | indonesian | japanese | malaysian | korean | mexican | american | moroccan | turkish | levantine. Leave empty to return all available dishes.",
      "type": "string"
    }
  },
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "additionalProperties": true
}
🟢get_master(dish_name, response_format)

Return the canonical master recipe for a dish (read-only, no LLM). Enables compare-then-verify agentic loops: fetch the master, diff it against the user's recipe, then call verify_recipe — instead of verifying blind. Pure knowledge-base lookup, no LLM in the hot path. Master content is transparent by default (ADR-009 / ADR-010): exact temperatures, timings, and EU FIC 1169/2011 allergen codes are returned verbatim, never obfuscated. No score is included (ADR-013) — this is reference data, not a verdict. Returns ingredients, steps (technique/temperature/timing/medium), and the EU FIC allergens derived from the required ingredients. Unknown dishes return a structured UNKNOWN_DISH error.

輸入結構描述

{
  "type": "object",
  "properties": {
    "dish_name": {
      "default": "",
      "description": "Name or alias of the dish to fetch the canonical master recipe for (e.g. 'carbonara', 'spaghetti bolognese', 'angel food cake'). Alias resolution and slug normalisation are applied. Use list_dishes() to browse.",
      "type": "string"
    },
    "response_format": {
      "default": "json",
      "description": "Response format: 'json' (default, structured) or 'text' (human-readable summary).",
      "type": "string"
    }
  },
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "properties": {
    "result": {
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "x-fastmcp-wrap-result": true
}
🟢check_safety(candidate_json)

Run master-independent safety checks on a candidate recipe. Works for ANY recipe — no dish resolution, no master SOP required. Checks poultry internal-temperature safety and scans all ingredients for the 14 EU FIC 1169/2011 Annex II allergen groups. The verdict is a deterministic function of (candidate, kb_version_hash) — no LLM involvement. Use this when verify_recipe has no matching master for the dish: the safety layer still applies to every recipe. Returns: Safety envelope: verdict (PASSED/FAILED per the zero-critical policy gate), safe flag, issues found, and the pinned kb_version_hash.

輸入結構描述

{
  "type": "object",
  "properties": {
    "candidate_json": {
      "description": "The full candidate recipe as a JSON string. Checked for poultry internal temperature safety (≥74°C) and EU FIC 1169 allergen presence.",
      "type": "string"
    }
  },
  "required": [
    "candidate_json"
  ],
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "additionalProperties": true
}
🟢check_allergens(ingredients, restrictions, dish_name, check_all_eu_allergens, response_format, ...)

Check ingredients for EU FIC 1169/2011 allergen compliance. Returns a detailed audit trace mapping each ingredient to its EU Annex II allergen group with entry numbers and labels. The safety verdict is deterministic — no LLM involvement in the decision — and is pinned by the returned ``kb_version_hash``. Use check_all_eu_allergens=True for food labelling (detect all allergens). Use restrictions=['dairy', 'gluten'] to check for specific user allergies. Supplying neither runs the full 14-group Annex II scan and sets ``defaulted_to_full_scan`` — the tool never reports "safe" without checking. ``is_safe`` answers "was a supplied restriction violated?"; ``declared_allergens`` answers "what is actually present?". Read both.

輸入結構描述

{
  "type": "object",
  "properties": {
    "ingredients": {
      "description": "List of ingredient names (freeform or canonical IDs). Examples: ['butter', 'wheat_flour', 'eggs', 'peanut_butter']",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "restrictions": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Allergen group IDs to check against user restrictions. Valid IDs: gluten, crustaceans, eggs, fish, peanuts, soy, dairy, tree_nuts, celery, mustard, sesame, sulphites, lupin, molluscs. If None and check_all_eu_allergens=True, reports all detected allergens."
    },
    "dish_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional dish name for reporting context."
    },
    "check_all_eu_allergens": {
      "default": false,
      "description": "If True, scans for all 14 EU Annex II allergens regardless of restrictions list. Use this for food labelling (declare all allergens present).",
      "type": "boolean"
    },
    "response_format": {
      "default": "json",
      "description": "Response format: 'json' (default) for the machine-actionable payload, or 'text' for a human-readable report.",
      "type": "string"
    },
    "session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional session identifier so repeated checks are stitched into one trajectory."
    },
    "operator_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional audit identifier for the calling operator (letters, digits, hyphens; max 64 chars). Tags the check in the telemetry log. Defaults to 'anonymous'."
    }
  },
  "required": [
    "ingredients"
  ],
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "properties": {
    "result": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "string"
        }
      ]
    }
  },
  "required": [
    "result"
  ],
  "x-fastmcp-wrap-result": true
}
🟢verify_dietary_claim(candidate_json, claim, response_format)

Verify that a recipe satisfies a dietary claim (vegan, halal, gluten-free, ...). Reuses the existing allergen-detection logic plus a curated forbidden-ingredient map (apps/guardian/knowledge/dietary_claims.yaml). Returns a structured verdict with the specific offending ingredients and a short justification — never a vague paraphrase.

輸入結構描述

{
  "type": "object",
  "properties": {
    "candidate_json": {
      "default": "",
      "description": "Recipe JSON string (CandidateRecipe schema). Expected shape: {\"title\": \"...\", \"ingredients\": [{\"name\": \"...\"}, ...], \"steps\": [...]}. Only the ingredient list is required for dietary verification.",
      "type": "string"
    },
    "claim": {
      "default": "",
      "description": "Dietary claim to verify: vegan | vegetarian | gluten_free | dairy_free | nut_free | halal | kosher.",
      "type": "string"
    },
    "response_format": {
      "default": "text",
      "description": "Response format: 'text' (default, human-readable) or 'json' (machine-actionable).",
      "type": "string"
    }
  },
  "additionalProperties": false
}

輸出結構描述

{
  "type": "object",
  "properties": {
    "result": {
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "x-fastmcp-wrap-result": true
}

社群

為此伺服器評分

證據

近期觀測

已驗證未記錄版本7 個工具
已驗證未記錄版本7 個工具