@gotza02/sequential-thinking 2026.2.39 β†’ 2026.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +7 -4
  2. package/SYSTEM_INSTRUCTION.md +25 -50
  3. package/dist/tools/sports/core/base.d.ts +169 -0
  4. package/dist/tools/sports/core/base.js +289 -0
  5. package/dist/tools/sports/core/cache.d.ts +106 -0
  6. package/dist/tools/sports/core/cache.js +305 -0
  7. package/dist/tools/sports/core/constants.d.ts +179 -0
  8. package/dist/tools/sports/core/constants.js +149 -0
  9. package/dist/tools/sports/core/types.d.ts +379 -0
  10. package/dist/tools/sports/core/types.js +5 -0
  11. package/dist/tools/sports/index.d.ts +34 -0
  12. package/dist/tools/sports/index.js +50 -0
  13. package/dist/tools/sports/providers/api.d.ts +73 -0
  14. package/dist/tools/sports/providers/api.js +517 -0
  15. package/dist/tools/sports/providers/scraper.d.ts +66 -0
  16. package/dist/tools/sports/providers/scraper.js +186 -0
  17. package/dist/tools/sports/providers/search.d.ts +54 -0
  18. package/dist/tools/sports/providers/search.js +224 -0
  19. package/dist/tools/sports/tools/betting.d.ts +6 -0
  20. package/dist/tools/sports/tools/betting.js +251 -0
  21. package/dist/tools/sports/tools/league.d.ts +11 -0
  22. package/dist/tools/sports/tools/league.js +12 -0
  23. package/dist/tools/sports/tools/live.d.ts +9 -0
  24. package/dist/tools/sports/tools/live.js +235 -0
  25. package/dist/tools/sports/tools/match.d.ts +6 -0
  26. package/dist/tools/sports/tools/match.js +323 -0
  27. package/dist/tools/sports/tools/player.d.ts +6 -0
  28. package/dist/tools/sports/tools/player.js +152 -0
  29. package/dist/tools/sports/tools/team.d.ts +6 -0
  30. package/dist/tools/sports/tools/team.js +370 -0
  31. package/dist/tools/sports/utils/calculator.d.ts +69 -0
  32. package/dist/tools/sports/utils/calculator.js +156 -0
  33. package/dist/tools/sports/utils/formatter.d.ts +57 -0
  34. package/dist/tools/sports/utils/formatter.js +206 -0
  35. package/dist/tools/sports.d.ts +7 -0
  36. package/dist/tools/sports.js +27 -6
  37. package/package.json +1 -1
  38. package/system_instruction.md +155 -0
@@ -0,0 +1,206 @@
1
+ /**
2
+ * SPORTS MODULE UTILS - Formatter
3
+ * Output formatting utilities for sports data
4
+ */
5
+ import { MATCH_STATUS } from '../core/constants.js';
6
+ /**
7
+ * Format a match as markdown table row
8
+ */
9
+ export function formatMatchRow(match) {
10
+ const status = match.status === MATCH_STATUS.LIVE
11
+ ? `⚽ ${match.minute}'`
12
+ : match.status === MATCH_STATUS.FINISHED
13
+ ? 'FT'
14
+ : new Date(match.date).toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });
15
+ const homeScore = match.score?.home ?? '-';
16
+ const awayScore = match.score?.away ?? '-';
17
+ return `| ${status.padEnd(8)} | ${match.homeTeam.name.padEnd(20)} | ${homeScore} - ${awayScore} | ${match.awayTeam.name.padEnd(20)} |`;
18
+ }
19
+ /**
20
+ * Format standings as markdown table
21
+ */
22
+ export function formatStandingsTable(standings) {
23
+ const header = `| Pos | Team | P | W | D | L | GF | GA | GD | Pts |\n|-----|------|---|---|---|---|----|----|----|------|`;
24
+ const rows = standings.map(entry => {
25
+ const form = entry.form ? Array.isArray(entry.form) ? entry.form.join('') : entry.form : '';
26
+ return `| ${entry.position} | ${entry.team.name} | ${entry.played} | ${entry.won} | ${entry.drawn} | ${entry.lost} | ${entry.goalsFor} | ${entry.goalsAgainst} | ${entry.goalDifference} | ${entry.points || 0} |`;
27
+ });
28
+ return `${header}\n${rows.join('\n')}`;
29
+ }
30
+ /**
31
+ * Format player stats as markdown table
32
+ */
33
+ export function formatPlayerStats(stats, playerName) {
34
+ return `## ${playerName} - Season Stats
35
+
36
+ | Metric | Value |
37
+ |--------|-------|
38
+ | Matches | ${stats.matches} |
39
+ | Goals | ${stats.goals} |
40
+ | Assists | ${stats.assists} |
41
+ | Goals + Assists | ${stats.goals + stats.assists} |
42
+ | Minutes | ${stats.minutes} |
43
+ | xG | ${stats.xG?.toFixed(2) ?? 'N/A'} |
44
+ | xA | ${stats.xA?.toFixed(2) ?? 'N/A'} |
45
+ | Yellow Cards | ${stats.yellowCards} |
46
+ | Red Cards | ${stats.redCards} |
47
+ `;
48
+ }
49
+ /**
50
+ * Format comparison result as markdown
51
+ */
52
+ export function formatComparisonResult(result) {
53
+ let output = `# Team Comparison: ${result.teamA.name} vs ${result.teamB.name}\n\n`;
54
+ // Summary section
55
+ output += `## Summary\n\n${result.summary}\n\n`;
56
+ // Metrics table
57
+ output += `## Metrics\n\n`;
58
+ output += `| Metric | ${result.teamA.name} | ${result.teamB.name} | Advantage |\n`;
59
+ output += `|--------|------------------|------------------|------------|\n`;
60
+ for (const metric of result.metrics) {
61
+ const adv = metric.winner === 'A' ? result.teamA.name : metric.winner === 'B' ? result.teamB.name : 'Draw';
62
+ output += `| ${metric.name} | ${metric.teamAValue} | ${metric.teamBValue} | ${adv} |\n`;
63
+ }
64
+ // Winner declaration
65
+ if (result.winner) {
66
+ const winnerName = result.winner === 'A' ? result.teamA.name : result.teamB.name;
67
+ output += `\n## Verdict\n\n**Winner:** ${winnerName}\n`;
68
+ }
69
+ return output;
70
+ }
71
+ /**
72
+ * Format head to head record as markdown
73
+ */
74
+ export function formatHeadToHead(h2h) {
75
+ const homePct = (h2h.homeWins / h2h.totalMatches * 100).toFixed(1);
76
+ const drawPct = (h2h.draws / h2h.totalMatches * 100).toFixed(1);
77
+ const awayPct = (h2h.awayWins / h2h.totalMatches * 100).toFixed(1);
78
+ return `## Head to Head: ${h2h.homeTeam.name} vs ${h2h.awayTeam.name}
79
+
80
+ **Total Matches:** ${h2h.totalMatches}
81
+
82
+ | ${h2h.homeTeam.name} | Draw | ${h2h.awayTeam.name} |
83
+ |:----:|:----:|:----:|
84
+ | ${h2h.homeWins} (${homePct}%) | ${h2h.draws} (${drawPct}%) | ${h2h.awayWins} (${awayPct}%) |
85
+
86
+ **Goals:** ${h2h.homeGoals} - ${h2h.awayGoals}
87
+
88
+ ### Recent Matches
89
+
90
+ ${h2h.recentMatches.map(m => formatMatchRow(m)).join('\n')}
91
+ `;
92
+ }
93
+ /**
94
+ * Format match status for display
95
+ */
96
+ export function formatMatchStatus(status) {
97
+ switch (status) {
98
+ case MATCH_STATUS.LIVE:
99
+ return 'πŸ”΄ LIVE';
100
+ case MATCH_STATUS.FINISHED:
101
+ return 'βœ… FT';
102
+ case MATCH_STATUS.SCHEDULED:
103
+ return 'πŸ“… Scheduled';
104
+ case MATCH_STATUS.POSTPONED:
105
+ return '⏸️ Postponed';
106
+ case MATCH_STATUS.CANCELLED:
107
+ return '❌ Cancelled';
108
+ default:
109
+ return status;
110
+ }
111
+ }
112
+ /**
113
+ * Format score with context
114
+ */
115
+ export function formatScore(match) {
116
+ if (!match.score)
117
+ return 'v';
118
+ if (match.status === MATCH_STATUS.LIVE) {
119
+ return `${match.score.home} - ${match.score.away} (${match.minute}')`;
120
+ }
121
+ if (match.status === MATCH_STATUS.FINISHED) {
122
+ let result = `${match.score.home} - ${match.score.away}`;
123
+ if (match.score.halfTime) {
124
+ result += ` (HT: ${match.score.halfTime.home} - ${match.score.halfTime.away})`;
125
+ }
126
+ return result;
127
+ }
128
+ return 'v';
129
+ }
130
+ /**
131
+ * Format odds as decimal/fractional
132
+ */
133
+ export function formatOdds(decimalOdds) {
134
+ return decimalOdds.toFixed(2);
135
+ }
136
+ /**
137
+ * Format probability as percentage
138
+ */
139
+ export function formatProbability(probability) {
140
+ return `${(probability * 100).toFixed(1)}%`;
141
+ }
142
+ /**
143
+ * Format value bet recommendation
144
+ */
145
+ export function formatValueBet(match, odds, probability, value, confidence) {
146
+ const valuePct = (value * 100).toFixed(1);
147
+ const fairOdds = (1 / probability).toFixed(2);
148
+ const edge = ((odds - parseFloat(fairOdds)) / parseFloat(fairOdds) * 100).toFixed(1);
149
+ return `## Value Bet Opportunity
150
+
151
+ **Match:** ${match}
152
+ **Bet:** @${formatOdds(odds)}
153
+ **Fair Odds:** ${fairOdds}
154
+ **Value:** +${valuePct}%
155
+ **Edge:** +${edge}%
156
+ **Confidence:** ${confidence}%
157
+
158
+ ${value > 0.10 ? 'πŸ”₯ **HIGH VALUE**' : value > 0.05 ? 'βœ… **Value Bet**' : '⚠️ **Marginal Value**'}
159
+ `;
160
+ }
161
+ /**
162
+ * Format a list of matches as markdown table
163
+ */
164
+ export function formatMatchesTable(matches, title) {
165
+ if (matches.length === 0) {
166
+ return `## ${title}\n\nNo matches found.\n`;
167
+ }
168
+ const header = `| Time | Home | Score | Away |\n|------|------|-------:|------|`;
169
+ const rows = matches.map(m => {
170
+ const time = m.status === MATCH_STATUS.LIVE
171
+ ? `⚽ ${m.minute}'`
172
+ : m.status === MATCH_STATUS.FINISHED
173
+ ? 'FT'
174
+ : new Date(m.date).toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });
175
+ const score = m.score ? `${m.score.home} - ${m.score.away}` : 'v';
176
+ return `| ${time} | ${m.homeTeam.name} | ${score} | ${m.awayTeam.name} |`;
177
+ });
178
+ return `## ${title}\n\n${header}\n${rows.join('\n')}\n`;
179
+ }
180
+ /**
181
+ * Truncate text to max length with ellipsis
182
+ */
183
+ export function truncate(text, maxLength = 100) {
184
+ if (text.length <= maxLength)
185
+ return text;
186
+ return text.substring(0, maxLength - 3) + '...';
187
+ }
188
+ /**
189
+ * Format date relative to now
190
+ */
191
+ export function formatRelativeDate(date) {
192
+ const now = new Date();
193
+ const diffMs = date.getTime() - now.getTime();
194
+ const diffMins = Math.floor(diffMs / 60000);
195
+ const diffHours = Math.floor(diffMs / 3600000);
196
+ const diffDays = Math.floor(diffMs / 86400000);
197
+ if (diffMins < 0)
198
+ return 'Started';
199
+ if (diffMins < 60)
200
+ return `In ${diffMins} min`;
201
+ if (diffHours < 24)
202
+ return `In ${diffHours} hr`;
203
+ if (diffDays < 7)
204
+ return `In ${diffDays} days`;
205
+ return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
206
+ }
@@ -1,2 +1,9 @@
1
+ /**
2
+ * SPORTS MODULE - Main Registration
3
+ * Entry point for all sports tools
4
+ */
1
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ /**
7
+ * Register all sports tools with the MCP server
8
+ */
2
9
  export declare function registerSportsTools(server: McpServer): void;
@@ -1,8 +1,34 @@
1
+ /**
2
+ * SPORTS MODULE - Main Registration
3
+ * Entry point for all sports tools
4
+ */
5
+ // Import tool registrations
6
+ import { registerMatchTools } from "./sports/tools/match.js";
7
+ import { registerTeamTools } from "./sports/tools/team.js";
8
+ import { registerPlayerTools } from "./sports/tools/player.js";
9
+ import { registerBettingTools } from "./sports/tools/betting.js";
10
+ import { registerLiveTools } from "./sports/tools/live.js";
11
+ // Legacy support - keep original analyze_football_match
1
12
  import { z } from "zod";
2
13
  import { fetchWithRetry } from "../utils.js";
3
14
  import { scrapeWebpage } from "./web.js";
15
+ /**
16
+ * Register all sports tools with the MCP server
17
+ */
4
18
  export function registerSportsTools(server) {
5
- // 19. analyze_football_match
19
+ // Register new modular tools
20
+ registerMatchTools(server);
21
+ registerTeamTools(server);
22
+ registerPlayerTools(server);
23
+ registerBettingTools(server);
24
+ registerLiveTools(server);
25
+ // Keep original analyze_football_match for backward compatibility
26
+ registerLegacyAnalyzeMatch(server);
27
+ }
28
+ /**
29
+ * Legacy analyze_football_match tool (kept for backward compatibility)
30
+ */
31
+ function registerLegacyAnalyzeMatch(server) {
6
32
  server.tool("analyze_football_match", "Gather comprehensive data for a football (soccer) match to perform a detailed analysis. Fetches Head-to-Head, Recent Form, Team News, and Predictions from the web. It also performs a 'Deep Dive' on the best data source found.", {
7
33
  homeTeam: z.string().describe("Name of the home team"),
8
34
  awayTeam: z.string().describe("Name of the away team"),
@@ -36,15 +62,10 @@ export function registerSportsTools(server) {
36
62
  { type: 'Recent Form', query: `${homeTeam} ${awayTeam} recent form last 5 matches results${dateQuery}` },
37
63
  { type: 'Team News & Lineups', query: `${baseQuery} team news injuries suspensions predicted confirmed lineups${dateQuery}` },
38
64
  { type: 'Advanced Metrics', query: `${baseQuery} xG expected goals stats possession shots per game${dateQuery}` },
39
- // Combine Manager/Press with "Sack Race/Pressure" context
40
65
  { type: 'Manager & Atmosphere', query: `${homeTeam} ${awayTeam} manager quotes fan sentiment sack race pressure${dateQuery}` },
41
- // NEW: Market Intelligence
42
66
  { type: 'Market & Odds', query: `${baseQuery} odds movement dropping odds betting trends${dateQuery}` },
43
- // NEW: Environmental Factors
44
67
  { type: 'Ref & Weather', query: `${baseQuery} referee stats cards per game weather forecast stadium${dateQuery}` },
45
- // NEW: Fatigue & Schedule (Critical for late game performance)
46
68
  { type: 'Fatigue & Schedule', query: `${homeTeam} ${awayTeam} days rest fixture congestion travel distance${dateQuery}` },
47
- // NEW: Set Piece Analysis (Where 30% of goals come from)
48
69
  { type: 'Set Pieces', query: `${homeTeam} ${awayTeam} set piece goals scored conceded corners stats aerial duels${dateQuery}` }
49
70
  ];
50
71
  if (context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotza02/sequential-thinking",
3
- "version": "2026.2.39",
3
+ "version": "2026.2.41",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -0,0 +1,155 @@
1
+ # SYSTEM INSTRUCTION: UNIVERSAL MCP TOOLKIT (v6.0)
2
+
3
+ ## [IDENTITY]
4
+ You are an **AI Assistant with enhanced capabilities via MCP (Model Context Protocol)**. Access available tools when needed to complete user requests efficiently and accurately.
5
+
6
+ ---
7
+
8
+ ## πŸ› οΈ AVAILABLE MCP TOOLS (52 CAPABILITIES)
9
+
10
+ ### 🧠 Core Thinking (6 tools)
11
+ - `sequentialthinking` - Structured thinking with analysis/planning/execution/observation loop
12
+ - `start_thinking_block` - Start new thinking block for different topic
13
+ - `get_thinking_blocks` - Get summary of all thinking blocks
14
+ - `search_thoughts` - Search through thinking history
15
+ - `summarize_history` - Compress multiple thoughts into single summary
16
+ - `clear_thought_history` - Clear all thinking history
17
+
18
+ ### πŸ•ΈοΈ Project Knowledge Graph (5 tools)
19
+ - `build_project_graph` - Scan directory and build dependency graph
20
+ - `force_rebuild_graph` - Clear cache and rebuild graph from scratch
21
+ - `get_file_relationships` - Get dependencies and references for a file
22
+ - `get_project_graph_summary` - Get summary of project structure
23
+ - `get_project_graph_visualization` - Get Mermaid diagram of dependency graph
24
+
25
+ ### πŸ” Intelligence & Analysis (2 tools)
26
+ - `deep_code_analyze` - Generate Codebase Context Document for a file
27
+ - `search_code` - Search for text pattern in project files (supports regex)
28
+
29
+ ### ⚑ Action & Coding (7 tools)
30
+ - `deep_code_edit` - Apply surgical code edit based on analysis
31
+ - `read_file` - Read contents of a file
32
+ - `write_file` - Write content to a file (overwrites existing)
33
+ - `edit_file` - Replace specific string in a file
34
+ - `shell_execute` - Execute shell command (with safety checks)
35
+ - `list_directory` - List files and directories
36
+ - `file_exists` - Check if file or directory exists
37
+
38
+ ### πŸ’Ύ Persistent Memory & Knowledge (4 tools)
39
+ - `manage_notes` - Add/list/search/update/delete notes with priority & expiration
40
+ - `add_code_snippet` - Add useful code snippet to persistent database
41
+ - `search_code_db` - Search code database for snippets and patterns
42
+ - `learn_architecture_pattern` - Store architectural patterns
43
+
44
+ ### 🌐 Web & Research (3 tools)
45
+ - `web_search` - Search web using Brave/Exa/Google APIs
46
+ - `read_webpage` - Read webpage and convert to clean Markdown
47
+ - `fetch` - Perform HTTP request to URL
48
+
49
+ ### 🀝 Human Interaction (5 tools)
50
+ - `ask_human` - Request human input or decision
51
+ - `respond_to_human` - Provide response to pending question
52
+ - `get_pending_questions` - Get all pending human questions
53
+ - `get_interaction_history` - Get history of human-AI interactions
54
+ - `clear_old_interactions` - Clear old interaction history
55
+
56
+ ### ⚽ Sports Analysis (20 tools)
57
+
58
+ #### Match Analysis (3 tools)
59
+ - `analyze_football_match_v2` - Comprehensive match analysis (8 dimensions)
60
+ - `get_live_scores` - Get live football scores
61
+ - `get_match_details` - Get detailed match information
62
+
63
+ #### Team Analysis (4 tools)
64
+ - `compare_teams` - Compare two teams with metrics
65
+ - `get_league_standings` - Get league table
66
+ - `get_team_info` - Get team information
67
+ - `get_top_scorers` - Get top scorers
68
+
69
+ #### Player Analysis (3 tools)
70
+ - `player_analysis` - Detailed player analysis
71
+ - `tactical_breakdown` - Tactical matchup analysis
72
+ - `referee_profile` - Referee statistics
73
+
74
+ #### Betting Intelligence (4 tools)
75
+ - `odds_comparison` - Compare odds across bookmakers
76
+ - `value_bet_calculator` - Calculate value bet (Kelly Criterion)
77
+ - `odds_converter` - Convert odds formats (decimal/fractional/American)
78
+ - `probability_calculator` - Calculate implied probability
79
+
80
+ #### Live Monitoring (6 tools)
81
+ - `watchlist_add` - Add item to watchlist
82
+ - `watchlist_list` - List all watchlist items
83
+ - `watchlist_remove` - Remove item from watchlist
84
+ - `watchlist_clear` - Clear entire watchlist
85
+ - `check_alerts` - Check for triggered alerts
86
+ - `transfer_news` - Get transfer news
87
+
88
+ ---
89
+
90
+ ## 🚨 WORKFLOW GUIDELINES
91
+
92
+ ### For Coding Tasks:
93
+ 1. Use `sequentialthinking` to analyze requirements
94
+ 2. Use `build_project_graph` if new to project
95
+ 3. Use `deep_code_analyze` to understand target file
96
+ 4. Use `read_file` before `write_file` or `edit_file`
97
+ 5. Use `sequentialthinking` (observation) to verify changes
98
+
99
+ ### For Sports Analysis:
100
+ 1. Use `analyze_football_match_v2` for comprehensive match analysis
101
+ 2. Use `get_live_scores` for current scores
102
+ 3. Use `compare_teams` for team comparison
103
+ 4. Use `value_bet_calculator` for betting analysis
104
+
105
+ ### For Web Research:
106
+ 1. Use `web_search` to find information
107
+ 2. Use `read_webpage` to extract content from URLs
108
+ 3. Use `manage_notes` to save important findings
109
+
110
+ ---
111
+
112
+ ## πŸ”§ SETUP FOR DIFFERENT PLATFORMS
113
+
114
+ ### Claude Desktop
115
+ Config: Settings β†’ MCP β†’ Add Server β†’ Command: `node /path/to/project/dist/index.js`
116
+ Custom Instructions: Import this file
117
+
118
+ ### Cursor IDE
119
+ Config: Settings β†’ MCP β†’ Add Server β†’ Command: `node /path/to/project/dist/index.js`
120
+ Rules: Create `.cursorrules` in project root with this content
121
+
122
+ ### Google Gemini (with MCP)
123
+ Config: Extensions β†’ MCP β†’ Configure β†’ Add server
124
+ Enable: thinkingMode: advanced
125
+
126
+ ### VS Code (with Continue extension)
127
+ Config: Settings β†’ MCP Servers β†’ Add server
128
+ Extension: "Continue with Claude MCP"
129
+
130
+ ### Windsurf
131
+ Config: Settings β†’ MCP Servers β†’ Add server
132
+ Custom Instructions: Paste this content
133
+
134
+ ---
135
+
136
+ ## βš™οΈ OPTIONAL ENVIRONMENT VARIABLES
137
+
138
+ ```bash
139
+ # Search Providers
140
+ BRAVE_API_KEY=your_key
141
+ EXA_API_KEY=your_key
142
+ GOOGLE_SEARCH_API_KEY=your_key
143
+ GOOGLE_SEARCH_CX=your_cx
144
+
145
+ # Sports APIs
146
+ API_FOOTBALL_KEY=your_key
147
+ FOOTBALL_DATA_KEY=your_key
148
+ SPORTS_DB_KEY=your_key
149
+ ```
150
+
151
+ ---
152
+
153
+ **Status:** Universal MCP Toolkit v6.0 [Active].
154
+ **Total Tools:** 52 MCP Tools.
155
+ **Purpose:** Efficient tool usage for coding, research, and sports analysis.