Tool Family: peer-models
- Registration source:
tools/mcp_tools/peer_models.py:38 register_peer_model_tools(mcp, *, ctx)— auto-discovered but conditionally registers only when_multi_model_enabled(config)(tools/mcp_tools/registry.py:225-230):multi_model.enabled: trueORAI_NMAP_MULTI_MODEL_ENABLEDenv var truthy override. Otherwise no tools. - Gate: both
@audit_tool(no target touch — peer models receive no tool schemas, return suggestions only).
Tools Exported (2) — conditional
| Tool | Params | Result Shape | Notes |
|---|---|---|---|
consult_peer_models | question: str, context: str="", preferred_aliases: str="" (comma/space CSV from models.registry) | `PEER_MODEL_CONSULTATION: BLOCKED | UNAVAILABLE |
peer_review_outcome | verdict: str, evidence: str, planner_alias: str="", preferred_grader_aliases: str="" | `PEER_REVIEW_OUTCOME: BLOCKED | DISABLED |
Budget & Lock
- Single per-run counter
_consultation_count(process singleton,tools/mcp_tools/registry.py:143+tools/mcp_tools/peer_models.py:22-35mirror onmcp_exploit_server._consultation_count) +_consultation_lock(threading.Lock) serializes reservation. remaining = max_consultations - current; selected sliced to remaining; incremented atomically;BUDGET_EXHAUSTEDwhenremaining <= 0.- Both tools share the counter — using both drains the same budget.
Dependencies
tools/model_router.build_router,tools/config_manager.get_ai_provider,get_chatgpt_configtools/mcp_tools/registry._get_model_router,_resolve_consult_aliases,_multi_model_enabled,_chat_content,_truncate_text,_positive_int
Config
multi_model.enabled: bool(default false) +AI_NMAP_MULTI_MODEL_ENABLED=1/0env overridemulti_model.consult_aliases: list[str](defaultkimi,deepseek,...)multi_model.max_consultations: int(default 10),max_question_chars: int(4000),max_answer_chars: int(8000)models.registry: map[alias] -> {provider, model},models.default_alias: str(active model excluded)outcome_judgment.peer_review: bool(gatespeer_review_outcome)
Auditing
- Both
@audit_tool—question/contextnot wholesale-redacted but inline secrets masked; no target IP in these entries. - Budget state not persisted — process lifetime only.
Validation
- Empty
question/verdict/evidence→BLOCKED; unavailable router →UNAVAILABLEwithAVAILABLE_PEERSlisted. preferred_aliasesfiltered to actual registry keys; unknown aliased →SKIPPED.
Tests
tests/test_mcp_tool_registration.py— expectsconsult_peer_modelswhenmulti_model.enabled: trueand registry has peerstests/test_peer_models.py(if present) — budget exhaustion, peer_review disabled, planner exclusion
Related Docs
docs/mcp/registration.mdtools/model_router.py— router seamdocs/providers.md— ChatGPT vs Ollama provider path
source: repo docs (build sync)Edit this page on GitHub →