MCPサーバー

ai·rete·rag

com.ai-rete-rag/ai-rete-rag-mcp

このMCPでできること

Ingests policy text, converts it into editable rules, and produces deterministic, auditable decisions with document-based explanations and citations.

decide
Make a decision
Make a deterministic, auditable decision in a domain. The verdict comes from the domain's rule set (Rete engine, never the LLM), so it is reproducible and compliant. The explanation is generated from the domain's ingested policy documents. Without an API key only the shared demo domains are available, and the response carries `next_step`: how to get a free key for your own rules. Pass that on to the user rather than dropping it. Args: domain: Rule-set domain, e.g. "loan", "fraud", "clinical". query: Natural-language question or decision request. facts: Structured facts for working memory, e.g. {"credit_score": 710, "annual_income": 85000}. Use `list_rules` to see which fields a domain's rules test. unstructured_text: Optional free text (an application, a case note); facts are extracted from it automatically and merged. response_mode: "verdict_only" (fastest), "verdict_with_explanation", or "full_audit" (every rule evaluation + retrieved chunks, available on every plan including the free tier). rule_firings come back in causal order: a rule that matched a fact asserted by an earlier firing appears after it, with the derived facts listed under `asserted_facts`. filter_retrieval_with_rules: Pattern 01 — run the rules first and let a fired rule's `retrieval_scope` action narrow which documents the retrieval searches before it runs. extract_from_retrieval: Pattern 02 — parse the retrieved documents into facts and assert them into working memory, so rules fire on what was actually read (not just the facts you passed).
入力スキーマ
{'type': 'object', 'title': 'decideArguments', 'required': ['domain', 'query'], 'properties': {'facts': {'anyOf': [{'type': 'object', 'additionalProperties': True}, {'type': 'null'}], 'title': 'Facts', 'default': None}, 'query': {'type': 'string', 'title': 'Query'}, 'domain': {'type': 'string', 'title': 'Domain'}, 'response_mode': {'enum': ['verdict_only', 'verdict_with_explanation', 'full_audit'], 'type': 'string', 'title': 'Response Mode', 'default': 'verdict_with_explanation'}, 'unstructured_text': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Unstructured Text', 'default': None}, 'extract_from_retrieval': {'type': 'boolean', 'title': 'Extract From Retrieval', 'default': False}, 'filter_retrieval_with_rules': {'type': 'boolean', 'title': 'Filter Retrieval With Rules', 'default': False}}}
出力スキーマ
{'type': 'object', 'title': 'decideOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
get_rule_source
Get rule source (YAML)
Fetch a domain's rule set as editable YAML (plus the parsed rules and whether you may edit it). Use this before `put_rules` to see the current rules. For a built-in demo domain you get your own copy's rules once you have edited it, otherwise the shared demo's.
読み取り専用
入力スキーマ
{'type': 'object', 'title': 'get_rule_sourceArguments', 'required': ['domain'], 'properties': {'domain': {'type': 'string', 'title': 'Domain'}}}
出力スキーマ
{'type': 'object', 'title': 'get_rule_sourceOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
get_usage
Check usage and quota
Show this account's decision usage, plan, and remaining monthly quota.
読み取り専用
入力スキーマ
{'type': 'object', 'title': 'get_usageArguments', 'properties': {}}
出力スキーマ
{'type': 'object', 'title': 'get_usageOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
import_policy_rules
Draft rules from a policy
Convert a written policy document into DRAFT decision rules (LLM-assisted). Returns validated draft rules (when/action, including chained asserts where the policy stages its determinations), derived rule→rule edges, and overlap warnings. Each returned rule carries a `citation` field holding the policy sentence it encodes (also summarized in the top-level `citations` map). NOTHING IS SAVED: review the drafts (and show them to the user), then persist explicitly with `put_rules` — validate first with dry_run=true, and keep each rule's `citation` in the YAML you save so the audit trail back to the policy survives. Args: domain: Domain the rules are drafted for (an owned domain or a new name). policy_text: The policy document text (max ~50k characters).
読み取り専用
入力スキーマ
{'type': 'object', 'title': 'import_policy_rulesArguments', 'required': ['domain', 'policy_text'], 'properties': {'domain': {'type': 'string', 'title': 'Domain'}, 'policy_text': {'type': 'string', 'title': 'Policy Text'}}}
出力スキーマ
{'type': 'object', 'title': 'import_policy_rulesOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
ingest_text
Ingest policy text
Add policy/reference text to a domain's knowledge base. The text is chunked and embedded; explanations for future decisions in this domain will cite it. Creating a new domain claims it for your account (plan limits apply). Ingesting into a built-in demo domain gives your account its own copy of that demo (it counts as one of your domains); the shared demo others see is unchanged. On team plans, only the domain admin (the member who created the domain, or the subscription owner) can add documents. Args: domain: Domain to ingest into (existing or new). text: The policy or reference text. source: Optional source name shown in the document list.
入力スキーマ
{'type': 'object', 'title': 'ingest_textArguments', 'required': ['domain', 'text'], 'properties': {'text': {'type': 'string', 'title': 'Text'}, 'domain': {'type': 'string', 'title': 'Domain'}, 'source': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Source', 'default': None}}}
出力スキーマ
{'type': 'object', 'title': 'ingest_textOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
list_documents
List documents
List the documents ingested into a domain's knowledge base.
読み取り専用
入力スキーマ
{'type': 'object', 'title': 'list_documentsArguments', 'required': ['domain'], 'properties': {'domain': {'type': 'string', 'title': 'Domain'}}}
出力スキーマ
{'type': 'object', 'title': 'list_documentsOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
list_rules
List rules
List the decision rules for one domain (or all domains). Returns each rule's conditions — either a flat AND list (field / operator / value) or a `when` condition tree (nested all/any/not) — plus its verdict, salience, and any asserted facts (`action.assert`, the facts a rule produces for other rules to consume). `edges` lists the derived rule→rule dependencies: src asserts a fact type that dst's conditions test (forward chaining). Each rule may also carry `citation` — the policy sentence it encodes — which is what lets a decision be traced back to the source clause. Also includes overlap warnings. Use this to learn which fact fields a domain expects before calling `decide`.
読み取り専用
入力スキーマ
{'type': 'object', 'title': 'list_rulesArguments', 'properties': {'domain': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Domain', 'default': None}}}
出力スキーマ
{'type': 'object', 'title': 'list_rulesOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
put_rules
Save rules
Create or replace a domain's rule set from YAML (self-serve rule authoring). The first save to a new domain claims it for your account (plan limits apply). Saving to a built-in demo domain saves your own copy of it, seeded from the demo; the shared demo others see is unchanged. Rules are validated before saving — set dry_run=true to validate without persisting. The response reports ok/errors, the parsed rules, and any overlap warnings. YAML format — a list of rules. Flat form (conditions are AND-ed): - name: "Approve" salience: 10 conditions: - type: loan field: credit_score op: ">=" value: 700 action: verdict: "APPROVED" reason: "Credit score meets threshold" Tree form — `when:` holds nested all/any/not condition groups, and an action may assert derived facts that other rules consume (forward chaining; the rule graph derives from these automatically): - name: "Sepsis Screen" salience: 30 when: all: - {type: clinical, field: temperature_f, op: ">=", value: 101.5} - any: - {type: clinical, field: wbc_count, op: ">", value: 12.0} - {type: clinical, field: bands_pct, op: ">", value: 10} action: verdict: "URGENT_ALERT" assert: - {type: sepsis_flag, fields: {severity: high}} - name: "Escalate" salience: 40 when: all: - {type: sepsis_flag, field: severity, op: "==", value: high} - {type: clinical, field: age, op: ">=", value: 65} action: verdict: "ADMIT_ICU" Use either `conditions:` or `when:` per rule, never both. `not` passes when the inner condition does not hold (including when the field is absent). Produce/consume cycles between rules are rejected at validation. An action may also carry `retrieval_scope: { <key>: <value> }` to narrow which documents retrieval searches (Pattern 01). A rule may also carry `citation:` — the policy sentence it encodes. It is stored with the rule and shown beside it in decision audits, so a verdict can be defended with the source language, not just the rule name: - name: "Decline Late Returns" salience: 20 citation: "Returns are accepted within 30 days of delivery." when: all: - {type: retail, field: days_since_delivery, op: ">", value: 30} action: verdict: "DENIED" IMPORTANT: when persisting drafts returned by `import_policy_rules`, copy each rule's `citation` through into this YAML. Dropping it silently loses the link from the decision back to the policy clause that justifies it. Args: domain: Domain to author (an owned domain, or a new name to claim). rules_yaml: The full rule set as YAML text. dry_run: Validate only, without saving.
破壊的操作あり
入力スキーマ
{'type': 'object', 'title': 'put_rulesArguments', 'required': ['domain', 'rules_yaml'], 'properties': {'domain': {'type': 'string', 'title': 'Domain'}, 'dry_run': {'type': 'boolean', 'title': 'Dry Run', 'default': False}, 'rules_yaml': {'type': 'string', 'title': 'Rules Yaml'}}}
出力スキーマ
{'type': 'object', 'title': 'put_rulesOutput', 'required': ['result'], 'properties': {'result': {'type': 'string', 'title': 'Result'}}}
変更
put_rules
2026年9月29日3:01
変更
get_rule_source
2026年9月29日3:01
変更
ingest_text
2026年9月29日3:01
変更
decide
2026年9月29日3:01
追加
get_usage
2026年9月17日12:33
追加
import_policy_rules
2026年9月17日12:33
追加
put_rules
2026年9月17日12:33
追加
get_rule_source
2026年9月17日12:33
追加
list_documents
2026年9月17日12:33
追加
ingest_text
2026年9月17日12:33
追加
list_rules
2026年9月17日12:33
追加
decide
2026年9月17日12:33