feedback
Report whether a recommended tool worked to improve future recommendations. Provide your outcome and optional comment after trying a tool from search results.
Instructions
Report whether a recommended tool worked or not. This closes the learning loop — the Unfragile graph uses this feedback to improve future recommendations. Call this after trying a tool from search results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| matchRecordId | Yes | Match record ID from search results (shown at the bottom of search output) | |
| outcome | Yes | Did the recommended tool work for your use case? | |
| comment | No | Optional: brief note on why it worked or didn't |
Implementation Reference
- src/index.ts:712-718 (registration)Registration of the 'feedback' tool with the MCP server, including schema (zod validation for matchRecordId, outcome, comment) and description.
server.tool( "feedback", "Report whether a recommended tool worked or not. This closes the learning loop — the Unfragile graph uses this feedback to improve future recommendations. Call this after trying a tool from search results.", { matchRecordId: z.string().min(1).describe("Match record ID from search results (shown at the bottom of search output)"), outcome: z.enum(["success", "failure"]).describe("Did the recommended tool work for your use case?"), comment: z.string().max(500).optional().describe("Optional: brief note on why it worked or didn't"), - src/index.ts:720-763 (handler)Handler function for the 'feedback' tool. Sends a POST request to the Unfragile API at /api/feedback with matchRecordId, outcome, clickedThrough, source, and optional comment. Returns a success or error message.
async ({ matchRecordId, outcome, comment }) => { log("feedback", `${matchRecordId} → ${outcome}`); try { const headers: Record<string, string> = { "Content-Type": "application/json" }; if (API_KEY) headers["X-API-Key"] = API_KEY; const body: Record<string, unknown> = { matchRecordId, outcome: outcome === "success" ? "success" : "failure", clickedThrough: true, source: SOURCE, }; if (comment) body.comment = comment; const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 10_000); try { const res = await fetch(`${API_BASE}/api/feedback`, { method: "POST", headers, body: JSON.stringify(body), signal: controller.signal, }); if (!res.ok) { const text = await res.text(); throw new Error(`Feedback API error ${res.status}: ${text}`); } } finally { clearTimeout(timeout); } return { content: [{ type: "text" as const, text: `Feedback recorded: ${outcome}. The Unfragile graph will use this to improve future recommendations. Thank you!`, }], }; } catch (err) { return { content: [{ type: "text" as const, text: `Error sending feedback: ${err instanceof Error ? err.message : String(err)}` }], isError: true }; } } ); - src/index.ts:715-719 (schema)Input schema for the feedback tool: matchRecordId (string), outcome (enum: success/failure), comment (optional string, max 500 chars).
{ matchRecordId: z.string().min(1).describe("Match record ID from search results (shown at the bottom of search output)"), outcome: z.enum(["success", "failure"]).describe("Did the recommended tool work for your use case?"), comment: z.string().max(500).optional().describe("Optional: brief note on why it worked or didn't"), },