Skip to main content
Glama

value.detect

Identify up to 3 value betting opportunities by comparing market odds to fair value odds with a minimum 5% edge.

Instructions

Confronta quote mercato vs fair per trovare fino a 3 value pick (edge >= 5%).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
match_idYesFixture id

Implementation Reference

  • Core handler function that detects value picks by comparing best market odds to computed fair odds, filtering for edge >= 5% and odds >= 1.5, sorting and taking top 3.
    export const detectValue = async (matchId: number): Promise<ValueDetectionResult> => {
      const snapshot = await buildMatchSnapshot(matchId);
      const fair = computeFairOddsFromSnapshot(snapshot);
      const odds = await oddsApi.getMarketOddsForFixture(snapshot.match);
    
      const picks: ValuePick[] = odds
        .map((market) => {
          if (!market.bookmakers.length) return undefined;
          const bestBook = market.bookmakers.reduce((best, current) =>
            current.oddsDecimal > best.oddsDecimal ? current : best,
          );
          const fairOdds = fair.fairOdds[market.selection];
          const edge = bestBook.oddsDecimal / fairOdds - 1;
          if (edge < EDGE_THRESHOLD || bestBook.oddsDecimal < MIN_ODDS) return undefined;
          return {
            market: market.market,
            selection: market.selection,
            bookmaker: bestBook.book,
            offeredOdds: Number(bestBook.oddsDecimal.toFixed(3)),
            fairOdds,
            edge: Number(edge.toFixed(3)),
            rationale: buildRationale(snapshot.home.form, snapshot.away.form, fair.lambdaHome, fair.lambdaAway, market.selection),
          } satisfies ValuePick;
        })
        .filter(Boolean)
        .sort((a, b) => (b!.edge - a!.edge))
        .slice(0, 3) as ValuePick[];
    
      return {
        matchId,
        picks,
        fair,
        odds,
      };
    };
  • Registers the 'value.detect' tool with FastMCP server, including name, description, input schema, and execute wrapper calling detectValue.
    export const registerValueTool = (server: FastMCP) => {
      server.addTool({
        name: "value.detect",
        description: "Confronta quote mercato vs fair per trovare fino a 3 value pick (edge >= 5%).",
        parameters: z.object({
          match_id: z.number().describe("Fixture id"),
        }),
        execute: async (args) => {
          const payload = await detectValue(args.match_id);
          return JSON.stringify(payload, null, 2);
        },
      });
    };
  • Zod schema defining the input parameter 'match_id' as a number.
    parameters: z.object({
      match_id: z.number().describe("Fixture id"),
    }),
  • Helper function to generate rationale for value picks based on form and lambda values.
    const buildRationale = (
      homeForm: string | undefined,
      awayForm: string | undefined,
      lambdaHome: number,
      lambdaAway: number,
      selection: ValuePick["selection"],
    ): string => {
      const lambdaNote = `λ_home=${lambdaHome.toFixed(2)} λ_away=${lambdaAway.toFixed(2)}`;
      const homeNote = homeForm ? `home form ${homeForm}` : undefined;
      const awayNote = awayForm ? `away form ${awayForm}` : undefined;
      const formSnippet = [homeNote, awayNote].filter(Boolean).join(", ");
      return `${selection} boosted by ${lambdaNote}${formSnippet ? ` (${formSnippet})` : ""}`;
    };

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/Valerio357/bet-mcp'

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