media_getMediaFilesNames
Retrieve media file names matching a specific pattern from Anki databases using a glob pattern for organized file management and quick access.
Instructions
Gets the names of media files matching the glob pattern. Returns a list of filenames.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | A glob pattern to match filenames (e.g., '*.jpg'). |
Implementation Reference
- src/anki_mcp/media_service.py:23-32 (handler)Handler function implementing the core logic for 'media_getMediaFilesNames' tool by calling AnkiConnect's getMediaFilesNames API with a glob pattern.@media_mcp.tool( name="getMediaFilesNames", description="Gets the names of media files matching the glob pattern. Returns a list of filenames.", ) async def list_media_files_names_tool( pattern: Annotated[ str, Field(description="A glob pattern to match filenames (e.g., '*.jpg').") ], ) -> List[str]: return await anki_call("getMediaFilesNames", pattern=pattern)
- src/anki_mcp/__init__.py:27-27 (registration)Registers the media_mcp server (containing the tool) into the main anki_mcp server with 'media' prefix, resulting in tool name 'media_getMediaFilesNames'.await anki_mcp.import_server("media", media_mcp)
- src/anki_mcp/media_service.py:8-8 (registration)Creates the FastMCP sub-server instance where media tools, including getMediaFilesNames, are registered.media_mcp = FastMCP(name="AnkiMediaService")
- src/anki_mcp/__init__.py:7-7 (registration)Imports the media_mcp server for registration into the main server.from .media_service import media_mcp