animedex.mcp.tool_decorator

Lightweight @mcp_tool decorator.

The decorator marks a callable as MCP-eligible without altering the callable’s runtime behaviour. Backends will eventually layer the real MCP-package wiring on top of this marker; until then the decorator gives backend authors a single, stable annotation site.

The module avoids importing the upstream mcp package so it can be safely imported in environments where the optional [mcp] extra is not installed.

mcp_tool

animedex.mcp.tool_decorator.mcp_tool(*, name: str) Callable[[Callable[[...], Any]], Callable[[...], Any]][source]

Mark a callable as an MCP-eligible tool.

The decorator stores name on the function object so register_animedex_tools() (in animedex.mcp.register) can pick it up. The returned callable is the original callable, unchanged; no wrapping, no behaviour shift.

Parameters:

name (str) – MCP tool identifier (e.g. "animedex.anilist.search").

Returns:

A decorator that marks and returns the callable.

Return type:

Callable

is_mcp_tool

animedex.mcp.tool_decorator.is_mcp_tool(fn: Callable[[...], Any]) bool[source]

Return True when fn was decorated by mcp_tool().

Parameters:

fn (Callable) – A callable.

Returns:

Whether the marker is present.

Return type:

bool

mcp_tool_name

animedex.mcp.tool_decorator.mcp_tool_name(fn: Callable[[...], Any]) str[source]

Return the registered MCP tool name for fn.

Parameters:

fn (Callable) – A callable previously decorated by mcp_tool().

Returns:

The stored MCP tool identifier.

Return type:

str

Raises:

AttributeError – When fn was not decorated.

selftest

animedex.mcp.tool_decorator.selftest() bool[source]

Smoke-test the decorator.

Returns:

True on success.

Return type:

bool