ppm_risk_move_in_matrix
Update a risk's probability and impact in the P×I matrix to reposition it, with risk score and level recalculated automatically.
Instructions
Move a risk in the P×I matrix.
Both probability and impact are integers 1–5 (matching the selection keys).
The server recomputes risk_score and risk_level automatically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| risk_id | Yes | ||
| probability | Yes | ||
| impact | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/qod_ppm_mcp/server.py:261-275 (handler)The @mcp.tool() decorated function ppm_risk_move_in_matrix that implements the tool logic. It validates probability/impact in [1,5], calls Odoo execute_kw to write the risk's probability and impact fields, then reads back the updated state.
@mcp.tool() def ppm_risk_move_in_matrix(risk_id: int, probability: int, impact: int) -> dict[str, Any]: """Move a risk in the P×I matrix. Both probability and impact are integers 1–5 (matching the selection keys). The server recomputes `risk_score` and `risk_level` automatically. """ if not (1 <= probability <= 5) or not (1 <= impact <= 5): raise ValueError("probability and impact must be integers in [1, 5]") client().execute_kw( "ppm.risk", "write", [[risk_id], {"probability": str(probability), "impact": str(impact)}], ) return _read_state("ppm.risk", risk_id, _RISK_FIELDS) - src/qod_ppm_mcp/server.py:206-216 (schema)_RISK_FIELDS is the schema of fields returned by each risk tool, including ppm_risk_move_in_matrix. It defines what fields are read back after updating the risk.
_RISK_FIELDS = [ "name", "state", "risk_type", "probability", "impact", "risk_score", "risk_level", "project_id", "owner_id", ] - src/qod_ppm_mcp/server.py:261-262 (registration)The @mcp.tool() decorator registers ppm_risk_move_in_matrix as an MCP tool on the FastMCP instance (line 19: mcp = FastMCP('qod-ppm')).
@mcp.tool() def ppm_risk_move_in_matrix(risk_id: int, probability: int, impact: int) -> dict[str, Any]: - src/qod_ppm_mcp/server.py:30-34 (helper)Helper function _read_state used to read back risk state after updating. Calls client().read() to fetch field values for a given record.
def _read_state(model: str, rec_id: int, fields: list[str]) -> dict[str, Any]: rows = client().read(model, [rec_id], fields) if not rows: raise ValueError(f"{model} id={rec_id} not found") return rows[0]