get_section_content
Retrieve specific food standards and preparation guidelines from PDF documents by section name, enabling targeted access to regulatory content.
Instructions
Get content from a specific section of the food standards document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| section_name | Yes | Name of the section to retrieve content from | |
| limit | Yes |
Implementation Reference
- src/index.js:389-407 (handler)The handler function that executes the get_section_content tool. It calls the PDF parser's getContent method and formats the response as MCP content blocks.async function getSectionContent(section_name, limit) { const content = pdfParser.getContent(section_name, limit); if (content.error) { return { content: [{ type: "text", text: `Error: ${content.error}` }] }; } return { content: [{ type: "text", text: `Content from section "${content.section}":\n\n${content.content}` }] }; }
- src/index.js:102-105 (schema)Zod input schema validation for the get_section_content tool parameters.const getSectionContentSchema = z.object({ section_name: z.string().describe("Name of the section to retrieve content from"), limit: z.number().default(1000).describe("Maximum number of characters to return"), });
- src/index.js:186-190 (registration)Tool registration in the MCP server's tool definitions array, including name, description, and input schema.{ name: "get_section_content", description: "Get content from a specific section of the food standards document", inputSchema: zodToJsonSchema(getSectionContentSchema) },
- src/pdf-parser.js:180-200 (helper)Core helper method in PDFParser class that retrieves the actual content from a named section or all content, limiting by character count.getContent(sectionName = null, limit = 1000) { if (!this.parsedContent) { return { error: 'PDF content not loaded' }; } if (sectionName) { const section = this.sections[sectionName]; if (!section) { return { error: `Section '${sectionName}' not found` }; } return { section: sectionName, content: section.join('\n').substring(0, limit) }; } return { section: 'all', content: this.parsedContent.substring(0, limit) }; }
- src/tools.js:325-343 (handler)Alternative class-based handler for get_section_content tool in GoodbookTools class, similar logic delegating to PDF parser.async getSectionContent(sectionName, limit = 1000) { const content = this.pdfParser.getContent(sectionName, limit); if (content.error) { return { content: [{ type: "text", text: `Error: ${content.error}` }] }; } return { content: [{ type: "text", text: `Content from section "${content.section}":\n\n${content.content}` }] }; }