Skip to main content
Glama
move-file-to-trash.ts897 B
import { access } from "node:fs/promises" import { basename } from "node:path" import trash from "trash" import { z } from "zod" export const moveFileToTrashInputSchema = z.object({ filePath: z.string().describe("Path to the file to move to trash") }) export type MoveFileToTrashInput = z.infer<typeof moveFileToTrashInputSchema> export async function moveFileToTrash(input: MoveFileToTrashInput): Promise<string> { try { const { filePath } = input if (!filePath) { return `Error: No file path provided. Received: ${JSON.stringify(input)}` } try { await access(filePath) } catch (error) { return `File not found: ${filePath}` } await trash(filePath) return `Successfully moved "${basename(filePath)}" to trash` } catch (error) { return `Error moving file to trash: ${error instanceof Error ? error.message : String(error)}` } }

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/itsregularjohn/mcps'

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