list_sections
Retrieve all available sections from food service standards documents to quickly navigate preparation guidelines and compliance requirements.
Instructions
List all available sections in the food service standards document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:371-387 (handler)Primary handler function implementing the list_sections MCP tool. Fetches sections using PDFParser.getSections() and formats a detailed text response listing all available sections with previews.async function listSections() { const sections = pdfParser.getSections(); let response = "Available sections in the food standards document:\n\n"; sections.forEach((section, index) => { response += `${index + 1}. ${section.name}\n`; response += ` Content length: ${section.contentLength} items\n`; response += ` Preview: ${section.preview}\n\n`; }); return { content: [{ type: "text", text: response }] }; }
- src/tools.js:307-323 (handler)Secondary handler function in GoodbookTools class implementing identical list_sections logic.async listSections() { const sections = this.pdfParser.getSections(); let response = "Available sections in the food standards document:\n\n"; sections.forEach((section, index) => { response += `${index + 1}. ${section.name}\n`; response += ` Content length: ${section.contentLength} items\n`; response += ` Preview: ${section.preview}\n\n`; }); return { content: [{ type: "text", text: response }] }; }
- src/pdf-parser.js:172-178 (helper)Core helper method that generates the list of sections from parsed PDF content, providing name, length, and preview for each section.getSections() { return Object.keys(this.sections).map(name => ({ name, contentLength: this.sections[name].length, preview: this.sections[name].slice(0, 3).join(' ').substring(0, 200) + '...' })); }
- src/index.js:178-184 (schema)JSON schema definition for the list_sections tool, specifying no input parameters are required.name: "list_sections", description: "List all available sections in the food service standards document", inputSchema: { type: "object", properties: {}, required: [] }
- src/index.js:204-210 (registration)Registration handler for list_tools MCP request, which returns the toolDefinitions array including list_sections.server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("Received list_tools request"); await ensureInitialized(); return { tools: toolDefinitions }; });