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
nameon the function object soregister_animedex_tools()(inanimedex.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
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:
- Raises:
AttributeError – When
fnwas not decorated.