estimate_uncertainty
Calculate Bayesian uncertainty for tags using historical feedback data to assess reliability and confidence levels in memory retrieval systems.
Instructions
Estimate Bayesian uncertainty for a set of tags based on past feedback.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Tags to analyze for uncertainty |
Implementation Reference
- adapters/mcp/server-stdio.js:283-307 (handler)The handler function that executes the estimate_uncertainty tool logic.
function buildEstimateUncertaintyResponse(args = {}) { const tags = Array.isArray(args.tags) ? args.tags.map(String) : []; const { MEMORY_LOG_PATH } = getFeedbackPaths(); const memories = readJSONL(MEMORY_LOG_PATH); const matching = memories.filter((entry) => { if (!tags.length) return Boolean(entry && entry.bayesian); const entryTags = Array.isArray(entry && entry.tags) ? entry.tags : []; return entry && entry.bayesian && entryTags.some((tag) => tags.includes(tag)); }); const uncertainties = matching .map((entry) => Number(entry.bayesian && entry.bayesian.uncertainty)) .filter((value) => Number.isFinite(value)); const averageUncertainty = uncertainties.length > 0 ? Number((uncertainties.reduce((sum, value) => sum + value, 0) / uncertainties.length).toFixed(4)) : 0; return toTextResult({ tags, matches: matching.length, averageUncertainty, minUncertainty: uncertainties.length > 0 ? Math.min(...uncertainties) : 0, maxUncertainty: uncertainties.length > 0 ? Math.max(...uncertainties) : 0, }); } - scripts/tool-registry.js:458-466 (registration)Registration of the estimate_uncertainty tool in the registry.
readOnlyTool({ name: 'estimate_uncertainty', description: 'Estimate Bayesian uncertainty for a set of tags based on past feedback.', inputSchema: { type: 'object', properties: { tags: { type: 'array', items: { type: 'string' }, description: 'Tags to analyze for uncertainty' }, }, },