{
  "name": "company_finance_mcp_tools_draft",
  "version": "0.1.0",
  "updated_at": "2026-06-03T21:11:35+08:00",
  "description": "一期公司财务系统面向机器人使用的 MCP 工具草案。工具以业务动作封装，不暴露任意底层表写入能力。",
  "tools": [
    {
      "name": "finance_get_intake_rules",
      "description": "获取某类财务入库意图的字段规则、默认规则、阻塞字段和追问模板。机器人在追问用户前应先调用。",
      "input_schema": {
        "type": "object",
        "required": ["intent"],
        "properties": {
          "intent": {"type": "string", "enum": ["record_reimbursement", "record_receivable", "record_fund_in", "allocate_receipt", "record_payable", "record_fund_out", "allocate_payment", "personal_injection", "company_repay_person", "query_project", "query_personal_ledger", "query_subject_summary"]},
          "version": {"type": "string", "default": "current"}
        }
      }
    },
    {
      "name": "finance_validate_intake_draft",
      "description": "校验机器人整理出的结构化草稿，返回缺失字段、风险提示、规范化草稿和适合继续追问用户的问题。",
      "input_schema": {
        "type": "object",
        "required": ["intent", "draft"],
        "properties": {
          "intent": {"type": "string"},
          "draft": {"type": "object"},
          "operator_subject_id": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_resolve_subject",
      "description": "把用户口述的主体名称解析成系统 subject。无法唯一匹配时返回候选和追问建议。",
      "input_schema": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": {"type": "string"},
          "allowed_types": {"type": "array", "items": {"type": "string"}},
          "create_if_missing": {"type": "boolean", "default": false}
        }
      }
    },
    {
      "name": "finance_resolve_project",
      "description": "解析项目；可在无明确业务项目时返回对应主体的基础经营项目。",
      "input_schema": {
        "type": "object",
        "properties": {
          "project_text": {"type": "string"},
          "owner_subject_text": {"type": "string"},
          "owner_subject_id": {"type": "string"},
          "allow_base_operation_fallback": {"type": "boolean", "default": true},
          "create_if_missing": {"type": "boolean", "default": false}
        }
      }
    },
    {
      "name": "finance_prepare_reimbursement",
      "description": "创建报销入库草稿，不直接正式入账。每条报销明细必须挂项目；无业务项目时挂主体基础经营项目。",
      "input_schema": {
        "type": "object",
        "required": ["applicant_subject_id", "items"],
        "properties": {
          "idempotency_key": {"type": "string"},
          "applicant_subject_id": {"type": "string"},
          "payee_subject_id": {"type": "string"},
          "default_owner_subject_id": {"type": "string"},
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["amount", "invoice_status", "description"],
              "properties": {
                "project_id": {"type": "string"},
                "owner_subject_id": {"type": "string"},
                "expense_category_code": {"type": "string"},
                "source_category_code": {"type": "string"},
                "advancer_subject_id": {"type": "string"},
                "amount": {"type": "string"},
                "occurred_at": {"type": "string", "format": "date"},
                "invoice_status": {"type": "string", "enum": ["NO_INVOICE", "PENDING_INVOICE", "INVOICED", "VERIFIED", "INVALID", "VOID"]},
                "description": {"type": "string"},
                "personal_ledger_effect": {"type": "boolean"}
              }
            }
          },
          "remark": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_prepare_receivable",
      "description": "创建应收/收入计划草稿。",
      "input_schema": {
        "type": "object",
        "required": ["project_id", "name", "amount"],
        "properties": {
          "idempotency_key": {"type": "string"},
          "project_id": {"type": "string"},
          "commercial_order_id": {"type": "string"},
          "name": {"type": "string"},
          "amount": {"type": "string"},
          "expected_date": {"type": "string", "format": "date"},
          "expected_receiver_subject_id": {"type": "string"},
          "source_category_code": {"type": "string", "default": "project_income"},
          "remark": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_prepare_payable",
      "description": "创建应付/费用义务草稿。",
      "input_schema": {
        "type": "object",
        "required": ["project_id", "name", "amount"],
        "properties": {
          "idempotency_key": {"type": "string"},
          "project_id": {"type": "string"},
          "paying_subject_id": {"type": "string"},
          "counterparty_subject_id": {"type": "string"},
          "expense_category_code": {"type": "string"},
          "source_category_code": {"type": "string"},
          "name": {"type": "string"},
          "amount": {"type": "string"},
          "incurred_at": {"type": "string", "format": "date"},
          "due_date": {"type": "string", "format": "date"},
          "invoice_status": {"type": "string"},
          "remark": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_record_fund_transaction_draft",
      "description": "创建真实资金流水草稿。每一次真实收款、付款、退款、转账都对应一条 fund_transaction。",
      "input_schema": {
        "type": "object",
        "required": ["direction", "amount", "occurred_at"],
        "properties": {
          "idempotency_key": {"type": "string"},
          "direction": {"type": "string", "enum": ["IN", "OUT", "TRANSFER", "REFUND"]},
          "amount": {"type": "string"},
          "occurred_at": {"type": "string", "format": "date"},
          "payer_subject_id": {"type": "string"},
          "payer_cash_account_id": {"type": "string"},
          "receiver_subject_id": {"type": "string"},
          "receiver_cash_account_id": {"type": "string"},
          "counterparty_subject_id": {"type": "string"},
          "source_category_code": {"type": "string"},
          "proof_attachment_id": {"type": "string"},
          "original_transaction_id": {"type": "string"},
          "remark": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_allocate_fund_transaction",
      "description": "把一笔真实资金流水分配/核销到应收、应付或报销单。",
      "input_schema": {
        "type": "object",
        "required": ["fund_transaction_id", "target_type", "target_id", "amount"],
        "properties": {
          "idempotency_key": {"type": "string"},
          "fund_transaction_id": {"type": "string"},
          "target_type": {"type": "string", "enum": ["receivable", "payable", "reimbursement_order"]},
          "target_id": {"type": "string"},
          "amount": {"type": "string"},
          "settled_at": {"type": "string", "format": "date"},
          "remark": {"type": "string"}
        }
      }
    },
    {
      "name": "finance_preview_intake",
      "description": "生成用户确认/审批前摘要，返回 human_summary、risk_flags、will_create 等。",
      "input_schema": {
        "type": "object",
        "required": ["intent", "draft"],
        "properties": {
          "intent": {"type": "string"},
          "draft": {"type": "object"}
        }
      }
    },
    {
      "name": "finance_search_records",
      "description": "查询主体、项目、应收、应付、报销、资金流水等记录，供机器人对话时查证。",
      "input_schema": {
        "type": "object",
        "required": ["record_type"],
        "properties": {
          "record_type": {"type": "string", "enum": ["subject", "project", "receivable", "payable", "reimbursement", "fund_transaction"]},
          "q": {"type": "string"},
          "filters": {"type": "object"},
          "limit": {"type": "integer", "default": 10, "minimum": 1, "maximum": 100}
        }
      }
    }
  ]
}
