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)Core handler function that generates multiple safety-related search terms from the input 'topic', queries the PDF parser, removes duplicate results, and constructs a formatted text response with up to 8 relevant excerpts.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 input validation schema requiring a 'topic' string parameter with description.const getFoodSafetyInfoSchema = z.object({ topic: z.string().describe("Specific food safety topic (temperature, storage, hygiene, etc.)"), });
- src/index.js:191-195 (registration)Tool metadata registration in the list of tool definitions, including name, description, and JSON schema derived from Zod schema.{ name: "get_food_safety_info", description: "Get food safety information and hygiene standards", inputSchema: zodToJsonSchema(getFoodSafetyInfoSchema) },
- src/index.js:241-244 (registration)Dispatch logic in the CallToolRequestSchema handler that parses arguments using the schema and invokes the tool handler.case "get_food_safety_info": { const { topic } = getFoodSafetyInfoSchema.parse(args); return await getFoodSafetyInfo(topic); }