Skip to main content
Glama

delete_task_file

Permanently delete a file attachment from a Kanboard task. Requires explicit confirmation to avoid accidental removal.

Instructions

Permanently delete a file attachment from a Kanboard task. DESTRUCTIVE — requires explicit confirm: true. Returns { ok: true, file_id } on success.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesFile id to permanently delete (required).
confirmYesMust be exactly `true` to confirm permanent deletion.

Implementation Reference

  • The deleteTaskFileTool handler — parses input, confirms destruction, calls handler.removeTaskFile(file_id), and returns success with { ok: true, file_id }.
    export const deleteTaskFileTool = {
      name: "delete_task_file",
      description:
        "Permanently delete a file attachment from a Kanboard task. " +
        "DESTRUCTIVE — requires explicit `confirm: true`. " +
        "Returns { ok: true, file_id } on success.",
      inputSchema: DeleteTaskFileInput,
      handler: async (raw: unknown, deps: ToolDeps): Promise<DeleteTaskFileResult> => {
        const parsed = DeleteTaskFileInput.safeParse(raw);
        if (!parsed.success) {
          throw new ValidationError(
            "delete_task_file",
            parsed.error.issues.map((i) => i.message).join("; "),
            parsed.error.issues,
          );
        }
    
        const input = parsed.data;
        assertConfirmed("delete_task_file", input.confirm);
    
        await deps.handler.removeTaskFile(input.file_id);
    
        return {
          content: [
            { type: "text", text: `Task file ${String(input.file_id)} deleted permanently.` },
          ],
          structuredContent: { ok: true, file_id: input.file_id },
        };
      },
    };
  • DeleteTaskFileInput Zod schema: requires file_id (positive int) and confirm (literal true).
    export const DeleteTaskFileInput = z
      .object({
        file_id: z
          .number()
          .int()
          .positive()
          .describe("File id to permanently delete (required)."),
        confirm: z
          .literal(true)
          .describe("Must be exactly `true` to confirm permanent deletion."),
      })
      .strict();
    
    export type DeleteTaskFileInput = z.infer<typeof DeleteTaskFileInput>;
  • KanboardHandler.removeTaskFile — calls Kanboard's removeTaskFile JSON-RPC method with file_id. This is the underlying API call executed by the tool handler.
    /**
     * Permanently removes a task attachment (file).
     * Kanboard's wire param for this method is `file_id`.
     * @throws {KanboardApiError} when Kanboard returns false.
     */
    public async removeTaskFile(fileId: number): Promise<void> {
      const raw = await this.#apiClient.call("removeTaskFile", { file_id: fileId });
      this.#logger.debug({ method: "removeTaskFile" }, "removeTaskFile OK");
      decodeMutation("removeTaskFile", raw);
    }
  • deleteTaskFileTool imported from ./delete-task-file.js and registered in the allTools array (line 175) so registerTools() mounts it on the MCP server.
    import { deleteTaskFileTool } from "./delete-task-file.js";
    import { getProjectTool } from "./get-project.js";
    import { getTaskTool } from "./get-task.js";
    import { listCategoriesTool } from "./list-categories.js";
    import { listColumnsTool } from "./list-columns.js";
    import { listMyTasksTool } from "./list-my-tasks.js";
    import { listOverdueTasksTool } from "./list-overdue-tasks.js";
    import { listProjectsTool } from "./list-projects.js";
    import { listSubtasksTool } from "./list-subtasks.js";
    import { listSwimlanesTool } from "./list-swimlanes.js";
    import { listTasksTool } from "./list-tasks.js";
    import { listProjectUsersTool } from "./list-project-users.js";
    import { moveColumnTool } from "./move-column.js";
    import { moveSwimlaneTool } from "./move-swimlane.js";
    import { moveTaskPositionTool } from "./move-task-position.js";
    import { removeProjectUserTool } from "./remove-project-user.js";
    import { updateColumnTool } from "./update-column.js";
    import { updateCommentTool } from "./update-comment.js";
    import { updateProjectTool } from "./update-project.js";
    import { updateSubtaskTool } from "./update-subtask.js";
    import { updateSwimlaneTool } from "./update-swimlane.js";
    import { updateTaskTool } from "./update-task.js";
    
    // ---------------------------------------------------------------------------
    // Re-exports — individual tools (transports may pick them selectively)
    // ---------------------------------------------------------------------------
    
    export { addProjectUserTool } from "./add-project-user.js";
    export { attachFileToTaskTool } from "./attach-file-to-task.js";
    export { createColumnTool } from "./create-column.js";
    export { createCommentTool } from "./create-comment.js";
    export { createProjectTool } from "./create-project.js";
    export { createSubtaskTool } from "./create-subtask.js";
    export { createSwimlaneTool } from "./create-swimlane.js";
    export { createTaskTool } from "./create-task.js";
    export { createTasksBatchTool } from "./create-tasks-batch.js";
    export { deleteColumnTool } from "./delete-column.js";
    export { deleteCommentTool } from "./delete-comment.js";
    export { deleteProjectTool } from "./delete-project.js";
    export { deleteSubtaskTool } from "./delete-subtask.js";
    export { deleteSwimlaneTool } from "./delete-swimlane.js";
    export { deleteTaskTool } from "./delete-task.js";
    export { deleteTaskFileTool } from "./delete-task-file.js";
    export { getProjectTool } from "./get-project.js";
    export { getTaskTool } from "./get-task.js";
    export { listCategoriesTool } from "./list-categories.js";
    export { listColumnsTool } from "./list-columns.js";
    export { listMyTasksTool } from "./list-my-tasks.js";
    export { listOverdueTasksTool } from "./list-overdue-tasks.js";
    export { listProjectsTool } from "./list-projects.js";
    export { listSubtasksTool } from "./list-subtasks.js";
    export { listSwimlanesTool } from "./list-swimlanes.js";
    export { listTasksTool } from "./list-tasks.js";
    export { listProjectUsersTool } from "./list-project-users.js";
    export { moveColumnTool } from "./move-column.js";
    export { moveSwimlaneTool } from "./move-swimlane.js";
    export { moveTaskPositionTool } from "./move-task-position.js";
    export { removeProjectUserTool } from "./remove-project-user.js";
    export { updateColumnTool } from "./update-column.js";
    export { updateCommentTool } from "./update-comment.js";
    export { updateProjectTool } from "./update-project.js";
    export { updateSubtaskTool } from "./update-subtask.js";
    export { updateSwimlaneTool } from "./update-swimlane.js";
    export { updateTaskTool } from "./update-task.js";
    
    // ---------------------------------------------------------------------------
    // Shared deps interface — used by transports to wire everything together
    // ---------------------------------------------------------------------------
    
    /**
     * Runtime dependencies required by every tool handler.
     *
     * `logger` is optional; tools that need logging should accept it defensively.
     */
    export interface ToolDeps {
      handler: KanboardHandler;
      resolvers: Resolvers;
      logger?: pino.Logger;
    }
    
    // ---------------------------------------------------------------------------
    // ToolDef — canonical shape of every tool object in this project
    // ---------------------------------------------------------------------------
    
    /**
     * Canonical shape every tool object exported from `src/tools/<name>.ts` must
     * conform to. The `handler` signature uses `unknown` for the result so that
     * the registration loop is agnostic to each tool's concrete return type — the
     * MCP SDK handles serialisation.
     */
    export interface ToolDef {
      name: string;
      description: string;
      inputSchema: ZodTypeAny;
      handler: (raw: unknown, deps: ToolDeps) => Promise<unknown>;
    }
    
    // ---------------------------------------------------------------------------
    // allTools — ordered registry
    // ---------------------------------------------------------------------------
    
    /**
     * All 37 Kanboard MCP tools in alphabetical order.
     *
     * Order is fixed so that any slice/comparison in tests and transports is
     * deterministic across environments.
     */
    export const allTools: readonly ToolDef[] = [
      addProjectUserTool,
      attachFileToTaskTool,
      createColumnTool,
      createCommentTool,
      createProjectTool,
      createSubtaskTool,
      createSwimlaneTool,
      createTaskTool,
      createTasksBatchTool,
      deleteColumnTool,
      deleteCommentTool,
      deleteProjectTool,
      deleteSubtaskTool,
      deleteSwimlaneTool,
      deleteTaskTool,
      deleteTaskFileTool,
      getProjectTool,
      getTaskTool,
      listCategoriesTool,
      listColumnsTool,
      listMyTasksTool,
      listOverdueTasksTool,
      listProjectsTool,
      listSubtasksTool,
      listSwimlanesTool,
      listTasksTool,
      listProjectUsersTool,
      moveColumnTool,
      moveSwimlaneTool,
      moveTaskPositionTool,
      removeProjectUserTool,
      updateColumnTool,
      updateCommentTool,
      updateProjectTool,
      updateSubtaskTool,
      updateSwimlaneTool,
      updateTaskTool,
    ] as const;
    
    // ---------------------------------------------------------------------------
    // registerTools — mount all tools on the MCP server
    // ---------------------------------------------------------------------------
    
    /**
     * Register all Kanboard tools on a given `McpServer` instance.
     *
     * Each tool is attached via `server.registerTool(name, config, callback)`.
     * The SDK validates incoming input against the tool's Zod `inputSchema`
     * before the callback is invoked, so the tool handler receives already-parsed
     * args — but we pass the raw record through `tool.handler(args, deps)` which
     * re-validates internally for belt-and-suspenders safety.
     *
     * @param server - The `McpServer` instance to register tools on.
     * @param deps   - Shared tool dependencies (handler, resolvers, optional logger).
     */
    export function registerTools(server: McpServer, deps: ToolDeps): void {
      for (const tool of allTools) {
        // Cast: each tool handler returns a `{ content, structuredContent }` object
        // that satisfies `CallToolResult`. We use `unknown` in `ToolDef.handler` to
        // keep the per-tool return types encapsulated, so we cast here at the
        // registration boundary where the MCP SDK takes ownership.
        const cb = ((args: Record<string, unknown>) =>
          tool.handler(args, deps)) as unknown as ToolCallback;
    
        server.registerTool(
          tool.name,
          {
            description: tool.description,
            inputSchema: tool.inputSchema,
          },
          cb,
        );
      }
    }
  • assertConfirmed helper used by the tool handler to enforce confirm: true before performing the destructive delete.
    export function assertConfirmed(toolName: string, confirm: boolean): void {
      // Strict identity check via Object.is rather than `!== true`:
      // - keeps the lint rule happy (no boolean-literal compare)
      // - still rejects ANY non-`true` value, including 1, "true", undefined.
      if (!Object.is(confirm, true)) {
        throw new ValidationError(
          toolName,
          `${toolName}: this is a destructive operation — pass confirm: true to proceed.`,
        );
      }
    }
Behavior5/5

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

With no annotations, the description fully carries the burden, disclosing that the operation is permanent and requires explicit confirmation. It also specifies the return value, ensuring the agent knows what to expect.

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 two sentences, front-loading the purpose and then adding essential usage and return details. Every sentence is meaningful and there is no unnecessary text.

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?

Given the simplicity of the tool (two parameters, no output schema, no nested objects), the description adequately covers purpose, behavior, confirm requirement, and return value. It is complete for the agent to use correctly.

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

Parameters4/5

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

The input schema has 100% coverage with descriptions for both parameters. The description adds value by emphasizing the confirm parameter's requirement to be exactly true and by stating the return format, which is not in 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 states 'Permanently delete a file attachment from a Kanboard task' with a specific verb and resource, clearly distinguishing it from sibling tools like delete_task which deletes the entire task.

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

Usage Guidelines4/5

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

The description explicitly notes 'DESTRUCTIVE — requires explicit `confirm: true`', providing clear guidance on how to use the tool safely. However, it does not mention alternatives or when not to use it, though the condition is well-stated.

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/ErnestoCorona/kanboard-mcp'

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