list_attachments
Retrieve a paginated listing of file attachments from BookStack wiki, with options to sort results and control page size for efficient content management.
Instructions
Get a listing of attachments
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of items per page | |
| page | No | Page number for pagination | |
| sort | No | Sort parameter |
Implementation Reference
- src/tools/search-user-tools.ts:473-477 (handler)Handler logic for the list_attachments tool: parses pagination arguments, calls BookStackClient.getAttachments, and returns formatted paginated response.case "list_attachments": { const params = PaginationSchema.parse(args); const result = await client.getAttachments(params); return formatApiResponse(result.data, result.total); }
- Input schema definition for the list_attachments tool, defining optional pagination parameters (page, count, sort).{ name: "list_attachments", description: "Get a listing of attachments", 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" }, }, }, },
- src/index.ts:56-59 (registration)Registers list_attachments tool by including createSearchAndUserTools output in the complete MCP tools list provided to the server.const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];
- src/index.ts:62-66 (registration)MCP server request handler for listing tools, which exposes the registered tools including list_attachments.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });
- src/index.ts:124-130 (registration)Dispatches tool calls matching searchUserToolNames (including list_attachments) to the handleSearchAndUserTool function.if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else { throw new Error(`Unknown tool: ${name}`); }