@liangshanli/mcp-server-project-standards 2.1.10 → 3.0.0
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/README.md +31 -3
- package/README.zh-CN.md +28 -1
- package/bin/cli.js +18 -3
- package/package.json +1 -1
- package/src/server-final.js +42 -18
- package/src/utils/api_common.js +17 -2
- package/src/utils/api_debug.js +19 -12
package/README.md
CHANGED
|
@@ -4,6 +4,28 @@ A MCP (Model Context Protocol) server for project standards management, designed
|
|
|
4
4
|
|
|
5
5
|
## 📋 Version Updates
|
|
6
6
|
|
|
7
|
+
### v3.0.0 (2025-10-31) - Major Release
|
|
8
|
+
|
|
9
|
+
#### 🚀 Breaking Changes
|
|
10
|
+
- Config directory resolution now depends on both `CONFIG_DIR` and `TOOL_PREFIX`:
|
|
11
|
+
- If `CONFIG_DIR` is set, it is used as-is
|
|
12
|
+
- If `CONFIG_DIR` is not set and `TOOL_PREFIX` is set, use `./.setting.<TOOL_PREFIX>`
|
|
13
|
+
- Otherwise default to `./.setting`
|
|
14
|
+
- `tools/call` now strips the `TOOL_PREFIX` from tool names before method dispatch. If you call `xxx_api_debug` (with `TOOL_PREFIX=xxx`), the server routes the call to `api_debug` internally.
|
|
15
|
+
|
|
16
|
+
#### ✨ New/Improved
|
|
17
|
+
- Unified `getConfigDir()` used by both `server-final.js` and `api_common.js`
|
|
18
|
+
- `tools/list` shows environment with resolved `CONFIG_DIR`
|
|
19
|
+
- Prefixed tool names and project-branded descriptions when both `TOOL_PREFIX` and `PROJECT_NAME` are provided
|
|
20
|
+
|
|
21
|
+
#### 🧹 Cleanup
|
|
22
|
+
- Removed duplicate legacy `api_debug` method definition
|
|
23
|
+
|
|
24
|
+
#### 💡 Benefits
|
|
25
|
+
- Multi-project isolation: simple per-project segregation via `TOOL_PREFIX` without code changes
|
|
26
|
+
- Zero-friction switching: swap project context by environment only
|
|
27
|
+
- Smoother tool calling: clients can call prefixed names, server auto-routes
|
|
28
|
+
|
|
7
29
|
### v2.0.0 (2024-12-19) - Major Release
|
|
8
30
|
|
|
9
31
|
#### 🚀 New Tools & Features
|
|
@@ -127,7 +149,9 @@ The server uses the `./.setting/` directory to store configuration files by defa
|
|
|
127
149
|
|
|
128
150
|
| Variable | Default | Description | Example |
|
|
129
151
|
|----------|---------|-------------|---------|
|
|
130
|
-
| CONFIG_DIR | ./.setting | Configuration
|
|
152
|
+
| CONFIG_DIR | ./.setting or ./.setting.<TOOL_PREFIX> | Configuration directory. If set, used as-is; else if TOOL_PREFIX set, uses ./.setting.<TOOL_PREFIX>; else ./.setting | `export CONFIG_DIR="./config"` |
|
|
153
|
+
| TOOL_PREFIX | | Optional tool prefix for tool names and config isolation | `export TOOL_PREFIX="projA"` |
|
|
154
|
+
| PROJECT_NAME | | Optional project branding for tool descriptions | `export PROJECT_NAME="MyProject"` |
|
|
131
155
|
| API_DEBUG_ALLOWED_METHODS | GET | Control allowed request methods (supports: GET,POST,PUT,DELETE,PATCH, etc.) | `export API_DEBUG_ALLOWED_METHODS="GET,POST"` |
|
|
132
156
|
| API_DEBUG_LOGIN_URL | /api/login | Set login API URL | `export API_DEBUG_LOGIN_URL="/api/auth/login"` |
|
|
133
157
|
| API_DEBUG_LOGIN_METHOD | POST | Set login request method | `export API_DEBUG_LOGIN_METHOD="POST"` |
|
|
@@ -223,7 +247,9 @@ npm run dev
|
|
|
223
247
|
"command": "npx",
|
|
224
248
|
"args": ["@liangshanli/mcp-server-project-standards"],
|
|
225
249
|
"env": {
|
|
226
|
-
"
|
|
250
|
+
"TOOL_PREFIX": "projA",
|
|
251
|
+
"PROJECT_NAME": "MyProject",
|
|
252
|
+
"CONFIG_DIR": "./.setting",
|
|
227
253
|
"API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
|
|
228
254
|
"API_DEBUG_LOGIN_URL": "/api/login",
|
|
229
255
|
"API_DEBUG_LOGIN_METHOD": "POST",
|
|
@@ -247,7 +273,9 @@ npm run dev
|
|
|
247
273
|
"command": "npx",
|
|
248
274
|
"args": ["@liangshanli/mcp-server-project-standards"],
|
|
249
275
|
"env": {
|
|
250
|
-
"
|
|
276
|
+
"TOOL_PREFIX": "projA",
|
|
277
|
+
"PROJECT_NAME": "MyProject",
|
|
278
|
+
"CONFIG_DIR": "./.setting",
|
|
251
279
|
"API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
|
|
252
280
|
"API_DEBUG_LOGIN_URL": "/api/login",
|
|
253
281
|
"API_DEBUG_LOGIN_METHOD": "POST",
|
package/README.zh-CN.md
CHANGED
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
## 📋 版本更新说明
|
|
6
6
|
|
|
7
|
+
### v3.0.0 (2025-10-31) - 重大更新
|
|
8
|
+
|
|
9
|
+
#### 🚀 破坏性变更
|
|
10
|
+
- 配置目录解析新增 `TOOL_PREFIX` 参与:
|
|
11
|
+
- 若设置了 `CONFIG_DIR`,优先使用该值
|
|
12
|
+
- 若未设置 `CONFIG_DIR` 且设置了 `TOOL_PREFIX`,使用 `./.setting.<TOOL_PREFIX>`
|
|
13
|
+
- 否则默认 `./.setting`
|
|
14
|
+
- 在 `tools/call` 中,若工具名带有前缀(如 `xxx_api_debug` 且 `TOOL_PREFIX=xxx`),调用时会自动去除前缀,路由到真实方法(`api_debug`)。
|
|
15
|
+
|
|
16
|
+
#### ✨ 新增 / 改进
|
|
17
|
+
- 在 `server-final.js` 与 `api_common.js` 中统一使用 `getConfigDir()`
|
|
18
|
+
- `tools/list` 环境信息展示最终生效的 `CONFIG_DIR`
|
|
19
|
+
- 同时存在 `TOOL_PREFIX` 和 `PROJECT_NAME` 时,工具名自动加前缀、描述自动加项目名
|
|
20
|
+
|
|
21
|
+
#### 🧹 清理
|
|
22
|
+
- 移除了重复的旧版 `api_debug` 方法定义
|
|
23
|
+
|
|
24
|
+
#### 💡 优势
|
|
25
|
+
- 多项目隔离更简单:通过 `TOOL_PREFIX` 即可实现每项目独立配置,无需改代码
|
|
26
|
+
- 切换零侵入:仅改环境变量即可切换项目上下文
|
|
27
|
+
- 调用更顺滑:客户端可使用带前缀名,服务端自动剥前缀并精准路由
|
|
7
28
|
### v1.1.0 (2024-12-19)
|
|
8
29
|
|
|
9
30
|
#### 🆕 新增功能
|
|
@@ -112,7 +133,9 @@ npm install
|
|
|
112
133
|
|
|
113
134
|
| 变量名 | 默认值 | 描述 | 示例 |
|
|
114
135
|
|--------|--------|------|------|
|
|
115
|
-
| CONFIG_DIR | ./.setting |
|
|
136
|
+
| CONFIG_DIR | ./.setting 或 ./.setting.<TOOL_PREFIX> | 配置目录。若设置则直接使用;否则若设置了 TOOL_PREFIX 则使用 ./.setting.<TOOL_PREFIX>;否则 ./.setting | `export CONFIG_DIR="./config"` |
|
|
137
|
+
| TOOL_PREFIX | | 工具名前缀,同时用于多项目配置隔离 | `export TOOL_PREFIX="projA"` |
|
|
138
|
+
| PROJECT_NAME | | 工具描述前添加项目名称用于标识 | `export PROJECT_NAME="MyProject"` |
|
|
116
139
|
| API_DEBUG_ALLOWED_METHODS | GET | 控制允许的请求方法(支持:GET,POST,PUT,DELETE,PATCH等) | `export API_DEBUG_ALLOWED_METHODS="GET,POST"` |
|
|
117
140
|
| API_DEBUG_LOGIN_URL | /api/login | 设置登录接口 URL | `export API_DEBUG_LOGIN_URL="/api/auth/login"` |
|
|
118
141
|
| API_DEBUG_LOGIN_METHOD | POST | 设置登录请求方法 | `export API_DEBUG_LOGIN_METHOD="POST"` |
|
|
@@ -208,6 +231,8 @@ npm run dev
|
|
|
208
231
|
"command": "npx",
|
|
209
232
|
"args": ["@liangshanli/mcp-server-project-standards"],
|
|
210
233
|
"env": {
|
|
234
|
+
"TOOL_PREFIX": "projA",
|
|
235
|
+
"PROJECT_NAME": "MyProject",
|
|
211
236
|
"CONFIG_DIR": "./.setting",
|
|
212
237
|
"API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
|
|
213
238
|
"API_DEBUG_LOGIN_URL": "/api/login",
|
|
@@ -232,6 +257,8 @@ npm run dev
|
|
|
232
257
|
"command": "npx",
|
|
233
258
|
"args": ["@liangshanli/mcp-server-project-standards"],
|
|
234
259
|
"env": {
|
|
260
|
+
"TOOL_PREFIX": "projA",
|
|
261
|
+
"PROJECT_NAME": "MyProject",
|
|
235
262
|
"CONFIG_DIR": "./.setting",
|
|
236
263
|
"API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
|
|
237
264
|
"API_DEBUG_LOGIN_URL": "/api/login",
|
package/bin/cli.js
CHANGED
|
@@ -27,16 +27,31 @@ let server = null;
|
|
|
27
27
|
// Function to start server
|
|
28
28
|
function startServer() {
|
|
29
29
|
// Create environment object
|
|
30
|
+
// Determine CONFIG_DIR: use env var if set, otherwise use .setting with TOOL_PREFIX if available
|
|
31
|
+
let configDir = process.env.CONFIG_DIR;
|
|
32
|
+
if (!configDir) {
|
|
33
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
34
|
+
if (toolPrefix) {
|
|
35
|
+
configDir = `./.setting.${toolPrefix}`;
|
|
36
|
+
} else {
|
|
37
|
+
configDir = './.setting';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
const env = {
|
|
31
42
|
...process.env,
|
|
32
|
-
// Set CONFIG_DIR
|
|
33
|
-
CONFIG_DIR:
|
|
43
|
+
// Set CONFIG_DIR based on logic above
|
|
44
|
+
CONFIG_DIR: configDir,
|
|
34
45
|
// API Debug environment variables
|
|
35
46
|
API_DEBUG_ALLOWED_METHODS: process.env.API_DEBUG_ALLOWED_METHODS || 'GET',
|
|
36
47
|
API_DEBUG_LOGIN_URL: process.env.API_DEBUG_LOGIN_URL || '/api/login',
|
|
37
48
|
API_DEBUG_LOGIN_METHOD: process.env.API_DEBUG_LOGIN_METHOD || 'POST',
|
|
38
49
|
API_DEBUG_LOGIN_BODY: process.env.API_DEBUG_LOGIN_BODY || '{"username":"","password":""}',
|
|
39
|
-
API_DEBUG_LOGIN_DESCRIPTION: process.env.API_DEBUG_LOGIN_DESCRIPTION || 'Save returned token to common headers in debug tool, field name Authorization, field value Bearer token'
|
|
50
|
+
API_DEBUG_LOGIN_DESCRIPTION: process.env.API_DEBUG_LOGIN_DESCRIPTION || 'Save returned token to common headers in debug tool, field name Authorization, field value Bearer token',
|
|
51
|
+
// Tool prefix for naming/identification
|
|
52
|
+
TOOL_PREFIX: process.env.TOOL_PREFIX || '',
|
|
53
|
+
// Project name for display/metadata
|
|
54
|
+
PROJECT_NAME: process.env.PROJECT_NAME || ''
|
|
40
55
|
};
|
|
41
56
|
|
|
42
57
|
// Convert allowed methods to uppercase if specified
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liangshanli/mcp-server-project-standards",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "MCP Project Standards server with project info, structure, API standards, development standards, API debugging, login authentication and configuration management tools",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
package/src/server-final.js
CHANGED
|
@@ -13,9 +13,23 @@ const api_config = require('./utils/api_config');
|
|
|
13
13
|
const api_help = require('./utils/api_help');
|
|
14
14
|
const api_execute = require('./utils/api_execute');
|
|
15
15
|
|
|
16
|
+
// Get config directory based on CONFIG_DIR and TOOL_PREFIX
|
|
17
|
+
const getConfigDir = () => {
|
|
18
|
+
let configDir = process.env.CONFIG_DIR;
|
|
19
|
+
if (!configDir) {
|
|
20
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
21
|
+
if (toolPrefix) {
|
|
22
|
+
configDir = `./.setting.${toolPrefix}`;
|
|
23
|
+
} else {
|
|
24
|
+
configDir = './.setting';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return configDir;
|
|
28
|
+
};
|
|
29
|
+
|
|
16
30
|
// Get configuration from file or environment
|
|
17
31
|
const getConfig = () => {
|
|
18
|
-
const configDir =
|
|
32
|
+
const configDir = getConfigDir();
|
|
19
33
|
const configPath = path.join(configDir, 'config.json');
|
|
20
34
|
|
|
21
35
|
try {
|
|
@@ -33,7 +47,7 @@ const getConfig = () => {
|
|
|
33
47
|
|
|
34
48
|
// Save configuration to file
|
|
35
49
|
const saveConfig = (config) => {
|
|
36
|
-
const configDir =
|
|
50
|
+
const configDir = getConfigDir();
|
|
37
51
|
const configPath = path.join(configDir, 'config.json');
|
|
38
52
|
|
|
39
53
|
try {
|
|
@@ -51,7 +65,7 @@ const saveConfig = (config) => {
|
|
|
51
65
|
// 启动日志
|
|
52
66
|
console.error('=== MCP Project Standards Server Starting ===');
|
|
53
67
|
console.error(`Time: ${new Date().toISOString()}`);
|
|
54
|
-
console.error(`Config Dir: ${
|
|
68
|
+
console.error(`Config Dir: ${getConfigDir()}`);
|
|
55
69
|
console.error('==============================================');
|
|
56
70
|
|
|
57
71
|
// Final MCP Server
|
|
@@ -71,7 +85,7 @@ class ProjectStandardsMCPServer {
|
|
|
71
85
|
|
|
72
86
|
// 创建默认配置文件
|
|
73
87
|
createDefaultConfig() {
|
|
74
|
-
const configDir =
|
|
88
|
+
const configDir = getConfigDir();
|
|
75
89
|
const configPath = path.join(configDir, 'config.json');
|
|
76
90
|
|
|
77
91
|
try {
|
|
@@ -153,16 +167,6 @@ class ProjectStandardsMCPServer {
|
|
|
153
167
|
return result;
|
|
154
168
|
}
|
|
155
169
|
|
|
156
|
-
// API debug tool (legacy)
|
|
157
|
-
async api_debug(params) {
|
|
158
|
-
const result = await api_debug(params, this.config, saveConfig);
|
|
159
|
-
// Update local config if action was 'set'
|
|
160
|
-
if (params?.action === 'set') {
|
|
161
|
-
this.config = getConfig();
|
|
162
|
-
}
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
170
|
// API login tool
|
|
167
171
|
async api_login(params) {
|
|
168
172
|
const result = await api_login(params, this.config, saveConfig);
|
|
@@ -874,11 +878,24 @@ class ProjectStandardsMCPServer {
|
|
|
874
878
|
}
|
|
875
879
|
});
|
|
876
880
|
|
|
881
|
+
// Apply tool prefix and project name if both provided
|
|
882
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
883
|
+
const projectName = process.env.PROJECT_NAME || '';
|
|
884
|
+
let finalTools = tools;
|
|
885
|
+
if (toolPrefix && projectName) {
|
|
886
|
+
finalTools = tools.map(t => ({
|
|
887
|
+
...t,
|
|
888
|
+
name: `${toolPrefix}_${t.name}`,
|
|
889
|
+
description: `${projectName} - ${t.description}`
|
|
890
|
+
}));
|
|
891
|
+
}
|
|
877
892
|
|
|
878
893
|
result = {
|
|
879
|
-
tools:
|
|
894
|
+
tools: finalTools,
|
|
880
895
|
environment: {
|
|
881
|
-
CONFIG_DIR:
|
|
896
|
+
CONFIG_DIR: getConfigDir(),
|
|
897
|
+
PROJECT_NAME: process.env.PROJECT_NAME || '',
|
|
898
|
+
TOOL_PREFIX: process.env.TOOL_PREFIX || '',
|
|
882
899
|
serverInfo: {
|
|
883
900
|
name: this.name,
|
|
884
901
|
version: this.version
|
|
@@ -949,12 +966,19 @@ class ProjectStandardsMCPServer {
|
|
|
949
966
|
throw new Error('Missing tool name');
|
|
950
967
|
}
|
|
951
968
|
|
|
969
|
+
// Remove tool prefix if present
|
|
970
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
971
|
+
let actualToolName = name;
|
|
972
|
+
if (toolPrefix && name.startsWith(`${toolPrefix}_`)) {
|
|
973
|
+
actualToolName = name.substring(toolPrefix.length + 1);
|
|
974
|
+
}
|
|
975
|
+
|
|
952
976
|
// Check if method exists
|
|
953
|
-
if (!this[
|
|
977
|
+
if (!this[actualToolName]) {
|
|
954
978
|
throw new Error(`Unknown tool: ${name}`);
|
|
955
979
|
}
|
|
956
980
|
|
|
957
|
-
result = await this[
|
|
981
|
+
result = await this[actualToolName](args || {});
|
|
958
982
|
|
|
959
983
|
// Check if result has contentType (special format)
|
|
960
984
|
if (result && result.contentType === "text") {
|
package/src/utils/api_common.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
// Get config directory based on CONFIG_DIR and TOOL_PREFIX
|
|
5
|
+
const getConfigDir = () => {
|
|
6
|
+
let configDir = process.env.CONFIG_DIR;
|
|
7
|
+
if (!configDir) {
|
|
8
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
9
|
+
if (toolPrefix) {
|
|
10
|
+
configDir = `./.setting.${toolPrefix}`;
|
|
11
|
+
} else {
|
|
12
|
+
configDir = './.setting';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return configDir;
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
// Get API debug config file path
|
|
5
19
|
const getApiConfigPath = () => {
|
|
6
|
-
const configDir =
|
|
20
|
+
const configDir = getConfigDir();
|
|
7
21
|
return path.join(configDir, 'api.json');
|
|
8
22
|
};
|
|
9
23
|
|
|
@@ -30,7 +44,7 @@ const loadApiConfig = () => {
|
|
|
30
44
|
|
|
31
45
|
// Save API debug config
|
|
32
46
|
const saveApiConfig = (apiConfig) => {
|
|
33
|
-
const configDir =
|
|
47
|
+
const configDir = getConfigDir();
|
|
34
48
|
const apiConfigPath = path.join(configDir, 'api.json');
|
|
35
49
|
|
|
36
50
|
try {
|
|
@@ -125,6 +139,7 @@ const detectContentType = (body) => {
|
|
|
125
139
|
};
|
|
126
140
|
|
|
127
141
|
module.exports = {
|
|
142
|
+
getConfigDir,
|
|
128
143
|
getApiConfigPath,
|
|
129
144
|
loadApiConfig,
|
|
130
145
|
saveApiConfig,
|
package/src/utils/api_debug.js
CHANGED
|
@@ -37,33 +37,40 @@ const httpsAgent = new https.Agent({
|
|
|
37
37
|
async function api_debug(params, config, saveConfig) {
|
|
38
38
|
const { url, method = 'GET', headers = {}, query, body, contentType } = params || {};
|
|
39
39
|
|
|
40
|
+
// Resolve dynamic tool names based on prefix and project name
|
|
41
|
+
const toolPrefix = process.env.TOOL_PREFIX || '';
|
|
42
|
+
const projectName = process.env.PROJECT_NAME || '';
|
|
43
|
+
const hasCustomTools = !!(toolPrefix && projectName);
|
|
44
|
+
const configToolName = hasCustomTools ? `${toolPrefix}_api_config` : 'api_config';
|
|
45
|
+
const executeToolName = hasCustomTools ? `${toolPrefix}_api_execute` : 'api_execute';
|
|
46
|
+
|
|
40
47
|
if (!url) {
|
|
41
48
|
return {
|
|
42
49
|
contentType: "text",
|
|
43
50
|
content: [
|
|
44
51
|
{
|
|
45
52
|
type: "text",
|
|
46
|
-
text:
|
|
53
|
+
text: `⚠️ IMPORTANT: You MUST use addApi to add the API to the list first! Use ${configToolName} tool.\n\n🔧 Step 1: Add API to Configuration (REQUIRED)\n\nCall: ${configToolName} with action="addApi" and api={"url":"<your url>","method":"<METHOD>","body":"your corrected JSON here"}\n\n⚠️ REMINDER: You MUST use ${configToolName} with addApi to add the API to the list!`
|
|
47
54
|
},
|
|
48
55
|
{
|
|
49
56
|
type: "text",
|
|
50
|
-
text:
|
|
57
|
+
text: `🔧 Step 2: Execute API by Index\n\nAfter adding the API, call: ${executeToolName} with index=<returned index>\n\nThis will execute the pre-configured API with the correct format.`
|
|
51
58
|
},
|
|
52
59
|
{
|
|
53
60
|
type: "text",
|
|
54
|
-
text:
|
|
61
|
+
text: `🚨 REMINDER: You MUST use addApi first!\n\n- Use ${configToolName} with action="addApi" to add the API to the list\n- Then use ${executeToolName} with the returned index to execute`
|
|
55
62
|
},
|
|
56
63
|
{
|
|
57
64
|
type: "text",
|
|
58
|
-
text:
|
|
65
|
+
text: `💡 IMPORTANT: Remember to use addApi!\n\n- First: ${configToolName} with action="addApi" to add the API\n- Second: ${executeToolName} with index to run the API`
|
|
59
66
|
},
|
|
60
67
|
{
|
|
61
68
|
type: "text",
|
|
62
|
-
text:
|
|
69
|
+
text: `📋 Final Reminder: Use addApi → Then ${executeToolName}\n\n1. First: ${configToolName} with action="addApi"\n2. Then: ${executeToolName} with index=<number>\n\nThis is the ONLY way to handle invalid JSON requests.`
|
|
63
70
|
},
|
|
64
71
|
{
|
|
65
72
|
type: "text",
|
|
66
|
-
text:
|
|
73
|
+
text: `⚠️ ESSENTIAL: You MUST use addApi!\n\n- First: ${configToolName} with action="addApi" to add the API\n- Second: ${executeToolName} with index to run the API`
|
|
67
74
|
}
|
|
68
75
|
]
|
|
69
76
|
};
|
|
@@ -112,27 +119,27 @@ async function api_debug(params, config, saveConfig) {
|
|
|
112
119
|
content: [
|
|
113
120
|
{
|
|
114
121
|
type: "text",
|
|
115
|
-
text:
|
|
122
|
+
text: `⚠️ IMPORTANT: You MUST use addApi to add the API to the list first! Use ${configToolName} tool.\n\n🔧 Step 1: Add API to Configuration (REQUIRED)\n\nCall: ${configToolName} with action="addApi" and api={"url":"${url}","method":"${requestMethod}","body":"your corrected JSON here"}\n\n⚠️ REMINDER: You MUST use ${configToolName} with addApi to add the API to the list!`
|
|
116
123
|
},
|
|
117
124
|
{
|
|
118
125
|
type: "text",
|
|
119
|
-
text:
|
|
126
|
+
text: `🔧 Step 2: Execute API by Index\n\nAfter adding the API, call: ${executeToolName} with index=<returned index>\n\nThis will execute the pre-configured API with the correct format.`
|
|
120
127
|
},
|
|
121
128
|
{
|
|
122
129
|
type: "text",
|
|
123
|
-
text:
|
|
130
|
+
text: `🚨 REMINDER: You MUST use addApi first!\n\n- Use ${configToolName} with action="addApi" to add the API to the list\n- Then use ${executeToolName} with the returned index to execute`
|
|
124
131
|
},
|
|
125
132
|
{
|
|
126
133
|
type: "text",
|
|
127
|
-
text:
|
|
134
|
+
text: `💡 IMPORTANT: Remember to use addApi!\n\n- First: ${configToolName} with action="addApi" to add the API\n- Second: ${executeToolName} with index to run the API`
|
|
128
135
|
},
|
|
129
136
|
{
|
|
130
137
|
type: "text",
|
|
131
|
-
text:
|
|
138
|
+
text: `📋 Final Reminder: Use addApi → Then ${executeToolName}\n\n1. First: ${configToolName} with action="addApi"\n2. Then: ${executeToolName} with index=<number>\n\nThis is the ONLY way to handle invalid JSON requests.`
|
|
132
139
|
},
|
|
133
140
|
{
|
|
134
141
|
type: "text",
|
|
135
|
-
text:
|
|
142
|
+
text: `⚠️ ESSENTIAL: You MUST use addApi!\n\n- First: ${configToolName} with action="addApi" to add the API\n- Second: ${executeToolName} with index to run the API`
|
|
136
143
|
}
|
|
137
144
|
]
|
|
138
145
|
};
|