forked from hesabix/arc
Complete Chat/MCP coverage for tenant JSON APIs with Swagger pointers, catalog completeness, and the in-app MCP connections page. Co-authored-by: Cursor <cursoragent@cursor.com>
492 lines
22 KiB
Python
492 lines
22 KiB
Python
"""Capability / namespace taxonomy for AI tools — search-friendly, not ranking.
|
|
|
|
Domain = سطل Intent موجود (financial, warehouse, …)
|
|
Capability = کلید نقطهای برای Discovery آینده (financial.invoice)
|
|
Namespace = بخش اول Capability (financial) برای جلوگیری از تصادم در ۱۲۰۰+
|
|
|
|
این ماژول Search Engine را عوض نمیکند؛ فقط برچسب پایدار میسازد.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict, Tuple
|
|
|
|
# مجموعهٔ مجاز — هر Capability باید نقطهای باشد
|
|
TOOL_CAPABILITIES: frozenset[str] = frozenset({
|
|
"agent.memory",
|
|
"agent.plan",
|
|
"agent.subagent",
|
|
"automation.workflow",
|
|
"crm.activity",
|
|
"crm.deal",
|
|
"crm.lead",
|
|
"crm.summary",
|
|
"customer_club.loyalty",
|
|
"distribution.field_ops",
|
|
"distribution.route",
|
|
"financial.account",
|
|
"financial.check",
|
|
"financial.credit",
|
|
"financial.currency",
|
|
"financial.document",
|
|
"financial.expense",
|
|
"financial.fixed_assets",
|
|
"financial.fiscal",
|
|
"financial.invoice",
|
|
"financial.loan",
|
|
"financial.payment",
|
|
"financial.project",
|
|
"financial.transfer",
|
|
"financial.wallet",
|
|
"integration.basalam",
|
|
"integration.connector",
|
|
"integration.woocommerce",
|
|
"integration.telephony",
|
|
"inventory.bom",
|
|
"inventory.product",
|
|
"inventory.production",
|
|
"inventory.warranty",
|
|
"inventory.stock",
|
|
"inventory.warehouse",
|
|
"inventory.barcode",
|
|
"people.person",
|
|
"platform.audit",
|
|
"platform.hscript",
|
|
"platform.marketplace",
|
|
"platform.notifications",
|
|
"platform.settings",
|
|
"query.entity",
|
|
"query.meta",
|
|
"reports.cashflow",
|
|
"reports.crm",
|
|
"reports.export",
|
|
"reports.financial",
|
|
"reports.inventory",
|
|
"reports.overview",
|
|
"reports.payables",
|
|
"reports.purchases",
|
|
"reports.receivables",
|
|
"reports.sales",
|
|
"reports.templates",
|
|
"tax.moadian",
|
|
"misc.general",
|
|
"office_automation.correspondence",
|
|
"payroll.payroll",
|
|
"repair.service",
|
|
})
|
|
|
|
# نام دقیق → capability (منبع حقیقت)
|
|
_EXACT: Dict[str, str] = {
|
|
"adjust_customer_club_points": "customer_club.loyalty",
|
|
"await_subagent": "agent.subagent",
|
|
"batch_query_business_data": "query.entity",
|
|
"bulk_delete_bank_accounts": "financial.account",
|
|
"bulk_delete_cash_registers": "financial.account",
|
|
"bulk_delete_manual_documents": "financial.document",
|
|
"bulk_delete_petty_cash": "financial.account",
|
|
"cancel_subagent": "agent.subagent",
|
|
"create_account": "financial.account",
|
|
"create_bank_account": "financial.account",
|
|
"create_cash_register": "financial.account",
|
|
"create_check": "financial.check",
|
|
"create_expense_income": "financial.expense",
|
|
"create_invoice": "financial.invoice",
|
|
"create_lead": "crm.lead",
|
|
"create_manual_document": "financial.document",
|
|
"create_person": "people.person",
|
|
"create_petty_cash": "financial.account",
|
|
"create_product": "inventory.product",
|
|
"create_product_attribute": "inventory.product",
|
|
"create_receipt_payment": "financial.payment",
|
|
"create_session_plan": "agent.plan",
|
|
"create_transfer": "financial.transfer",
|
|
"create_warehouse_document": "inventory.warehouse",
|
|
"create_workflow": "automation.workflow",
|
|
"delete_account": "financial.account",
|
|
"delete_bank_account": "financial.account",
|
|
"delete_cash_register": "financial.account",
|
|
"delete_check": "financial.check",
|
|
"delete_expense_income": "financial.expense",
|
|
"delete_invoice": "financial.invoice",
|
|
"delete_manual_document": "financial.document",
|
|
"delete_memory_entry": "agent.memory",
|
|
"delete_person": "people.person",
|
|
"delete_petty_cash": "financial.account",
|
|
"delete_product_attribute": "inventory.product",
|
|
"delete_receipt_payment": "financial.payment",
|
|
"delete_transfer": "financial.transfer",
|
|
"delete_workflow": "automation.workflow",
|
|
"execute_workflow": "automation.workflow",
|
|
"export_business_data": "reports.export",
|
|
"get_account": "financial.account",
|
|
"get_bank_account": "financial.account",
|
|
"get_basalam_overview": "integration.basalam",
|
|
"get_bom_details": "inventory.bom",
|
|
"get_business_credit_settings": "financial.credit",
|
|
"get_business_dashboard": "reports.overview",
|
|
"get_business_info": "platform.settings",
|
|
"get_cash_flow": "reports.cashflow",
|
|
"get_cash_register": "financial.account",
|
|
"get_check_details": "financial.check",
|
|
"get_creditors_report": "reports.payables",
|
|
"get_crm_summary": "crm.summary",
|
|
"get_current_fiscal_year": "financial.fiscal",
|
|
"get_customer_club_rfm_summary": "customer_club.loyalty",
|
|
"get_customer_club_settings": "customer_club.loyalty",
|
|
"get_customer_info": "people.person",
|
|
"get_deal_details": "crm.deal",
|
|
"get_debtors_report": "reports.receivables",
|
|
"get_document_details": "financial.document",
|
|
"get_document_numbering_settings": "platform.settings",
|
|
"get_document_types_summary": "financial.document",
|
|
"get_financial_summary": "reports.financial",
|
|
"get_inventory_status": "inventory.stock",
|
|
"get_inventory_valuation": "reports.inventory",
|
|
"get_invoice_details": "financial.invoice",
|
|
"get_invoices_count": "financial.invoice",
|
|
"get_lead_details": "crm.lead",
|
|
"get_lead_funnel_report": "reports.crm",
|
|
"get_loan_facility": "financial.loan",
|
|
"get_opening_balance": "financial.account",
|
|
"get_person_balance": "people.person",
|
|
"get_person_credit": "financial.credit",
|
|
"get_petty_cash": "financial.account",
|
|
"get_person_transactions": "financial.payment",
|
|
"get_pipeline_report": "reports.crm",
|
|
"get_product_attribute": "inventory.product",
|
|
"get_product_info": "inventory.product",
|
|
"get_product_kardex": "inventory.stock",
|
|
"get_project_summary": "financial.project",
|
|
"get_purchase_report": "reports.purchases",
|
|
"get_quick_sales_settings": "platform.settings",
|
|
"get_repair_order_details": "misc.general",
|
|
"get_report": "reports.overview",
|
|
"get_report_template": "reports.templates",
|
|
"get_report_template_scope_catalog": "reports.templates",
|
|
"get_sales_report": "reports.sales",
|
|
"get_tax_data_quality": "tax.moadian",
|
|
"get_tax_settings": "tax.moadian",
|
|
"get_wallet_metrics": "financial.wallet",
|
|
"get_wallet_overview": "financial.wallet",
|
|
"get_warehouse_document_details": "inventory.warehouse",
|
|
"get_warehouse_report": "reports.inventory",
|
|
"get_warehouse_stock_summary": "inventory.stock",
|
|
"get_workflow": "automation.workflow",
|
|
"get_workflow_component_schema": "automation.workflow",
|
|
"get_workflow_design_rules": "automation.workflow",
|
|
"get_workflow_execution_debug": "automation.workflow",
|
|
"hscript_fix_script": "platform.hscript",
|
|
"hscript_language_guide": "platform.hscript",
|
|
"hscript_read_doc": "platform.hscript",
|
|
"hscript_retrieve_docs": "platform.hscript",
|
|
"hscript_run_preview": "platform.hscript",
|
|
"hscript_search_docs": "platform.hscript",
|
|
"hscript_validate_script": "platform.hscript",
|
|
"invoke_business_connector": "integration.connector",
|
|
"list_accounts": "financial.account",
|
|
"list_announcements": "platform.notifications",
|
|
"list_available_reports": "reports.overview",
|
|
"list_mcp_categories": "query.meta",
|
|
"list_bank_accounts": "financial.account",
|
|
"list_basalam_dead_letter": "integration.basalam",
|
|
"list_basalam_product_conflicts": "integration.basalam",
|
|
"list_basalam_synced_invoices": "integration.basalam",
|
|
"list_boms": "inventory.bom",
|
|
"list_business_notification_logs": "platform.notifications",
|
|
"list_business_notification_templates": "platform.notifications",
|
|
"list_business_plugins": "platform.marketplace",
|
|
"list_business_users": "platform.settings",
|
|
"list_cash_registers": "financial.account",
|
|
"list_credit_installment_plans": "financial.credit",
|
|
"list_currencies": "financial.currency",
|
|
"list_currency_rates": "financial.currency",
|
|
"list_customer_club_ledger": "customer_club.loyalty",
|
|
"list_customer_club_tiers": "customer_club.loyalty",
|
|
"list_distribution_routes": "distribution.route",
|
|
"list_fiscal_years": "financial.fiscal",
|
|
"list_frequent_descriptions": "financial.document",
|
|
"list_loan_facilities": "financial.loan",
|
|
"list_marketplace_plugins": "platform.marketplace",
|
|
"list_my_businesses": "platform.settings",
|
|
"list_payment_gateways": "financial.payment",
|
|
"list_person_groups": "people.person",
|
|
"list_petty_cash": "financial.account",
|
|
"list_price_list_items": "inventory.product",
|
|
"list_price_lists": "inventory.product",
|
|
"list_product_attributes": "inventory.product",
|
|
"list_queryable_fields": "query.meta",
|
|
"list_report_templates": "reports.templates",
|
|
"list_session_todos": "agent.plan",
|
|
"list_user_notifications": "platform.notifications",
|
|
"list_wallet_transactions": "financial.wallet",
|
|
"list_warehouse_locations": "inventory.warehouse",
|
|
"list_warehouse_placements": "inventory.warehouse",
|
|
"list_warehouses": "inventory.warehouse",
|
|
"list_inventory_lots": "inventory.stock",
|
|
"get_expiry_stock_report": "inventory.stock",
|
|
"list_woocommerce_orders": "integration.woocommerce",
|
|
"list_woocommerce_products": "integration.woocommerce",
|
|
"list_workflow_action_catalog": "automation.workflow",
|
|
"list_workflow_builtin_nodes": "automation.workflow",
|
|
"list_workflow_executions": "automation.workflow",
|
|
"list_workflow_trigger_catalog": "automation.workflow",
|
|
"list_workflows": "automation.workflow",
|
|
"poll_workflow_execution": "automation.workflow",
|
|
"post_opening_balance": "financial.account",
|
|
"preview_opening_balance": "financial.account",
|
|
"publish_report_template": "reports.templates",
|
|
"query_business_data": "query.entity",
|
|
"read_memory": "agent.memory",
|
|
"recalculate_customer_club_rfm": "customer_club.loyalty",
|
|
"resolve_currency_rate": "financial.currency",
|
|
"resolve_date_range": "query.meta",
|
|
"search_activities": "crm.activity",
|
|
"search_activity_logs": "platform.audit",
|
|
"search_categories": "inventory.product",
|
|
"search_checks": "financial.check",
|
|
"search_customer_club_rfm_persons": "customer_club.loyalty",
|
|
"search_deals": "crm.deal",
|
|
"search_documents": "financial.document",
|
|
"search_expense_income": "financial.expense",
|
|
"search_invoices": "financial.invoice",
|
|
"search_mcp_tools": "query.meta",
|
|
"search_leads": "crm.lead",
|
|
"search_persons": "people.person",
|
|
"search_product_instances": "inventory.stock",
|
|
"search_production_documents": "inventory.production",
|
|
"search_products": "inventory.product",
|
|
"search_projects": "financial.project",
|
|
"search_receipts_payments": "financial.payment",
|
|
"search_repair_orders": "misc.general",
|
|
"search_tax_workspace": "tax.moadian",
|
|
"search_transfers": "financial.transfer",
|
|
"search_warehouse_documents": "inventory.warehouse",
|
|
"search_warranty_codes": "misc.general",
|
|
"set_default_report_template": "reports.templates",
|
|
"spawn_subagent": "agent.subagent",
|
|
"test_workflow": "automation.workflow",
|
|
"unpost_opening_balance": "financial.account",
|
|
"update_account": "financial.account",
|
|
"update_bank_account": "financial.account",
|
|
"update_cash_register": "financial.account",
|
|
"update_check": "financial.check",
|
|
"update_customer_club_settings": "customer_club.loyalty",
|
|
"update_expense_income": "financial.expense",
|
|
"update_invoice": "financial.invoice",
|
|
"update_manual_document": "financial.document",
|
|
"update_person": "people.person",
|
|
"update_petty_cash": "financial.account",
|
|
"update_product": "inventory.product",
|
|
"update_product_attribute": "inventory.product",
|
|
"update_receipt_payment": "financial.payment",
|
|
"update_session_todo": "agent.plan",
|
|
"update_transfer": "financial.transfer",
|
|
"update_workflow": "automation.workflow",
|
|
"upsert_memory_entry": "agent.memory",
|
|
"upsert_opening_balance": "financial.account",
|
|
"validate_workflow_draft": "automation.workflow",
|
|
"archive_barcode_label_template": "inventory.barcode",
|
|
"capitalize_fixed_asset": "financial.fixed_assets",
|
|
"change_fixed_asset_estimate": "financial.fixed_assets",
|
|
"click_to_call": "integration.telephony",
|
|
"create_barcode_label_from_preset": "inventory.barcode",
|
|
"create_fixed_asset": "financial.fixed_assets",
|
|
"create_fixed_asset_depreciation_run": "financial.fixed_assets",
|
|
"create_fixed_asset_location": "financial.fixed_assets",
|
|
"create_lead_from_telephony_call": "integration.telephony",
|
|
"create_person_from_telephony_call": "integration.telephony",
|
|
"delete_fixed_asset": "financial.fixed_assets",
|
|
"delete_fixed_asset_depreciation_run": "financial.fixed_assets",
|
|
"delete_telephony_user_extension": "integration.telephony",
|
|
"dispose_fixed_asset": "financial.fixed_assets",
|
|
"duplicate_barcode_label_template": "inventory.barcode",
|
|
"get_barcode_label_printer_settings": "inventory.barcode",
|
|
"get_barcode_label_template": "inventory.barcode",
|
|
"get_default_barcode_label_template": "inventory.barcode",
|
|
"get_fixed_asset": "financial.fixed_assets",
|
|
"get_fixed_asset_report": "financial.fixed_assets",
|
|
"get_fixed_asset_depreciation_run": "financial.fixed_assets",
|
|
"get_fixed_asset_settings": "financial.fixed_assets",
|
|
"get_fixed_assets_dashboard": "financial.fixed_assets",
|
|
"get_telephony_call": "integration.telephony",
|
|
"get_telephony_dashboard": "integration.telephony",
|
|
"get_telephony_reports_summary": "integration.telephony",
|
|
"get_telephony_settings": "integration.telephony",
|
|
"list_barcode_label_presets": "inventory.barcode",
|
|
"list_barcode_label_templates": "inventory.barcode",
|
|
"list_fixed_asset_classes": "financial.fixed_assets",
|
|
"list_fixed_asset_depreciation_runs": "financial.fixed_assets",
|
|
"list_fixed_asset_locations": "financial.fixed_assets",
|
|
"list_fixed_assets": "financial.fixed_assets",
|
|
"list_telephony_calls": "integration.telephony",
|
|
"list_telephony_extensions": "integration.telephony",
|
|
"list_telephony_pbx": "integration.telephony",
|
|
"list_telephony_user_extensions": "integration.telephony",
|
|
"lookup_telephony_number": "integration.telephony",
|
|
"post_fixed_asset_depreciation_run": "financial.fixed_assets",
|
|
"post_fixed_asset_expenditure": "financial.fixed_assets",
|
|
"publish_barcode_label_template": "inventory.barcode",
|
|
"resume_fixed_asset": "financial.fixed_assets",
|
|
"set_default_barcode_label_template": "inventory.barcode",
|
|
"set_fixed_asset_idle": "financial.fixed_assets",
|
|
"update_barcode_label_printer_settings": "inventory.barcode",
|
|
"update_business_info": "platform.settings",
|
|
"update_document_numbering_settings": "platform.settings",
|
|
"update_fixed_asset": "financial.fixed_assets",
|
|
"update_fixed_asset_class": "financial.fixed_assets",
|
|
"update_fixed_asset_location": "financial.fixed_assets",
|
|
"update_fixed_asset_settings": "financial.fixed_assets",
|
|
"update_telephony_call": "integration.telephony",
|
|
"update_telephony_pbx": "integration.telephony",
|
|
"update_telephony_settings": "integration.telephony",
|
|
"upsert_telephony_extension": "integration.telephony",
|
|
"upsert_telephony_user_extension": "integration.telephony",
|
|
"create_credit_installment_plan": "financial.credit",
|
|
"create_person_group": "people.person",
|
|
"create_project": "financial.project",
|
|
"delete_credit_installment_plan": "financial.credit",
|
|
"delete_person_group": "people.person",
|
|
"delete_project": "financial.project",
|
|
"get_credit_installment_plan": "financial.credit",
|
|
"get_person_group": "people.person",
|
|
"list_project_documents": "financial.project",
|
|
"update_credit_installment_plan": "financial.credit",
|
|
"update_credit_settings": "financial.credit",
|
|
"update_person_credit": "financial.credit",
|
|
"update_person_group": "people.person",
|
|
"update_project": "financial.project",
|
|
"search_product_bundles": "inventory.product",
|
|
"get_product_bundle": "inventory.product",
|
|
"create_product_bundle": "inventory.product",
|
|
"update_product_bundle": "inventory.product",
|
|
"delete_product_bundle": "inventory.product",
|
|
"expand_product_bundle": "inventory.product",
|
|
"get_price_list": "inventory.product",
|
|
"create_price_list": "inventory.product",
|
|
"update_price_list": "inventory.product",
|
|
"delete_price_list": "inventory.product",
|
|
"upsert_price_list_item": "inventory.product",
|
|
"delete_price_list_item": "inventory.product",
|
|
"get_product_category_tree": "inventory.product",
|
|
"create_product_category": "inventory.product",
|
|
"update_product_category": "inventory.product",
|
|
"move_product_category": "inventory.product",
|
|
"delete_product_category": "inventory.product",
|
|
"get_available_product_instances": "inventory.stock",
|
|
"create_product_instance": "inventory.stock",
|
|
"update_product_instance": "inventory.stock",
|
|
"delete_product_instance": "inventory.stock",
|
|
"get_warehouse": "inventory.warehouse",
|
|
"create_warehouse": "inventory.warehouse",
|
|
"update_warehouse": "inventory.warehouse",
|
|
"delete_warehouse": "inventory.warehouse",
|
|
"create_warehouse_location": "inventory.warehouse",
|
|
"update_warehouse_location": "inventory.warehouse",
|
|
"delete_warehouse_location": "inventory.warehouse",
|
|
"create_warehouse_placement": "inventory.warehouse",
|
|
"update_warehouse_placement": "inventory.warehouse",
|
|
"delete_warehouse_placement": "inventory.warehouse",
|
|
"reconcile_warehouse_placements": "inventory.warehouse",
|
|
"create_frequent_description": "financial.document",
|
|
"update_frequent_description": "financial.document",
|
|
"delete_frequent_description": "financial.document",
|
|
"list_catalog_spec_fields": "inventory.product",
|
|
"get_catalog_spec_field": "inventory.product",
|
|
"create_catalog_spec_field": "inventory.product",
|
|
"update_catalog_spec_field": "inventory.product",
|
|
"delete_catalog_spec_field": "inventory.product",
|
|
"list_currency_rates": "financial.currency",
|
|
"get_latest_currency_rates": "financial.currency",
|
|
"resolve_currency_rate": "financial.currency",
|
|
"create_currency_rate": "financial.currency",
|
|
"update_currency_rate": "financial.currency",
|
|
"delete_currency_rate": "financial.currency",
|
|
"add_business_currency": "financial.currency",
|
|
"remove_business_currency": "financial.currency",
|
|
"create_loan_facility": "financial.loan",
|
|
"update_loan_facility": "financial.loan",
|
|
"delete_loan_facility": "financial.loan",
|
|
"regenerate_loan_schedule": "financial.loan",
|
|
"record_loan_payment": "financial.loan",
|
|
"delete_loan_payment": "financial.loan",
|
|
"create_fiscal_year": "financial.fiscal",
|
|
"update_current_fiscal_year": "financial.fiscal",
|
|
"set_current_fiscal_year": "financial.fiscal",
|
|
"preview_year_end_closing": "financial.fiscal",
|
|
"close_fiscal_year": "financial.fiscal",
|
|
"preview_fiscal_year_rollback": "financial.fiscal",
|
|
"execute_fiscal_year_rollback": "financial.fiscal",
|
|
"enqueue_quick_sale": "financial.invoice",
|
|
"get_quick_sale_job": "financial.invoice",
|
|
"update_quick_sales_settings": "platform.settings",
|
|
"list_quick_sales_payment_buttons": "financial.invoice",
|
|
"create_quick_sales_payment_button": "financial.invoice",
|
|
"update_quick_sales_payment_button": "financial.invoice",
|
|
"delete_quick_sales_payment_button": "financial.invoice",
|
|
"reorder_quick_sales_payment_buttons": "financial.invoice",
|
|
"list_quick_sales_stock_discrepancies": "inventory.stock",
|
|
"create_quick_sales_stock_correction": "inventory.stock",
|
|
"list_customer_club_tiers": "customer_club.loyalty",
|
|
"replace_customer_club_tiers": "customer_club.loyalty",
|
|
"list_customer_club_rewards": "customer_club.loyalty",
|
|
"save_customer_club_reward": "customer_club.loyalty",
|
|
"redeem_customer_club_reward": "customer_club.loyalty",
|
|
"list_customer_club_vouchers": "customer_club.loyalty",
|
|
"set_customer_club_consent": "customer_club.loyalty",
|
|
"submit_customer_club_survey": "customer_club.loyalty",
|
|
"get_customer_club_member_profile": "customer_club.loyalty",
|
|
"preview_customer_club_segment": "customer_club.loyalty",
|
|
"list_customer_club_campaigns": "customer_club.loyalty",
|
|
"save_customer_club_campaign": "customer_club.loyalty",
|
|
"run_customer_club_campaign": "customer_club.loyalty",
|
|
"get_customer_club_campaign_stats": "customer_club.loyalty",
|
|
"get_business_notification_template": "platform.notifications",
|
|
"create_business_notification_template": "platform.notifications",
|
|
"update_business_notification_template": "platform.notifications",
|
|
"submit_business_notification_template": "platform.notifications",
|
|
"preview_business_notification_template": "platform.notifications",
|
|
"send_business_notification": "platform.notifications",
|
|
"get_goods_expense_income_settings": "inventory.warehouse",
|
|
"list_goods_expense_income": "inventory.warehouse",
|
|
"get_goods_expense_income": "inventory.warehouse",
|
|
"create_goods_expense_income": "inventory.warehouse",
|
|
"update_goods_expense_income": "inventory.warehouse",
|
|
"submit_goods_expense_income": "inventory.warehouse",
|
|
"allocate_goods_expense_income": "inventory.warehouse",
|
|
"post_goods_expense_income": "inventory.warehouse",
|
|
"cancel_goods_expense_income": "inventory.warehouse",
|
|
"delete_goods_expense_income": "inventory.warehouse",
|
|
"get_advanced_production_settings": "inventory.production",
|
|
"update_advanced_production_settings": "inventory.production",
|
|
"get_advanced_production_dashboard": "reports.overview",
|
|
"get_advanced_production_report": "reports.overview",
|
|
"list_advanced_production_master": "inventory.production",
|
|
"create_advanced_production_master": "inventory.production",
|
|
}
|
|
|
|
|
|
def resolve_tool_capability(name: str, domains: Tuple[str, ...] = ()) -> str:
|
|
cap = _EXACT.get(name or "")
|
|
if cap:
|
|
return cap
|
|
if domains:
|
|
from app.services.ai.ai_tool_spec import DOMAIN_TO_CAPABILITY
|
|
mapped = DOMAIN_TO_CAPABILITY.get(domains[0])
|
|
if mapped and "." in mapped:
|
|
return mapped
|
|
return "misc.general"
|
|
|
|
|
|
def namespace_for_capability(capability: str) -> str:
|
|
cap = (capability or "").strip()
|
|
if "." in cap:
|
|
return cap.split(".", 1)[0]
|
|
return cap or "misc"
|
|
|
|
|
|
def capability_matches(tool_capability: str, requested: str) -> bool:
|
|
"""مطابقت دقیق یا پیشوند (financial → financial.invoice)."""
|
|
req = (requested or "").strip()
|
|
cap = (tool_capability or "").strip()
|
|
if not req or not cap:
|
|
return False
|
|
return cap == req or cap.startswith(req + ".")
|