Skip to main content
Glama

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
NameRequiredDescriptionDefault
tagsNoTags to analyze for uncertainty

Implementation Reference

  • 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,
      });
    }
  • 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' },
        },
      },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IgorGanapolsky/mcp-memory-gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server