@mikoto_zero/minigame-open-mcp 1.0.0 → 1.0.2
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.
- package/bin/minigame-open-mcp +17 -19
- package/dist/config/toolDefinitions.d.ts +10 -0
- package/dist/config/toolDefinitions.d.ts.map +1 -0
- package/dist/config/toolDefinitions.js +241 -0
- package/dist/config/toolDefinitions.js.map +1 -0
- package/dist/handlers/appHandlers.d.ts +22 -0
- package/dist/handlers/appHandlers.d.ts.map +1 -0
- package/dist/handlers/appHandlers.js +66 -0
- package/dist/handlers/appHandlers.js.map +1 -0
- package/dist/handlers/environmentHandlers.d.ts +15 -0
- package/dist/handlers/environmentHandlers.d.ts.map +1 -0
- package/dist/handlers/environmentHandlers.js +21 -0
- package/dist/handlers/environmentHandlers.js.map +1 -0
- package/dist/handlers/leaderboardHandlers.d.ts +49 -0
- package/dist/handlers/leaderboardHandlers.d.ts.map +1 -0
- package/dist/handlers/leaderboardHandlers.js +242 -0
- package/dist/handlers/leaderboardHandlers.js.map +1 -0
- package/dist/network/httpClient.d.ts +14 -4
- package/dist/network/httpClient.d.ts.map +1 -1
- package/dist/network/httpClient.js +53 -10
- package/dist/network/httpClient.js.map +1 -1
- package/dist/network/leaderboardApi.d.ts +21 -2
- package/dist/network/leaderboardApi.d.ts.map +1 -1
- package/dist/network/leaderboardApi.js +73 -3
- package/dist/network/leaderboardApi.js.map +1 -1
- package/dist/server.js +76 -449
- package/dist/server.js.map +1 -1
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +1 -1
package/bin/minigame-open-mcp
CHANGED
|
@@ -2,33 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* TapTap Minigame Open API MCP Server
|
|
5
|
+
* Entry point for NPM executable
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
11
|
+
|
|
12
|
+
// Get current file path and directory (ES Module equivalent of __dirname)
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
9
15
|
|
|
10
16
|
// Get package root directory
|
|
11
|
-
const packageRoot =
|
|
17
|
+
const packageRoot = join(__dirname, '..');
|
|
12
18
|
|
|
13
19
|
// Check if compiled version exists
|
|
14
|
-
const distPath =
|
|
15
|
-
const srcPath = path.join(packageRoot, 'src', 'server.ts');
|
|
20
|
+
const distPath = join(packageRoot, 'dist', 'server.js');
|
|
16
21
|
|
|
17
|
-
if (
|
|
18
|
-
// Use compiled version
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Development mode, use ts-node
|
|
22
|
-
try {
|
|
23
|
-
require('ts-node/register');
|
|
24
|
-
require(srcPath);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error('❌ Please install dependencies or build the project:');
|
|
27
|
-
console.error(' npm install');
|
|
28
|
-
console.error(' npm run build');
|
|
22
|
+
if (existsSync(distPath)) {
|
|
23
|
+
// Use compiled version (ES Module dynamic import)
|
|
24
|
+
import(distPath).catch(error => {
|
|
25
|
+
console.error('❌ Failed to start server:', error);
|
|
29
26
|
process.exit(1);
|
|
30
|
-
}
|
|
27
|
+
});
|
|
31
28
|
} else {
|
|
32
|
-
console.error('❌ Server file not found');
|
|
29
|
+
console.error('❌ Server file not found. Please build the project first:');
|
|
30
|
+
console.error(' npm run build');
|
|
33
31
|
process.exit(1);
|
|
34
32
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions
|
|
3
|
+
* Centralized tool definitions for the MCP server
|
|
4
|
+
*/
|
|
5
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get all tool definitions
|
|
8
|
+
*/
|
|
9
|
+
export declare function getToolDefinitions(): Tool[];
|
|
10
|
+
//# sourceMappingURL=toolDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolDefinitions.d.ts","sourceRoot":"","sources":["../../src/config/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,EAAE,CA8O3C"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions
|
|
3
|
+
* Centralized tool definitions for the MCP server
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get all tool definitions
|
|
7
|
+
*/
|
|
8
|
+
export function getToolDefinitions() {
|
|
9
|
+
return [
|
|
10
|
+
// 🎯 Workflow Guidance Tool
|
|
11
|
+
{
|
|
12
|
+
name: 'start_leaderboard_integration',
|
|
13
|
+
description: 'START HERE when user asks about integrating leaderboards, implementing rankings, or "接入排行榜". This tool guides the complete workflow: check existing leaderboards, create if needed, then provide implementation docs. Use this as the first step for any leaderboard integration request.',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
purpose: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'What the user wants to do with leaderboards (optional, for context)'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
// 📖 Core LeaderboardManager API Documentation Tools (one tool per API)
|
|
25
|
+
{
|
|
26
|
+
name: 'get_leaderboard_manager',
|
|
27
|
+
description: 'Get documentation for tap.getLeaderboardManager() - how to obtain the LeaderboardManager instance. Use this when user asks how to initialize or access the leaderboard system.',
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
properties: {}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'open_leaderboard',
|
|
35
|
+
description: 'Get documentation for leaderboardManager.openLeaderboard() - how to display the TapTap leaderboard UI. Use this when user wants to show leaderboard interface to players.',
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'submit_scores',
|
|
43
|
+
description: 'Get documentation for leaderboardManager.submitScores() - how to submit player scores to leaderboards. Use this when user wants to upload scores or update rankings.',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'load_leaderboard_scores',
|
|
51
|
+
description: 'Get documentation for leaderboardManager.loadLeaderboardScores() - how to retrieve paginated leaderboard data. Use this when user wants to fetch top scores or implement custom leaderboard UI.',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'load_current_player_score',
|
|
59
|
+
description: 'Get documentation for leaderboardManager.loadCurrentPlayerLeaderboardScore() - how to get current player\'s score and rank. Use this when user wants to show player their own ranking.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'load_player_centered_scores',
|
|
67
|
+
description: 'Get documentation for leaderboardManager.loadPlayerCenteredScores() - how to load scores of players near current user. Use this when user wants to display surrounding competitors.',
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
// 🔍 Helper Tools
|
|
74
|
+
{
|
|
75
|
+
name: 'search_leaderboard_docs',
|
|
76
|
+
description: 'Search all leaderboard documentation by keyword. Use this when user asks a general question or you\'re not sure which specific API they need.',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
query: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'Search keyword, such as: leaderboard, score, ranking, submission, etc.'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
required: ['query']
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'get_leaderboard_overview',
|
|
90
|
+
description: 'Get comprehensive overview of all TapTap leaderboard APIs and features. Use this when user wants to understand what leaderboard functionality is available.',
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'get_leaderboard_patterns',
|
|
98
|
+
description: 'Get complete implementation examples and best practices for leaderboards. Use this when user wants to see full integration code or common usage patterns.',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
// 🔧 Environment Check Tool
|
|
105
|
+
{
|
|
106
|
+
name: 'check_environment',
|
|
107
|
+
description: 'Check environment configuration and user authentication status. Use this to verify if TAPTAP_MAC_TOKEN and TAPTAP_CLIENT_ID are configured.',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
// 📱 Developer & App Management Tools
|
|
114
|
+
{
|
|
115
|
+
name: 'list_developers_and_apps',
|
|
116
|
+
description: 'List all developers and their apps/games for the current user. Use this when multiple developers or apps exist and you need to let user/AI choose which one to use.',
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'select_app',
|
|
124
|
+
description: 'Select a specific developer and app to use for subsequent operations. This will cache the selection. Use this after listing developers and apps with list_developers_and_apps.',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
developer_id: {
|
|
129
|
+
type: 'number',
|
|
130
|
+
description: 'Developer ID to select (required)'
|
|
131
|
+
},
|
|
132
|
+
app_id: {
|
|
133
|
+
type: 'number',
|
|
134
|
+
description: 'App/Game ID to select (required)'
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
required: ['developer_id', 'app_id']
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
// ⚙️ Leaderboard Management Tools (requires TAPTAP_MAC_TOKEN, TAPTAP_CLIENT_ID, TAPTAP_CLIENT_SECRET)
|
|
141
|
+
{
|
|
142
|
+
name: 'create_leaderboard',
|
|
143
|
+
description: 'Create a new leaderboard on TapTap server. Use this AFTER checking existing leaderboards with list_leaderboards or start_leaderboard_integration. Auto-fetches developer_id and app_id if not provided. Returns the leaderboard_id needed for client-side APIs.',
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
properties: {
|
|
147
|
+
developer_id: {
|
|
148
|
+
type: 'number',
|
|
149
|
+
description: 'Developer ID (optional, will be auto-fetched if not provided)'
|
|
150
|
+
},
|
|
151
|
+
app_id: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
description: 'Application/Game ID (optional, will be auto-fetched if not provided)'
|
|
154
|
+
},
|
|
155
|
+
title: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
description: 'Leaderboard title/name (required)'
|
|
158
|
+
},
|
|
159
|
+
period_type: {
|
|
160
|
+
type: 'number',
|
|
161
|
+
description: 'Period type: 0=Daily, 1=Weekly, 2=Monthly, 3=Always, 4=Custom (required)',
|
|
162
|
+
enum: [0, 1, 2, 3, 4]
|
|
163
|
+
},
|
|
164
|
+
score_type: {
|
|
165
|
+
type: 'number',
|
|
166
|
+
description: 'Score type: 0=Integer, 1=Float, 2=Time (required)',
|
|
167
|
+
enum: [0, 1, 2]
|
|
168
|
+
},
|
|
169
|
+
score_order: {
|
|
170
|
+
type: 'number',
|
|
171
|
+
description: 'Score order: 0=Ascending (lower is better), 1=Descending (higher is better), 2=None (required)',
|
|
172
|
+
enum: [0, 1, 2]
|
|
173
|
+
},
|
|
174
|
+
calc_type: {
|
|
175
|
+
type: 'number',
|
|
176
|
+
description: 'Calculation type: 0=Best, 1=Latest, 2=Sum, 3=First (required)',
|
|
177
|
+
enum: [0, 1, 2, 3]
|
|
178
|
+
},
|
|
179
|
+
display_limit: {
|
|
180
|
+
type: 'number',
|
|
181
|
+
description: 'Display limit for leaderboard entries (optional, default 100)'
|
|
182
|
+
},
|
|
183
|
+
period_time: {
|
|
184
|
+
type: 'string',
|
|
185
|
+
description: 'Period reset time in HH:MM:SS format (optional, for periodic leaderboards)'
|
|
186
|
+
},
|
|
187
|
+
score_unit: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: 'Score unit display text (optional, e.g., "points", "seconds")'
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
required: ['title', 'period_type', 'score_type', 'score_order', 'calc_type']
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'list_leaderboards',
|
|
197
|
+
description: 'List all leaderboards created for the current app/game. Use this to check existing leaderboards before creating new ones or when user asks "我有哪些排行榜" or wants to see leaderboard IDs. Auto-fetches developer_id and app_id if not provided.',
|
|
198
|
+
inputSchema: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
properties: {
|
|
201
|
+
developer_id: {
|
|
202
|
+
type: 'number',
|
|
203
|
+
description: 'Developer ID (optional, will be auto-fetched if not provided)'
|
|
204
|
+
},
|
|
205
|
+
app_id: {
|
|
206
|
+
type: 'number',
|
|
207
|
+
description: 'Application/Game ID (optional, will be auto-fetched if not provided)'
|
|
208
|
+
},
|
|
209
|
+
page: {
|
|
210
|
+
type: 'number',
|
|
211
|
+
description: 'Page number, starts from 1 (optional, default 1)'
|
|
212
|
+
},
|
|
213
|
+
page_size: {
|
|
214
|
+
type: 'number',
|
|
215
|
+
description: 'Results per page (optional, default 10)'
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
// 🔑 User Data Tools (requires TAPTAP_MAC_TOKEN)
|
|
221
|
+
{
|
|
222
|
+
name: 'get_user_leaderboard_scores',
|
|
223
|
+
description: 'Get actual user leaderboard score data from TapTap API (requires user login). Use this when user wants to see their own scores or ranking positions. Falls back to documentation mode if token is not provided.',
|
|
224
|
+
inputSchema: {
|
|
225
|
+
type: 'object',
|
|
226
|
+
properties: {
|
|
227
|
+
leaderboardId: {
|
|
228
|
+
type: 'string',
|
|
229
|
+
description: 'The specific leaderboard ID to query. Leave empty to get all leaderboards associated with the user.'
|
|
230
|
+
},
|
|
231
|
+
limit: {
|
|
232
|
+
type: 'number',
|
|
233
|
+
description: 'Maximum number of score entries to return. Default is 10.',
|
|
234
|
+
default: 10
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=toolDefinitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolDefinitions.js","sourceRoot":"","sources":["../../src/config/toolDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,4BAA4B;QAC5B;YACE,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,2RAA2R;YACxS,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,qEAAqE;qBACnF;iBACF;aACF;SACF;QAED,wEAAwE;QACxE;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,gLAAgL;YAC7L,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AA6B;YACnC,WAAW,EAAE,iNAAiN;YAC9N,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,aAAa,EAAE;wBACb,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,qGAAqG;qBACnH;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2DAA2D;wBACxE,OAAO,EAAE,EAAE;qBACZ;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application Management Handlers
|
|
3
|
+
* Handles developer and app selection operations
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handler context for accessing environment variables
|
|
7
|
+
*/
|
|
8
|
+
export interface HandlerContext {
|
|
9
|
+
projectPath?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List all developers and apps for the current user
|
|
13
|
+
*/
|
|
14
|
+
export declare function listDevelopersAndApps(context: HandlerContext): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Select a specific developer and app
|
|
17
|
+
*/
|
|
18
|
+
export declare function selectApp(args: {
|
|
19
|
+
developer_id: number;
|
|
20
|
+
app_id: number;
|
|
21
|
+
}, context: HandlerContext): Promise<string>;
|
|
22
|
+
//# sourceMappingURL=appHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appHandlers.d.ts","sourceRoot":"","sources":["../../src/handlers/appHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCpF;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC9C,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAejB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application Management Handlers
|
|
3
|
+
* Handles developer and app selection operations
|
|
4
|
+
*/
|
|
5
|
+
import { getAllDevelopersAndApps, selectApp as selectAppApi } from '../network/leaderboardApi.js';
|
|
6
|
+
/**
|
|
7
|
+
* List all developers and apps for the current user
|
|
8
|
+
*/
|
|
9
|
+
export async function listDevelopersAndApps(context) {
|
|
10
|
+
try {
|
|
11
|
+
const result = await getAllDevelopersAndApps();
|
|
12
|
+
if (!result.list || result.list.length === 0) {
|
|
13
|
+
return `📋 暂无开发者或应用\n\n您还没有创建任何开发者账号或应用。请先在 TapTap 开放平台创建应用。`;
|
|
14
|
+
}
|
|
15
|
+
let output = `📋 开发者和应用列表\n\n`;
|
|
16
|
+
result.list.forEach((developer, devIndex) => {
|
|
17
|
+
output += `**开发者 ${devIndex + 1}: ${developer.developer_name}**\n`;
|
|
18
|
+
output += `- Developer ID: ${developer.developer_id}\n`;
|
|
19
|
+
if (!developer.crafts || developer.crafts.length === 0) {
|
|
20
|
+
output += `- 暂无应用\n\n`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
output += `- 应用列表:\n`;
|
|
24
|
+
developer.crafts.forEach((app, appIndex) => {
|
|
25
|
+
output += ` ${appIndex + 1}. **${app.app_title}** (App ID: ${app.app_id})\n`;
|
|
26
|
+
if (app.category) {
|
|
27
|
+
output += ` 类别: ${app.category}\n`;
|
|
28
|
+
}
|
|
29
|
+
if (app.is_published !== undefined) {
|
|
30
|
+
output += ` 已发布: ${app.is_published ? '是' : '否'}\n`;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
output += `\n`;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
output += `\n💡 **下一步:**\n`;
|
|
37
|
+
output += `使用 select_app 工具选择要使用的开发者和应用,例如:\n`;
|
|
38
|
+
output += `- developer_id: ${result.list[0].developer_id}\n`;
|
|
39
|
+
output += `- app_id: ${result.list[0].crafts[0]?.app_id || 'N/A'}\n`;
|
|
40
|
+
return output;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
44
|
+
return `❌ 获取开发者和应用列表失败:\n${errorMsg}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Select a specific developer and app
|
|
49
|
+
*/
|
|
50
|
+
export async function selectApp(args, context) {
|
|
51
|
+
try {
|
|
52
|
+
const result = await selectAppApi(args.developer_id, args.app_id, context.projectPath);
|
|
53
|
+
return `✅ 已选择应用!\n\n` +
|
|
54
|
+
`📱 应用信息:\n` +
|
|
55
|
+
`- 开发者: ${result.developer_name} (ID: ${result.developer_id})\n` +
|
|
56
|
+
`- 应用: ${result.app_title} (ID: ${result.app_id})\n\n` +
|
|
57
|
+
`💾 此选择已缓存,后续操作将默认使用此应用。\n\n` +
|
|
58
|
+
`🎮 下一步:\n` +
|
|
59
|
+
`您现在可以使用 create_leaderboard 或 list_leaderboards 等工具来管理排行榜了。`;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
63
|
+
return `❌ 选择应用失败:\n${errorMsg}\n\n请使用 list_developers_and_apps 查看可用的开发者和应用列表。`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=appHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appHandlers.js","sourceRoot":"","sources":["../../src/handlers/appHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASlG;;GAEG;AACH,MAAM,CAAC,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|
2
|
+
* Environment Check Handlers
|
|
3
|
+
* Handles environment variable checking and validation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handler context for accessing environment variables
|
|
7
|
+
*/
|
|
8
|
+
export interface HandlerContext {
|
|
9
|
+
projectPath?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check environment configuration and authentication status
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkEnvironment(context: HandlerContext): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=environmentHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environmentHandlers.d.ts","sourceRoot":"","sources":["../../src/handlers/environmentHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAa/E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Check Handlers
|
|
3
|
+
* Handles environment variable checking and validation
|
|
4
|
+
*/
|
|
5
|
+
import { ApiConfig } from '../network/httpClient.js';
|
|
6
|
+
/**
|
|
7
|
+
* Check environment configuration and authentication status
|
|
8
|
+
*/
|
|
9
|
+
export async function checkEnvironment(context) {
|
|
10
|
+
const apiConfig = ApiConfig.getInstance();
|
|
11
|
+
const configStatus = apiConfig.getConfigStatus();
|
|
12
|
+
const envInfo = {
|
|
13
|
+
...configStatus,
|
|
14
|
+
'TAPTAP_PROJECT_PATH': context.projectPath ? '✅ 已配置' : '❌ 未配置 (可选)'
|
|
15
|
+
};
|
|
16
|
+
const envResult = Object.entries(envInfo)
|
|
17
|
+
.map(([key, value]) => `${key}: ${value}`)
|
|
18
|
+
.join('\n');
|
|
19
|
+
return `🔧 环境配置检查结果:\n\n${envResult}\n\n✨ 所有必需配置已就绪,可以使用完整功能`;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=environmentHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environmentHandlers.js","sourceRoot":"","sources":["../../src/handlers/environmentHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AASrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAuB;IAC5D,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAG,SAAS,CAAC,eAAe,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG;QACd,GAAG,YAAY;QACf,qBAAqB,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY;KACpE,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;SACzC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,mBAAmB,SAAS,0BAA0B,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leaderboard Management Handlers
|
|
3
|
+
* Handles leaderboard operations including creation, listing, and workflow guidance
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handler context for accessing environment variables
|
|
7
|
+
*/
|
|
8
|
+
export interface HandlerContext {
|
|
9
|
+
projectPath?: string;
|
|
10
|
+
macToken?: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Start leaderboard integration workflow - guides user through the process
|
|
14
|
+
*/
|
|
15
|
+
export declare function startLeaderboardIntegration(args: {
|
|
16
|
+
purpose?: string;
|
|
17
|
+
}, context: HandlerContext): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new leaderboard
|
|
20
|
+
*/
|
|
21
|
+
export declare function createLeaderboard(args: {
|
|
22
|
+
developer_id?: number;
|
|
23
|
+
app_id?: number;
|
|
24
|
+
title: string;
|
|
25
|
+
period_type: number;
|
|
26
|
+
score_type: number;
|
|
27
|
+
score_order: number;
|
|
28
|
+
calc_type: number;
|
|
29
|
+
display_limit?: number;
|
|
30
|
+
period_time?: string;
|
|
31
|
+
score_unit?: string;
|
|
32
|
+
}, context: HandlerContext): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* List all leaderboards for the current app
|
|
35
|
+
*/
|
|
36
|
+
export declare function listLeaderboards(args: {
|
|
37
|
+
developer_id?: number;
|
|
38
|
+
app_id?: number;
|
|
39
|
+
page?: number;
|
|
40
|
+
page_size?: number;
|
|
41
|
+
}, context: HandlerContext): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Get user leaderboard scores (requires user token)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getUserLeaderboardScores(args: {
|
|
46
|
+
leaderboardId?: string;
|
|
47
|
+
limit?: number;
|
|
48
|
+
}, context: HandlerContext): Promise<string>;
|
|
49
|
+
//# sourceMappingURL=leaderboardHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaderboardHandlers.d.ts","sourceRoot":"","sources":["../../src/handlers/leaderboardHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAuFjB;AAED;;GAE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