get_section_content
Retrieve specific content sections from food standards documents to access preparation guidelines and service requirements.
Instructions
Get content from a specific section of the food standards document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | Yes | ||
| section_name | Yes | Name of the section to retrieve content from |
Implementation Reference
- src/index.js:389-407 (handler)The core handler function that implements the get_section_content tool logic: retrieves content from the specified section using the PDF parser, handles errors, and formats the response as MCP content.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 schema defining the input parameters for the get_section_content tool: section_name (required string) and limit (optional number, default 1000).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:187-190 (registration)Tool registration in the list_tools response: defines name, description, and converts Zod schema to JSON schema for MCP protocol.name: "get_section_content", description: "Get content from a specific section of the food standards document", inputSchema: zodToJsonSchema(getSectionContentSchema) },
- src/index.js:236-239 (handler)Dispatch handler in the main CallToolRequestSchema switch statement that validates input with the schema and invokes the getSectionContent function.case "get_section_content": { const { section_name, limit } = getSectionContentSchema.parse(args); return await getSectionContent(section_name, limit); }
- src/tools.js:325-343 (handler)Alternative class-based handler method in GoodbookTools class with identical logic, possibly for a different usage or refactored version.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}` }] }; }