Decide restaurant fit
compass_decide_fitEvaluate whether a restaurant fits a user's dietary profile. Returns fit, not fit, or unknown with reason codes, evidence, and user-friendly wording.
Instructions
Conservative fit decision for a restaurant against a user dietary profile. Returns "fit", "not_fit", or "unknown" with reason codes, evidence, and user wording. Returns "unknown" rather than overclaiming.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| compass_id | Yes | Compass restaurant ID, obtained from compass_search or compass_enrich_restaurant | |
| user_profile | Yes | Required dietary profile for the restaurant fit decision | |
| mode | No | Response detail mode; rich includes fuller evidence and reasoning | rich |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| compass_id | Yes | Stable Compass restaurant ID | |
| decision | Yes | Conservative decision for the submitted profile | |
| confidence | Yes | Decision confidence | |
| reason_codes | Yes | Compass public reason codes explaining the decision | |
| evidence | Yes | Evidence supporting the decision | |
| source_freshness | No | Age and refresh guidance for the evidence behind a result | |
| risk_flags | No | Risk flags that should be surfaced to the user | |
| recommended_user_text | No | Conservative user-facing wording | |
| verification_required | No | True when the user should verify with the restaurant before relying on the result | |
| last_evaluated_at | No | When Compass last evaluated this restaurant for decision freshness |
Implementation Reference
- src/tools/decide-fit.ts:1-32 (handler)Defines the decideFitTool object with the handler function that parses input via DecideFitInputSchema, calls client.decideFit(), and returns a ToolResult via handleTool.
import type { CompassClient } from "../client.js"; import { DecideFitInputSchema, type DecideFitInput, decideFitInputJsonSchema, } from "../schemas/input.js"; import { decideFitOutputJsonSchema } from "../schemas/output.js"; import { handleTool, readOnlyToolAnnotations, type ToolDefinition, type ToolResult } from "./types.js"; export interface DecideFitClient { decideFit(body: unknown, options?: { mode?: "fast" | "rich" }): Promise<unknown>; } export const decideFitTool = { definition: { name: "compass_decide_fit", title: "Decide restaurant fit", description: 'Conservative fit decision for a restaurant against a user dietary profile. Returns "fit", "not_fit", or "unknown" with reason codes, evidence, and user wording. Returns "unknown" rather than overclaiming.', inputSchema: decideFitInputJsonSchema, outputSchema: decideFitOutputJsonSchema, annotations: readOnlyToolAnnotations("Decide restaurant fit"), } satisfies ToolDefinition, handler(client: CompassClient | DecideFitClient, args: unknown): Promise<ToolResult> { return handleTool<DecideFitInput>( () => DecideFitInputSchema.parse(args), ({ mode, ...body }) => client.decideFit(body, { mode }), ); }, }; - src/schemas/input.ts:95-104 (schema)Zod schema DecideFitInputSchema: validates input with compass_id, user_profile (diet, allergens, exclude_cross_contamination, dietary_rules), and mode.
export const DecideFitInputSchema = z .object({ compass_id: BoundedTextSchema.describe("Compass restaurant ID, obtained from compass_search or compass_enrich_restaurant"), user_profile: UserProfileSchema.extend({ diet: DietSchema, exclude_cross_contamination: z.boolean().default(true), }).strict(), mode: ModeSchema, }) .strict(); - src/schemas/input.ts:214-262 (schema)JSON schema decideFitInputJsonSchema: the structured JSON input schema used by the MCP tool definition for compass_decide_fit.
export const decideFitInputJsonSchema = { type: "object", properties: { compass_id: { type: "string", minLength: 1, description: "Compass restaurant ID, obtained from compass_search or compass_enrich_restaurant", }, user_profile: { type: "object", description: "Required dietary profile for the restaurant fit decision", properties: { diet: { type: "string", enum: COMPASS_DIETS, description: "Preference input. Safety-sensitive and religious-diet values are conservative signals, not public certification/free-from restaurant facts.", }, allergens: { type: "array", description: "Allergens or ingredients the user wants to avoid; handled conservatively as user preferences", items: { type: "string", minLength: 1, maxLength: PROFILE_ITEM_MAX }, maxItems: PROFILE_LIST_MAX, }, exclude_cross_contamination: { type: "boolean", default: true, description: "When true, treat unknown or shared-prep cross-contamination evidence conservatively", }, dietary_rules: { type: "array", description: "Additional short user dietary rules or avoidances", items: { type: "string", minLength: 1, maxLength: PROFILE_ITEM_MAX }, maxItems: PROFILE_LIST_MAX, }, }, required: ["diet"], additionalProperties: false, }, mode: { type: "string", enum: ["fast", "rich"], default: "rich", description: "Response detail mode; rich includes fuller evidence and reasoning", }, }, required: ["compass_id", "user_profile"], additionalProperties: false, } as const; - src/schemas/output.ts:267-302 (schema)JSON schema decideFitOutputJsonSchema: defines the output shape for the compass_decide_fit tool (compass_id, decision, confidence, reason_codes, evidence, etc.).
export const decideFitOutputJsonSchema = { type: "object", description: "Compass conservative restaurant dietary fit decision", properties: { compass_id: { type: "string", description: "Stable Compass restaurant ID" }, decision: { type: "string", enum: COMPASS_DECISIONS, description: "Conservative decision for the submitted profile", }, confidence: { type: "string", enum: COMPASS_CONFIDENCES, description: "Decision confidence" }, reason_codes: { type: "array", description: "Compass public reason codes explaining the decision", items: { type: "string" }, }, evidence: { type: "array", description: "Evidence supporting the decision", items: evidenceJsonSchema }, source_freshness: sourceFreshnessJsonSchema, risk_flags: { type: "array", description: "Risk flags that should be surfaced to the user", items: { type: "string", enum: COMPASS_RISK_FLAGS }, }, recommended_user_text: { type: "string", description: "Conservative user-facing wording" }, verification_required: { type: "boolean", description: "True when the user should verify with the restaurant before relying on the result", }, last_evaluated_at: { type: ["string", "null"], description: "When Compass last evaluated this restaurant for decision freshness", }, }, required: ["compass_id", "decision", "confidence", "reason_codes", "evidence"], additionalProperties: true, } as const; - src/index.ts:48-49 (registration)Registers the compass_decide_fit tool in the MCP server's CallToolRequestSchema handler, routing calls to decideFitTool.handler(client, args).
case "compass_decide_fit": return decideFitTool.handler(client, request.params.arguments);