Skip to main content
Glama

media_deleteMediaFile

Remove unwanted files from Anki's media folder to manage storage and organize your flashcard resources.

Instructions

Deletes the specified file from Anki's media folder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesThe name of the file to delete from the media collection.

Implementation Reference

  • The handler function `delete_media_file_tool` that executes the `media_deleteMediaFile` tool logic. It takes a filename parameter and calls AnkiConnect's `deleteMediaFile` via `anki_call`.
    @media_mcp.tool(
        name="deleteMediaFile",
        description="Deletes the specified file from Anki's media folder.",
    )
    async def delete_media_file_tool(
        filename: Annotated[
            str,
            Field(description="The name of the file to delete from the media collection."),
        ],
    ) -> None:
        return await anki_call("deleteMediaFile", filename=filename)
  • The `import_server` call registers all tools from `media_mcp` (including `deleteMediaFile`) with the 'media_' prefix under the main `anki_mcp`, making it available as 'media_deleteMediaFile'.
    await anki_mcp.import_server("media", media_mcp)
  • The `anki_call` helper function used by the handler to make HTTP POST requests to AnkiConnect API, handling errors and returning results.
    async def anki_call(action: str, **params: Any) -> Any:
        async with httpx.AsyncClient() as client:
            payload = {"action": action, "version": 6, "params": params}
            result = await client.post(ANKICONNECT_URL, json=payload)
            result.raise_for_status()                                      
            result_json = result.json()
            error = result_json.get("error")
            if error:
                raise Exception(f"AnkiConnect error for action '{action}': {error}")
            response = result_json.get("result")
                                                                 
                                                                                                         
                                                                                            
            if "result" in result_json:
                return response
            return result_json                                                                        
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the destructive action ('Deletes') but doesn't mention critical details like permissions needed, irreversibility, error handling, or impact on associated notes/cards. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations and no output schema, the description is incomplete. It fails to address behavioral aspects like safety warnings, return values, or error conditions, which are crucial for an agent to use this tool correctly in context with sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the schema already documents the single parameter 'filename' adequately. The description adds no additional meaning beyond what the schema provides, such as file format constraints or path details, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Deletes') and resource ('the specified file from Anki's media folder'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like media_getMediaFilesNames or media_storeMediaFile, which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as note deletion tools or other media operations. It lacks context about prerequisites, consequences, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ujisati/anki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server