list_images
Retrieve a paginated list of images from the BookStack gallery, with options to filter by image type and sort results.
Instructions
Get a listing of images in the gallery
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| count | No | Number of items per page | |
| sort | No | Sort parameter | |
| filter_type | No | Filter images by type |
Implementation Reference
- src/tools/search-user-tools.ts:492-503 (handler)Handler logic for the 'list_images' tool: destructures args, parses pagination params, calls BookStackClient.getImageGallery, and formats the API response.case "list_images": { const { filter_type, ...paginationArgs } = args; const params = PaginationSchema.parse(paginationArgs); const allParams = { ...params, filter_type, }; const result = await client.getImageGallery(params); return formatApiResponse(result.data, result.total); }
- MCP Tool definition for 'list_images', including name, description, and input JSON schema with pagination and optional filter_type.name: "list_images", description: "Get a listing of images in the gallery", inputSchema: { type: "object", properties: { page: { type: "number", description: "Page number for pagination" }, count: { type: "number", description: "Number of items per page" }, sort: { type: "string", description: "Sort parameter" }, filter_type: { type: "string", enum: ["gallery", "drawio"], description: "Filter images by type", }, }, }, },
- src/index.ts:118-128 (registration)Registers 'list_images' in the searchUserToolNames array for dispatching tool calls to handleSearchAndUserTool."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:62-66 (registration)Registers all tools (including 'list_images' via createSearchAndUserTools) for the MCP ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });
- src/lib/bookstack-client.ts:365-369 (helper)BookStackClient helper method that performs the actual API GET request to '/image-gallery' endpoint to list images.async getImageGallery( params?: PaginationParams ): Promise<ApiResponse<ImageGallery[]>> { return this.get<ImageGallery>("/image-gallery", params); }