Files
AI-Profile-Router/platform/mcp/patches/mcp_radarr.py
T

39 lines
1.8 KiB
Python

"""Radarr action-routed MCP tool with model-oriented routing guidance."""
import json
from typing import Any
from agent_utilities.mcp_utilities import dispatch, run_blocking
from fastmcp import FastMCP
from pydantic import Field
from arr_mcp.auth import get_radarr_client
def register_radarr_tools(mcp: FastMCP) -> None:
@mcp.tool(tags={"radarr"})
async def radarr_action(
action: str = Field(
description=(
"Choose one Radarr operation. Common read choices include get_movie for the "
"movie library and get_system_status/get_health for Radarr diagnostics. Use "
"list_actions only when an unusual Radarr operation is genuinely required. "
"Never guess a modifying action and never change Radarr without explicit user approval."
)
),
params_json: str = Field(
default="{}",
description=(
"JSON object encoded as a string containing only parameters required by the "
"selected Radarr action. Use \"{}\" for actions without parameters; never "
"invent movie IDs, paths, profile IDs or monitoring settings."
),
),
) -> Any:
"""USE ONLY for movies managed by Radarr: inspect the movie library, wanted/queue/history state, releases, profiles, or Radarr health. DO NOT use for TV episodes (use Sonarr), public-web research, media playback, filesystem copying, or direct downloads. Prefer read actions; any mutation requires explicit user approval."""
client = get_radarr_client()
kwargs = {k: v for k, v in json.loads(params_json).items() if v is not None}
return await run_blocking(
dispatch, client, action, kwargs, service="arr-radarr"
)