Skip to main content
Glama

Trash File

trash_file
DestructiveIdempotent

Move files or folders to the Trash using Finder by providing the absolute path.

Instructions

Move a file or folder to the Trash using Finder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the file or folder to trash

Implementation Reference

  • The tool handler for 'trash_file'. It registers the tool with input schema (path), calls resolveAndGuard for path safety, then executes the JXA trash script via trashFileScript.
    server.registerTool(
      "trash_file",
      {
        title: "Trash File",
        description: "Move a file or folder to the Trash using Finder.",
        inputSchema: {
          path: zFilePath.describe("Absolute path of the file or folder to trash"),
        },
        annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
      },
      async ({ path }) => {
        try {
          resolveAndGuard(path);
          return ok(await runJxa(trashFileScript(path)));
        } catch (e) {
          return errJxaFor("trash file", e);
        }
      },
    );
  • Input schema and metadata for the trash_file tool: requires 'path' (zFilePath), marked as destructiveHint: true.
    "trash_file",
    {
      title: "Trash File",
      description: "Move a file or folder to the Trash using Finder.",
      inputSchema: {
        path: zFilePath.describe("Absolute path of the file or folder to trash"),
      },
      annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
    },
  • The tool is registered via server.registerTool('trash_file', ...) inside the registerFinderTools function.
    server.registerTool(
      "trash_file",
      {
        title: "Trash File",
        description: "Move a file or folder to the Trash using Finder.",
        inputSchema: {
          path: zFilePath.describe("Absolute path of the file or folder to trash"),
        },
        annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
      },
      async ({ path }) => {
        try {
          resolveAndGuard(path);
          return ok(await runJxa(trashFileScript(path)));
        } catch (e) {
          return errJxaFor("trash file", e);
        }
      },
    );
  • The trashFileScript JXA helper function. It uses Finder.delete() to move a file or folder to the Trash and returns JSON with trashed status, name, and path.
    export function trashFileScript(path: string): string {
      assertSafePath(path);
      return `
        const Finder = Application('Finder');
        const posixFile = Path('${esc(path)}');
        const item = Finder.items[posixFile.toString()];
        const name = item.name();
        Finder.delete(item);
        JSON.stringify({trashed: true, name: name, path: '${esc(path)}'});
      `;
    }
Behavior3/5

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

Annotations already indicate destructiveHint=true and readOnlyHint=false. The description adds no further behavioral context (e.g., whether trashing is reversible, effects on permissions). No contradiction with annotations.

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?

Extremely concise single sentence with no unnecessary words. For a simple tool, this is appropriately brief.

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

Completeness3/5

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

Given the simple nature and presence of annotations, the description is minimally adequate. However, it lacks details on success/failure behavior and does not clarify that trashing is reversible (important distinction from deletion).

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?

Schema coverage is 100% and provides a clear description for 'path'. The tool description adds no additional meaning beyond the schema.

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

Purpose5/5

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

The description clearly states the action ('Move'), the resource ('file or folder'), and the destination ('Trash using Finder'). It distinguishes from siblings like 'delete_note' or 'move_file' by specifying the trashing operation.

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?

No guidance on when to use trash vs permanent delete, prerequisites (e.g., path must exist), or when not to use. The description lacks context for decision-making.

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/heznpc/AirMCP'

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