odds.prematch
Retrieve pre-match odds for football fixtures including 1X2, Over/Under 2.5, and BTTS from multiple bookmakers using match IDs.
Instructions
Quote pre-match (1X2, Over/Under 2.5, BTTS) normalizzate con lista bookmaker.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| match_id | Yes | Fixture id di API-Football |
Implementation Reference
- src/tools/odds.ts:12-26 (handler)The main handler function for the 'odds.prematch' tool. It fetches the fixture using apiFootball and retrieves normalized pre-match odds (1X2, Over/Under 2.5, BTTS) from oddsApi for the given match_id.execute: async (args) => { const fixture = await apiFootball.getFixture(args.match_id); if (!fixture) { throw new Error(`Fixture ${args.match_id} non trovata`); } const odds = await oddsApi.getMarketOddsForFixture(fixture); return JSON.stringify( { match: fixture, markets: odds, }, null, 2, ); },
- src/tools/odds.ts:9-11 (schema)Zod schema defining the input parameters for the tool: a required numeric match_id (fixture ID from API-Football).parameters: z.object({ match_id: z.number().describe("Fixture id di API-Football"), }),
- src/tools/odds.ts:6-27 (registration)Registration of the 'odds.prematch' tool within the registerOddsTool function using server.addTool.server.addTool({ name: "odds.prematch", description: "Quote pre-match (1X2, Over/Under 2.5, BTTS) normalizzate con lista bookmaker.", parameters: z.object({ match_id: z.number().describe("Fixture id di API-Football"), }), execute: async (args) => { const fixture = await apiFootball.getFixture(args.match_id); if (!fixture) { throw new Error(`Fixture ${args.match_id} non trovata`); } const odds = await oddsApi.getMarketOddsForFixture(fixture); return JSON.stringify( { match: fixture, markets: odds, }, null, 2, ); }, });
- src/index.ts:18-18 (registration)Invocation of registerOddsTool to add the odds.prematch tool to the main MCP server.registerOddsTool(server);