get_food_safety_info
Retrieve food safety guidelines and hygiene standards for specific topics like temperature control, storage practices, and sanitation procedures.
Instructions
Get food safety information and hygiene standards
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | Specific food safety topic (temperature, storage, hygiene, etc.) |
Implementation Reference
- src/index.js:409-453 (handler)The core handler function that executes the get_food_safety_info tool. It generates safety-related search terms based on the input topic, searches the PDF content via pdfParser, removes duplicates, and returns formatted results.async function getFoodSafetyInfo(topic) { const safetyTerms = [ topic, `безопасность ${topic}`, `гигиена ${topic}`, `санитария ${topic}`, `температура ${topic}`, `хранение ${topic}`, `safety ${topic}`, `hygiene ${topic}`, `sanitation ${topic}`, `temperature ${topic}`, `storage ${topic}` ]; let allResults = []; for (const term of safetyTerms) { const results = pdfParser.searchContent(term); if (results.results) { allResults.push(...results.results); } } const uniqueResults = allResults.filter((result, index, self) => index === self.findIndex(r => r.content === result.content) ); let response = `Food safety information for "${topic}":\n\n`; if (uniqueResults.length === 0) { response += "No specific food safety information found for this topic."; } else { uniqueResults.slice(0, 8).forEach((result, index) => { response += `Safety guideline ${index + 1}:\n`; response += `${result.content}\n\n`; }); } return { content: [{ type: "text", text: response }] }; }
- src/index.js:107-109 (schema)Zod schema used for input validation of the tool's 'topic' parameter.const getFoodSafetyInfoSchema = z.object({ topic: z.string().describe("Specific food safety topic (temperature, storage, hygiene, etc.)"), });
- src/index.js:191-195 (registration)Registration of the tool in the MCP server's toolDefinitions array, including name, description, and derived JSON input schema.{ name: "get_food_safety_info", description: "Get food safety information and hygiene standards", inputSchema: zodToJsonSchema(getFoodSafetyInfoSchema) },
- src/tools.js:345-389 (handler)Alternative class method implementation of the handler in GoodbookTools class, identical logic to the index.js version.async getFoodSafetyInfo(topic) { const safetyTerms = [ topic, `безопасность ${topic}`, `гигиена ${topic}`, `санитария ${topic}`, `температура ${topic}`, `хранение ${topic}`, `safety ${topic}`, `hygiene ${topic}`, `sanitation ${topic}`, `temperature ${topic}`, `storage ${topic}` ]; let allResults = []; for (const term of safetyTerms) { const results = this.pdfParser.searchContent(term); if (results.results) { allResults.push(...results.results); } } const uniqueResults = allResults.filter((result, index, self) => index === self.findIndex(r => r.content === result.content) ); let response = `Food safety information for "${topic}":\n\n`; if (uniqueResults.length === 0) { response += "No specific food safety information found for this topic."; } else { uniqueResults.slice(0, 8).forEach((result, index) => { response += `Safety guideline ${index + 1}:\n`; response += `${result.content}\n\n`; }); } return { content: [{ type: "text", text: response }] }; }
- src/tools.js:82-95 (registration)Inline JSON schema and registration in the getToolDefinitions() method of GoodbookTools class.{ name: "get_food_safety_info", description: "Get food safety information and hygiene standards", inputSchema: { type: "object", properties: { topic: { type: "string", description: "Specific food safety topic (temperature, storage, hygiene, etc.)" } }, required: ["topic"] } },