Skip to main content
Glama

delete_attachment

Remove an attachment from a BookStack wiki by specifying its ID to manage content and maintain organized documentation.

Instructions

Delete an attachment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAttachment ID

Implementation Reference

  • Executes the 'delete_attachment' MCP tool: parses the attachment ID from input arguments, invokes the BookStack client's deleteAttachment method, and returns a success message.
    case "delete_attachment": {
      const id = parseInteger(args.id);
      await client.deleteAttachment(id);
      return `Attachment ${id} deleted successfully`;
    }
  • Tool schema definition specifying the name, description, and input schema (requiring a numeric 'id' for the attachment).
    {
      name: "delete_attachment",
      description: "Delete an attachment",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "number", description: "Attachment ID" },
        },
        required: ["id"],
      },
    },
  • BookStackClient helper method that performs the actual HTTP DELETE request to the BookStack API endpoint `/attachments/{id}`.
    async deleteAttachment(id: number): Promise<void> {
      return this.delete(`/attachments/${id}`);
    }
  • src/index.ts:102-128 (registration)
    Registers 'delete_attachment' in the searchUserToolNames array for dispatch routing to the appropriate handler (handleSearchAndUserTool) in the MCP server's CallToolRequestSchema handler.
    // Search and user tools
    const searchUserToolNames = [
      "search_all",
      "list_users",
      "get_user",
      "create_user",
      "update_user",
      "delete_user",
      "list_roles",
      "get_role",
      "create_role",
      "update_role",
      "delete_role",
      "list_attachments",
      "get_attachment",
      "delete_attachment",
      "list_images",
      "get_image",
      "update_image",
      "delete_image",
    ];
    
    if (contentToolNames.includes(name)) {
      result = await handleContentTool(name, args, bookStackClient);
    } else if (searchUserToolNames.includes(name)) {
      result = await handleSearchAndUserTool(name, args, bookStackClient);
    } else {
  • src/index.ts:56-66 (registration)
    Includes the 'delete_attachment' tool (via createSearchAndUserTools) in the allTools array advertised to MCP clients via ListToolsRequestSchema.
    const allTools: Tool[] = [
      ...createContentTools(bookStackClient),
      ...createSearchAndUserTools(bookStackClient),
    ];
    
    // List tools handler
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: allTools,
      };
    });

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/lautarobarba/bookstack_mcp_server'

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