Skip to main content
Glama

delete_draft

Delete a saved draft permanently using its ID. This action is irreversible and removes the draft from Pipepost. Returns confirmation with deletion status and the draft ID.

Instructions

Permanently delete a saved draft by id. FREE. Operation is irreversible. Returns: { deleted: true, id }. Common errors: draft id not found (VALIDATION_ERROR).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDraft ID to delete

Implementation Reference

  • Handler function for the delete_draft tool. Validates required 'id' field, then delegates to the store's deleteDraft function.
    export async function handleDeleteDraft(input: z.infer<typeof deleteDraftSchema>) {
      const idErr = validateRequired(input.id, "id");
      if (idErr) return makeError("VALIDATION_ERROR", idErr);
    
      return deleteDraft(input.id);
    }
  • Core deletion logic: ensures directory exists, checks if draft file exists, deletes the JSON file from disk, returns success/error.
    export function deleteDraft(id: string) {
      ensureDir();
    
      const filePath = path.join(getDraftsDir(), `${id}.json`);
      if (!fs.existsSync(filePath)) {
        return makeError("NOT_FOUND", `Draft "${id}" not found`);
      }
    
      fs.unlinkSync(filePath);
      return makeSuccess({ id, deleted: true });
    }
  • Zod schema for delete_draft input validation. Expects a single required string field 'id'.
    /** Zod schema for the `delete_draft` tool input. */
    export const deleteDraftSchema = z.object({
      id: z.string().describe("Draft ID to delete"),
    });
  • src/index.ts:221-225 (registration)
    Registration of the 'delete_draft' tool on the MCP server with description, schema, and handler invocation.
    server.tool("delete_draft", "Permanently delete a saved draft by id. FREE. Operation is irreversible. Returns: { deleted: true, id }. Common errors: draft id not found (VALIDATION_ERROR).", deleteDraftSchema.shape, async (input) => {
      const parsed = deleteDraftSchema.parse(input);
      const result = await handleDeleteDraft(parsed);
      return { content: [{ type: "text", text: formatToolResponse("delete_draft", result, formatDeleteDraft) }] };
    });
  • Formats the deletion result for display, showing a success header and the deleted draft ID.
    export function formatDeleteDraft(data: unknown): string {
      const d = data as { id: string; deleted: boolean };
      return [
        successHeader("Draft Deleted"),
        "",
        field("ID", `\`${d.id}\``),
        "",
        note("This action cannot be undone."),
      ].join("\n");
    }
Behavior4/5

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

With no annotations, description discloses key behaviors: irreversible deletion, return format, common errors. Could add auth or scope info, but sufficient for simple operation.

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?

Three sentences, front-loaded with action. No unnecessary words.

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

Completeness5/5

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

For a simple delete with 1 param and no output schema, covers action, irreversibility, return shape, and common error. Fully adequate.

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 has 100% coverage with description 'Draft ID to delete'. Description adds minimal extra (e.g., 'by id'), not enhancing meaning beyond 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?

Clearly states 'Permanently delete a saved draft by id.' Specific verb and resource, distinguishes from siblings like save_draft, get_draft, list_drafts.

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

Usage Guidelines3/5

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

Implied usage from description, but no explicit when-to-use or when-not-to-use guidance. Does not mention alternatives or context beyond the action.

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/MendleM/pipepost'

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