@qverisai/mcp 0.2.0 → 0.4.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 +7 -7
- package/dist/api/client.d.ts +8 -92
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +112 -125
- package/dist/api/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/execute.d.ts +5 -4
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/execute.js +18 -10
- package/dist/tools/execute.js.map +1 -1
- package/dist/types.d.ts +61 -61
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ Execute a discovered tool with specific parameters.
|
|
|
99
99
|
|-----------|------|----------|-------------|
|
|
100
100
|
| `tool_id` | string | ✓ | Tool ID from search results |
|
|
101
101
|
| `search_id` | string | ✓ | Search ID from the search that found this tool |
|
|
102
|
-
| `params_to_tool` |
|
|
102
|
+
| `params_to_tool` | object | ✓ | A dictionary of parameters to pass to the tool |
|
|
103
103
|
| `session_id` | string | | Session identifier (auto-generated if omitted) |
|
|
104
104
|
| `max_response_size` | number | | Max response size in bytes (default: 20480) |
|
|
105
105
|
|
|
@@ -109,7 +109,7 @@ Execute a discovered tool with specific parameters.
|
|
|
109
109
|
{
|
|
110
110
|
"tool_id": "openweathermap.weather.execute.v1",
|
|
111
111
|
"search_id": "abcd1234-ab12-ab12-ab12-abcdef123456",
|
|
112
|
-
"params_to_tool":
|
|
112
|
+
"params_to_tool": {"city": "London", "units": "metric"}
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
@@ -192,14 +192,14 @@ The `full_content_file_url` is valid for 120 minutes.
|
|
|
192
192
|
|
|
193
193
|
```bash
|
|
194
194
|
# Clone the repository
|
|
195
|
-
git clone https://github.com/
|
|
196
|
-
cd
|
|
195
|
+
git clone https://github.com/QVerisAI/QVerisAI.git
|
|
196
|
+
cd QVerisAI/packages/mcp
|
|
197
197
|
|
|
198
198
|
# Install dependencies
|
|
199
199
|
npm install
|
|
200
200
|
|
|
201
201
|
# Build
|
|
202
|
-
npm build
|
|
202
|
+
npm run build
|
|
203
203
|
|
|
204
204
|
# Run locally
|
|
205
205
|
QVERIS_API_KEY=your-key node dist/index.js
|
|
@@ -207,10 +207,10 @@ QVERIS_API_KEY=your-key node dist/index.js
|
|
|
207
207
|
|
|
208
208
|
## License
|
|
209
209
|
|
|
210
|
-
MIT © [QVerisAI](https://github.com/
|
|
210
|
+
MIT © [QVerisAI](https://github.com/QVerisAI)
|
|
211
211
|
|
|
212
212
|
## Support
|
|
213
213
|
|
|
214
|
-
- 🐛 [Issue Tracker](https://github.com/
|
|
214
|
+
- 🐛 [Issue Tracker](https://github.com/QVerisAI/QVerisAI/issues)
|
|
215
215
|
- 💬 Contact: contact@qveris.ai
|
|
216
216
|
|
package/dist/api/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Qveris API HTTP Client
|
|
3
3
|
*
|
|
4
4
|
* Provides a type-safe HTTP client for interacting with the Qveris REST API.
|
|
5
|
-
* Handles authentication, request formatting, and error handling.
|
|
5
|
+
* Handles authentication, request formatting, timeouts, and error handling.
|
|
6
6
|
*
|
|
7
7
|
* @module api/client
|
|
8
8
|
*/
|
|
@@ -17,13 +17,11 @@ import type { SearchRequest, SearchResponse, GetToolsByIdsRequest, ExecuteReques
|
|
|
17
17
|
* ```typescript
|
|
18
18
|
* const client = new QverisClient({ apiKey: 'your-api-key' });
|
|
19
19
|
*
|
|
20
|
-
* // Search for tools
|
|
21
20
|
* const searchResult = await client.searchTools({
|
|
22
21
|
* query: 'weather API',
|
|
23
22
|
* limit: 5
|
|
24
23
|
* });
|
|
25
24
|
*
|
|
26
|
-
* // Execute a tool
|
|
27
25
|
* const execResult = await client.executeTool('tool-id', {
|
|
28
26
|
* search_id: searchResult.search_id,
|
|
29
27
|
* parameters: { city: 'London' }
|
|
@@ -33,115 +31,33 @@ import type { SearchRequest, SearchResponse, GetToolsByIdsRequest, ExecuteReques
|
|
|
33
31
|
export declare class QverisClient {
|
|
34
32
|
private readonly apiKey;
|
|
35
33
|
private readonly baseUrl;
|
|
36
|
-
|
|
37
|
-
* Creates a new Qveris API client.
|
|
38
|
-
*
|
|
39
|
-
* @param config - Client configuration
|
|
40
|
-
* @throws {Error} If apiKey is not provided
|
|
41
|
-
*/
|
|
34
|
+
private readonly defaultTimeoutMs;
|
|
42
35
|
constructor(config: QverisClientConfig);
|
|
43
36
|
/**
|
|
44
37
|
* Makes an authenticated HTTP request to the Qveris API.
|
|
45
|
-
*
|
|
46
|
-
* @param method - HTTP method
|
|
47
|
-
* @param endpoint - API endpoint (relative to base URL)
|
|
48
|
-
* @param body - Request body (will be JSON serialized)
|
|
49
|
-
* @returns Parsed JSON response
|
|
50
|
-
* @throws {ApiError} If the request fails
|
|
51
38
|
*/
|
|
52
39
|
private request;
|
|
53
40
|
/**
|
|
54
41
|
* Search for tools based on a natural language query.
|
|
55
|
-
*
|
|
56
|
-
* Finds tools that match the described capability. Results include
|
|
57
|
-
* tool metadata, parameter schemas, and usage examples.
|
|
58
|
-
*
|
|
59
|
-
* @param request - Search parameters
|
|
60
|
-
* @returns Search results with matching tools
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* const result = await client.searchTools({
|
|
65
|
-
* query: 'send SMS message',
|
|
66
|
-
* limit: 10,
|
|
67
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456'
|
|
68
|
-
* });
|
|
69
|
-
*
|
|
70
|
-
* console.log(`Found ${result.total} tools`);
|
|
71
|
-
* for (const tool of result.results) {
|
|
72
|
-
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
42
|
+
* This is the Discover action and is free.
|
|
75
43
|
*/
|
|
76
44
|
searchTools(request: SearchRequest): Promise<SearchResponse>;
|
|
77
45
|
/**
|
|
78
46
|
* Get tool descriptions by their IDs.
|
|
79
|
-
*
|
|
80
|
-
* Retrieves detailed information about specific tools when you already
|
|
81
|
-
* know their tool_ids. Useful for refreshing tool metadata or getting
|
|
82
|
-
* details for tools from previous searches.
|
|
83
|
-
*
|
|
84
|
-
* @param request - Request parameters with tool IDs
|
|
85
|
-
* @returns Tool information matching the provided IDs
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* const result = await client.getToolsByIds({
|
|
90
|
-
* tool_ids: ['weather-tool-1', 'email-tool-2'],
|
|
91
|
-
* search_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
92
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456'
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* console.log(`Retrieved ${result.results.length} tools`);
|
|
96
|
-
* for (const tool of result.results) {
|
|
97
|
-
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
47
|
+
* This is the Inspect action and is free.
|
|
100
48
|
*/
|
|
101
49
|
getToolsByIds(request: GetToolsByIdsRequest): Promise<SearchResponse>;
|
|
102
50
|
/**
|
|
103
51
|
* Execute a tool with the specified parameters.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* The search_id links this execution to that search for analytics.
|
|
107
|
-
*
|
|
108
|
-
* @param toolId - The tool identifier from search results
|
|
109
|
-
* @param request - Execution parameters
|
|
110
|
-
* @returns Execution result
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* const result = await client.executeTool('openweathermap_current', {
|
|
115
|
-
* search_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
116
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
117
|
-
* parameters: {
|
|
118
|
-
* city: 'Tokyo',
|
|
119
|
-
* units: 'metric'
|
|
120
|
-
* }
|
|
121
|
-
* });
|
|
122
|
-
*
|
|
123
|
-
* if (result.success) {
|
|
124
|
-
* console.log('Result:', result.result);
|
|
125
|
-
* } else {
|
|
126
|
-
* console.error('Failed:', result.error_message);
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
52
|
+
* This is the Call action and costs 1-100 credits per call.
|
|
53
|
+
* Uses a longer timeout (120s) by default.
|
|
129
54
|
*/
|
|
130
55
|
executeTool(toolId: string, request: ExecuteRequest): Promise<ExecuteResponse>;
|
|
131
56
|
}
|
|
132
57
|
/**
|
|
133
58
|
* Creates a Qveris client from environment variables.
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* @returns Configured Qveris client
|
|
138
|
-
* @throws {Error} If QVERIS_API_KEY is not set
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```typescript
|
|
142
|
-
* // Ensure QVERIS_API_KEY is set in your environment
|
|
143
|
-
* const client = createClientFromEnv();
|
|
144
|
-
* ```
|
|
59
|
+
* Reads the API key from QVERIS_API_KEY. Region is auto-detected from key prefix
|
|
60
|
+
* (sk-cn-xxx → cn, sk-xxx → global), or overridden via QVERIS_REGION or QVERIS_BASE_URL.
|
|
145
61
|
*/
|
|
146
62
|
export declare function createClientFromEnv(): QverisClient;
|
|
147
63
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,kBAAkB,EAEnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AAkCrB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;gBAE9B,MAAM,EAAE,kBAAkB;IAUtC;;OAEG;YACW,OAAO;IAkFrB;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAIlE;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3E;;;;OAIG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC;CAS5B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAiBlD"}
|
package/dist/api/client.js
CHANGED
|
@@ -2,12 +2,40 @@
|
|
|
2
2
|
* Qveris API HTTP Client
|
|
3
3
|
*
|
|
4
4
|
* Provides a type-safe HTTP client for interacting with the Qveris REST API.
|
|
5
|
-
* Handles authentication, request formatting, and error handling.
|
|
5
|
+
* Handles authentication, request formatting, timeouts, and error handling.
|
|
6
6
|
*
|
|
7
7
|
* @module api/client
|
|
8
8
|
*/
|
|
9
|
-
/**
|
|
10
|
-
const
|
|
9
|
+
/** Region-specific API base URLs */
|
|
10
|
+
const REGION_URLS = {
|
|
11
|
+
global: 'https://qveris.ai/api/v1',
|
|
12
|
+
cn: 'https://qveris.cn/api/v1',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Detect region from API key prefix.
|
|
16
|
+
* sk-cn-xxx → cn, sk-xxx → global
|
|
17
|
+
*/
|
|
18
|
+
function detectRegionFromKey(apiKey) {
|
|
19
|
+
return apiKey.startsWith('sk-cn-') ? 'cn' : 'global';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the base URL for the QVeris API.
|
|
23
|
+
* Priority: explicit baseUrl > QVERIS_BASE_URL env > QVERIS_REGION env > key prefix auto-detect > default
|
|
24
|
+
*/
|
|
25
|
+
function resolveBaseUrl(apiKey, explicitBaseUrl) {
|
|
26
|
+
if (explicitBaseUrl)
|
|
27
|
+
return explicitBaseUrl.replace(/\/+$/, '');
|
|
28
|
+
if (process.env.QVERIS_BASE_URL)
|
|
29
|
+
return process.env.QVERIS_BASE_URL.replace(/\/+$/, '');
|
|
30
|
+
if (process.env.QVERIS_REGION) {
|
|
31
|
+
const region = process.env.QVERIS_REGION.toLowerCase();
|
|
32
|
+
return REGION_URLS[region] ?? REGION_URLS.global;
|
|
33
|
+
}
|
|
34
|
+
return REGION_URLS[detectRegionFromKey(apiKey)];
|
|
35
|
+
}
|
|
36
|
+
/** Default timeout: 30s for search/inspect, 120s for execute */
|
|
37
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
38
|
+
const EXECUTE_TIMEOUT_MS = 120_000;
|
|
11
39
|
/**
|
|
12
40
|
* Qveris API Client
|
|
13
41
|
*
|
|
@@ -18,13 +46,11 @@ const DEFAULT_BASE_URL = 'https://qveris.ai/api/v1';
|
|
|
18
46
|
* ```typescript
|
|
19
47
|
* const client = new QverisClient({ apiKey: 'your-api-key' });
|
|
20
48
|
*
|
|
21
|
-
* // Search for tools
|
|
22
49
|
* const searchResult = await client.searchTools({
|
|
23
50
|
* query: 'weather API',
|
|
24
51
|
* limit: 5
|
|
25
52
|
* });
|
|
26
53
|
*
|
|
27
|
-
* // Execute a tool
|
|
28
54
|
* const execResult = await client.executeTool('tool-id', {
|
|
29
55
|
* search_id: searchResult.search_id,
|
|
30
56
|
* parameters: { city: 'London' }
|
|
@@ -34,168 +60,129 @@ const DEFAULT_BASE_URL = 'https://qveris.ai/api/v1';
|
|
|
34
60
|
export class QverisClient {
|
|
35
61
|
apiKey;
|
|
36
62
|
baseUrl;
|
|
37
|
-
|
|
38
|
-
* Creates a new Qveris API client.
|
|
39
|
-
*
|
|
40
|
-
* @param config - Client configuration
|
|
41
|
-
* @throws {Error} If apiKey is not provided
|
|
42
|
-
*/
|
|
63
|
+
defaultTimeoutMs;
|
|
43
64
|
constructor(config) {
|
|
44
65
|
if (!config.apiKey) {
|
|
45
66
|
throw new Error('Qveris API key is required');
|
|
46
67
|
}
|
|
47
68
|
this.apiKey = config.apiKey;
|
|
48
|
-
|
|
69
|
+
// Resolve base URL: explicit > env > key prefix auto-detect
|
|
70
|
+
this.baseUrl = resolveBaseUrl(config.apiKey, config.baseUrl);
|
|
71
|
+
this.defaultTimeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
49
72
|
}
|
|
50
73
|
/**
|
|
51
74
|
* Makes an authenticated HTTP request to the Qveris API.
|
|
52
|
-
*
|
|
53
|
-
* @param method - HTTP method
|
|
54
|
-
* @param endpoint - API endpoint (relative to base URL)
|
|
55
|
-
* @param body - Request body (will be JSON serialized)
|
|
56
|
-
* @returns Parsed JSON response
|
|
57
|
-
* @throws {ApiError} If the request fails
|
|
58
75
|
*/
|
|
59
|
-
async request(method, endpoint, body) {
|
|
76
|
+
async request(method, endpoint, body, timeoutMs) {
|
|
60
77
|
const url = `${this.baseUrl}${endpoint}`;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs ?? this.defaultTimeoutMs);
|
|
80
|
+
try {
|
|
81
|
+
const response = await fetch(url, {
|
|
82
|
+
method,
|
|
83
|
+
headers: {
|
|
84
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
},
|
|
87
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
88
|
+
signal: controller.signal,
|
|
89
|
+
});
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
const status = response.status;
|
|
92
|
+
let errorMessage;
|
|
93
|
+
let errorDetails;
|
|
94
|
+
try {
|
|
95
|
+
const errorBody = (await response.json());
|
|
96
|
+
errorMessage =
|
|
97
|
+
errorBody.error_message ||
|
|
98
|
+
errorBody.message ||
|
|
99
|
+
errorBody.error ||
|
|
100
|
+
response.statusText;
|
|
101
|
+
errorDetails = errorBody;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
errorMessage = response.statusText || `HTTP ${status}`;
|
|
105
|
+
}
|
|
106
|
+
// Provide actionable hints for specific status codes
|
|
107
|
+
if (status === 402) {
|
|
108
|
+
errorMessage = `Insufficient credits. ${errorMessage}. Purchase credits at https://qveris.ai/pricing`;
|
|
109
|
+
}
|
|
110
|
+
const error = {
|
|
111
|
+
status,
|
|
112
|
+
message: errorMessage,
|
|
113
|
+
details: errorDetails,
|
|
114
|
+
};
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
72
117
|
try {
|
|
73
|
-
|
|
74
|
-
errorMessage =
|
|
75
|
-
errorBody.message ||
|
|
76
|
-
errorBody.error ||
|
|
77
|
-
response.statusText;
|
|
78
|
-
errorDetails = errorBody;
|
|
118
|
+
return await response.json();
|
|
79
119
|
}
|
|
80
120
|
catch {
|
|
81
|
-
|
|
121
|
+
const error = {
|
|
122
|
+
status: response.status,
|
|
123
|
+
message: 'Invalid or empty JSON response from API',
|
|
124
|
+
};
|
|
125
|
+
throw error;
|
|
82
126
|
}
|
|
83
|
-
const error = {
|
|
84
|
-
status: response.status,
|
|
85
|
-
message: errorMessage,
|
|
86
|
-
details: errorDetails,
|
|
87
|
-
};
|
|
88
|
-
throw error;
|
|
89
127
|
}
|
|
90
|
-
|
|
128
|
+
catch (err) {
|
|
129
|
+
if (err && typeof err === 'object' && 'status' in err) {
|
|
130
|
+
// ApiError — rethrow as-is
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
134
|
+
const error = {
|
|
135
|
+
status: 408,
|
|
136
|
+
message: 'Request timed out. Check connectivity or increase timeout.',
|
|
137
|
+
};
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
throw err;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
clearTimeout(timeout);
|
|
144
|
+
}
|
|
91
145
|
}
|
|
92
146
|
/**
|
|
93
147
|
* Search for tools based on a natural language query.
|
|
94
|
-
*
|
|
95
|
-
* Finds tools that match the described capability. Results include
|
|
96
|
-
* tool metadata, parameter schemas, and usage examples.
|
|
97
|
-
*
|
|
98
|
-
* @param request - Search parameters
|
|
99
|
-
* @returns Search results with matching tools
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const result = await client.searchTools({
|
|
104
|
-
* query: 'send SMS message',
|
|
105
|
-
* limit: 10,
|
|
106
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456'
|
|
107
|
-
* });
|
|
108
|
-
*
|
|
109
|
-
* console.log(`Found ${result.total} tools`);
|
|
110
|
-
* for (const tool of result.results) {
|
|
111
|
-
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
148
|
+
* This is the Discover action and is free.
|
|
114
149
|
*/
|
|
115
150
|
async searchTools(request) {
|
|
116
151
|
return this.request('POST', '/search', request);
|
|
117
152
|
}
|
|
118
153
|
/**
|
|
119
154
|
* Get tool descriptions by their IDs.
|
|
120
|
-
*
|
|
121
|
-
* Retrieves detailed information about specific tools when you already
|
|
122
|
-
* know their tool_ids. Useful for refreshing tool metadata or getting
|
|
123
|
-
* details for tools from previous searches.
|
|
124
|
-
*
|
|
125
|
-
* @param request - Request parameters with tool IDs
|
|
126
|
-
* @returns Tool information matching the provided IDs
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const result = await client.getToolsByIds({
|
|
131
|
-
* tool_ids: ['weather-tool-1', 'email-tool-2'],
|
|
132
|
-
* search_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
133
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456'
|
|
134
|
-
* });
|
|
135
|
-
*
|
|
136
|
-
* console.log(`Retrieved ${result.results.length} tools`);
|
|
137
|
-
* for (const tool of result.results) {
|
|
138
|
-
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
139
|
-
* }
|
|
140
|
-
* ```
|
|
155
|
+
* This is the Inspect action and is free.
|
|
141
156
|
*/
|
|
142
157
|
async getToolsByIds(request) {
|
|
143
158
|
return this.request('POST', '/tools/by-ids', request);
|
|
144
159
|
}
|
|
145
160
|
/**
|
|
146
161
|
* Execute a tool with the specified parameters.
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* The search_id links this execution to that search for analytics.
|
|
150
|
-
*
|
|
151
|
-
* @param toolId - The tool identifier from search results
|
|
152
|
-
* @param request - Execution parameters
|
|
153
|
-
* @returns Execution result
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* const result = await client.executeTool('openweathermap_current', {
|
|
158
|
-
* search_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
159
|
-
* session_id: 'abcd1234-ab12-ab12-ab12-abcdef123456',
|
|
160
|
-
* parameters: {
|
|
161
|
-
* city: 'Tokyo',
|
|
162
|
-
* units: 'metric'
|
|
163
|
-
* }
|
|
164
|
-
* });
|
|
165
|
-
*
|
|
166
|
-
* if (result.success) {
|
|
167
|
-
* console.log('Result:', result.result);
|
|
168
|
-
* } else {
|
|
169
|
-
* console.error('Failed:', result.error_message);
|
|
170
|
-
* }
|
|
171
|
-
* ```
|
|
162
|
+
* This is the Call action and costs 1-100 credits per call.
|
|
163
|
+
* Uses a longer timeout (120s) by default.
|
|
172
164
|
*/
|
|
173
165
|
async executeTool(toolId, request) {
|
|
174
166
|
const endpoint = `/tools/execute?tool_id=${encodeURIComponent(toolId)}`;
|
|
175
|
-
return this.request('POST', endpoint, request);
|
|
167
|
+
return this.request('POST', endpoint, request, EXECUTE_TIMEOUT_MS);
|
|
176
168
|
}
|
|
177
169
|
}
|
|
178
170
|
/**
|
|
179
171
|
* Creates a Qveris client from environment variables.
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* @returns Configured Qveris client
|
|
184
|
-
* @throws {Error} If QVERIS_API_KEY is not set
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```typescript
|
|
188
|
-
* // Ensure QVERIS_API_KEY is set in your environment
|
|
189
|
-
* const client = createClientFromEnv();
|
|
190
|
-
* ```
|
|
172
|
+
* Reads the API key from QVERIS_API_KEY. Region is auto-detected from key prefix
|
|
173
|
+
* (sk-cn-xxx → cn, sk-xxx → global), or overridden via QVERIS_REGION or QVERIS_BASE_URL.
|
|
191
174
|
*/
|
|
192
175
|
export function createClientFromEnv() {
|
|
193
176
|
const apiKey = process.env.QVERIS_API_KEY;
|
|
194
177
|
if (!apiKey) {
|
|
195
178
|
throw new Error('QVERIS_API_KEY environment variable is required.\n' +
|
|
196
|
-
'
|
|
197
|
-
'
|
|
179
|
+
'Global: https://qveris.ai/account?page=api-keys\n' +
|
|
180
|
+
'China: https://qveris.cn/account?page=api-keys');
|
|
198
181
|
}
|
|
199
|
-
|
|
182
|
+
const client = new QverisClient({ apiKey });
|
|
183
|
+
const region = detectRegionFromKey(apiKey);
|
|
184
|
+
const effectiveUrl = resolveBaseUrl(apiKey);
|
|
185
|
+
console.error(`Region: ${region} (${effectiveUrl})`);
|
|
186
|
+
return client;
|
|
200
187
|
}
|
|
201
188
|
//# sourceMappingURL=client.js.map
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,oCAAoC;AACpC,MAAM,WAAW,GAA2B;IAC1C,MAAM,EAAE,0BAA0B;IAClC,EAAE,EAAE,0BAA0B;CAC/B,CAAC;AAEF;;;GAGG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,MAAc,EAAE,eAAwB;IAC9D,IAAI,eAAe;QAAE,OAAO,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChE,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxF,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;QACvD,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC;IACnD,CAAC;IACD,OAAO,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,gEAAgE;AAChE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAY;IACN,MAAM,CAAS;IACf,OA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+7,7 @@
|
|
|
7
7
|
* and execute third-party tools via natural language.
|
|
8
8
|
*
|
|
9
9
|
* @module @qverisai/mcp
|
|
10
|
-
* @version
|
|
10
|
+
* @version Read from package.json at runtime
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* Configure in Claude Desktop or Cursor:
|
|
@@ -34,8 +34,10 @@ import { getToolsByIdsSchema, executeGetToolsByIds, } from './tools/get-by-ids.j
|
|
|
34
34
|
// ============================================================================
|
|
35
35
|
// Server Configuration
|
|
36
36
|
// ============================================================================
|
|
37
|
+
import { createRequire } from 'node:module';
|
|
37
38
|
const SERVER_NAME = 'qveris';
|
|
38
|
-
const
|
|
39
|
+
const require = createRequire(import.meta.url);
|
|
40
|
+
const { version: SERVER_VERSION } = require('../package.json');
|
|
39
41
|
/**
|
|
40
42
|
* Main entry point for the Qveris MCP Server.
|
|
41
43
|
*
|
|
@@ -105,7 +107,7 @@ async function main() {
|
|
|
105
107
|
const { name, arguments: args } = request.params;
|
|
106
108
|
try {
|
|
107
109
|
if (name === 'search_tools') {
|
|
108
|
-
const input = args;
|
|
110
|
+
const input = (args ?? {});
|
|
109
111
|
// Validate required fields
|
|
110
112
|
if (!input.query || typeof input.query !== 'string') {
|
|
111
113
|
return {
|
|
@@ -132,7 +134,7 @@ async function main() {
|
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
136
|
if (name === 'get_tools_by_ids') {
|
|
135
|
-
const input = args;
|
|
137
|
+
const input = (args ?? {});
|
|
136
138
|
// Validate required fields
|
|
137
139
|
if (!input.tool_ids || !Array.isArray(input.tool_ids) || input.tool_ids.length === 0) {
|
|
138
140
|
return {
|
|
@@ -159,7 +161,7 @@ async function main() {
|
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
163
|
if (name === 'execute_tool') {
|
|
162
|
-
const input = args;
|
|
164
|
+
const input = (args ?? {});
|
|
163
165
|
// Validate required fields
|
|
164
166
|
const missingFields = [];
|
|
165
167
|
if (!input.tool_id)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAgB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAG/B,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,MAAM,WAAW,GAAG,QAAQ,CAAC;AAC7B,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAgB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAA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AC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools/execute.d.ts
CHANGED
|
@@ -23,13 +23,14 @@ export interface ExecuteToolInput {
|
|
|
23
23
|
*/
|
|
24
24
|
search_id: string;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Dictionary of parameters to pass to the remote tool.
|
|
27
27
|
* Keys are parameter names, values can be of any type.
|
|
28
|
+
* Can be provided as an object directly or as a JSON string (legacy).
|
|
28
29
|
*
|
|
29
|
-
* @example
|
|
30
|
-
* @example
|
|
30
|
+
* @example {"city": "London", "units": "metric"}
|
|
31
|
+
* @example {"query": "AI news", "limit": 10}
|
|
31
32
|
*/
|
|
32
|
-
params_to_tool: string;
|
|
33
|
+
params_to_tool: Record<string, unknown> | string;
|
|
33
34
|
/**
|
|
34
35
|
* Session identifier for tracking user sessions.
|
|
35
36
|
* If not provided, the server will use an auto-generated session ID.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAEjD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC7B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,eAAe,CAAC,CA0B1B"}
|
package/dist/tools/execute.js
CHANGED
|
@@ -23,10 +23,10 @@ export const executeToolSchema = {
|
|
|
23
23
|
'Required for linking execution to the original search.',
|
|
24
24
|
},
|
|
25
25
|
params_to_tool: {
|
|
26
|
-
type: '
|
|
27
|
-
description: 'A
|
|
26
|
+
type: 'object',
|
|
27
|
+
description: 'A dictionary of parameters to pass to the remote tool. ' +
|
|
28
28
|
'Keys are param names and values can be of any type. ' +
|
|
29
|
-
'Example:
|
|
29
|
+
'Example: {"city": "London", "units": "metric"}',
|
|
30
30
|
},
|
|
31
31
|
session_id: {
|
|
32
32
|
type: 'string',
|
|
@@ -41,7 +41,7 @@ export const executeToolSchema = {
|
|
|
41
41
|
default: 20480,
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
|
-
required: ['tool_id', 'params_to_tool'],
|
|
44
|
+
required: ['tool_id', 'search_id', 'params_to_tool'],
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Executes the execute_tool operation.
|
|
@@ -53,14 +53,22 @@ export const executeToolSchema = {
|
|
|
53
53
|
* @throws {Error} If params_to_tool is not valid JSON
|
|
54
54
|
*/
|
|
55
55
|
export async function executeExecuteTool(client, input, defaultSessionId) {
|
|
56
|
-
//
|
|
56
|
+
// Resolve parameters: accept object directly or JSON string (legacy compat)
|
|
57
57
|
let parameters;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (typeof input.params_to_tool === 'string') {
|
|
59
|
+
try {
|
|
60
|
+
parameters = JSON.parse(input.params_to_tool);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw new Error(`Invalid JSON in params_to_tool: ${error instanceof Error ? error.message : 'Unknown parse error'}. ` +
|
|
64
|
+
`Received: ${input.params_to_tool}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (typeof input.params_to_tool === 'object' && input.params_to_tool !== null) {
|
|
68
|
+
parameters = input.params_to_tool;
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`Received: ${input.params_to_tool}`);
|
|
70
|
+
else {
|
|
71
|
+
parameters = {};
|
|
64
72
|
}
|
|
65
73
|
const response = await client.executeTool(input.tool_id, {
|
|
66
74
|
search_id: input.search_id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgDH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,oFAAoF;SACvF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,wEAAwE;gBACxE,wDAAwD;SAC3D;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,yDAAyD;gBACzD,sDAAsD;gBACtD,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AAiB,EAAE,KAAK,CAAC,iBAAiB;KAC3C,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Qveris API Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* This module contains TypeScript types that match the Qveris API
|
|
5
|
-
*
|
|
4
|
+
* This module contains TypeScript types that match the Qveris API schema.
|
|
5
|
+
* Aligned with backend ToolInfo, SearchResponse, ToolCallResponse, and
|
|
6
|
+
* the REST API documentation at docs/en-US/rest-api.md.
|
|
6
7
|
*
|
|
7
8
|
* @module types
|
|
8
9
|
* @see {@link https://qveris.ai/api/v1} Qveris API Base URL
|
|
9
10
|
*/
|
|
10
11
|
/**
|
|
11
12
|
* Request body for the Search Tools API.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const request: SearchRequest = {
|
|
16
|
-
* query: "weather forecast API",
|
|
17
|
-
* limit: 10,
|
|
18
|
-
* session_id: "abcd1234-ab12-ab12-ab12-abcdef123456"
|
|
19
|
-
* };
|
|
20
|
-
* ```
|
|
21
13
|
*/
|
|
22
14
|
export interface SearchRequest {
|
|
23
|
-
/**
|
|
24
|
-
* Natural language search query describing the tool capability you need.
|
|
25
|
-
* @example "weather forecast API"
|
|
26
|
-
* @example "send email notification"
|
|
27
|
-
*/
|
|
15
|
+
/** Natural language search query describing the tool capability you need. */
|
|
28
16
|
query: string;
|
|
29
17
|
/**
|
|
30
18
|
* Maximum number of results to return.
|
|
@@ -33,15 +21,11 @@ export interface SearchRequest {
|
|
|
33
21
|
* @maximum 100
|
|
34
22
|
*/
|
|
35
23
|
limit?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Session identifier for tracking user sessions.
|
|
38
|
-
* Same ID corresponds to the same user session.
|
|
39
|
-
*/
|
|
24
|
+
/** Session identifier for tracking user sessions. */
|
|
40
25
|
session_id?: string;
|
|
41
26
|
}
|
|
42
27
|
/**
|
|
43
28
|
* Parameter definition for a tool.
|
|
44
|
-
* Describes a single input parameter that a tool accepts.
|
|
45
29
|
*/
|
|
46
30
|
export interface ToolParameter {
|
|
47
31
|
/** Parameter name (used as key in the parameters object) */
|
|
@@ -62,6 +46,17 @@ export interface ToolExamples {
|
|
|
62
46
|
/** Sample parameter values demonstrating typical usage */
|
|
63
47
|
sample_parameters?: Record<string, unknown>;
|
|
64
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Historical execution performance statistics for a tool.
|
|
51
|
+
*/
|
|
52
|
+
export interface ToolStats {
|
|
53
|
+
/** Historical average execution time in milliseconds */
|
|
54
|
+
avg_execution_time_ms?: number;
|
|
55
|
+
/** Historical success rate (0.0 - 1.0) */
|
|
56
|
+
success_rate?: number;
|
|
57
|
+
/** Estimated cost in credits per call */
|
|
58
|
+
cost?: number;
|
|
59
|
+
}
|
|
65
60
|
/**
|
|
66
61
|
* Information about a tool returned from search results.
|
|
67
62
|
* Contains everything needed to understand and execute the tool.
|
|
@@ -73,30 +68,48 @@ export interface ToolInfo {
|
|
|
73
68
|
name: string;
|
|
74
69
|
/** Detailed description of what the tool does */
|
|
75
70
|
description: string;
|
|
71
|
+
/** Tool categories/tags */
|
|
72
|
+
categories?: string[];
|
|
76
73
|
/** Name of the organization/service providing this tool */
|
|
77
74
|
provider_name?: string;
|
|
78
75
|
/** Description of the provider */
|
|
79
76
|
provider_description?: string;
|
|
77
|
+
/** Provider website URL */
|
|
78
|
+
provider_website_url?: string;
|
|
80
79
|
/**
|
|
81
80
|
* Geographic availability of the tool.
|
|
82
81
|
* - "global" - Available worldwide
|
|
83
82
|
* - "US|CA" - Whitelist: only available in US and Canada
|
|
84
|
-
* - "
|
|
83
|
+
* - "-CN|RU" - Blacklist: not available in China and Russia
|
|
85
84
|
*/
|
|
86
85
|
region?: string;
|
|
87
|
-
/** Average response latency in milliseconds */
|
|
88
|
-
avg_latency_ms?: number;
|
|
89
86
|
/** List of parameters the tool accepts */
|
|
90
87
|
params?: ToolParameter[];
|
|
91
88
|
/** Usage examples with sample parameters */
|
|
92
89
|
examples?: ToolExamples;
|
|
90
|
+
/** Historical execution performance statistics */
|
|
91
|
+
stats?: ToolStats;
|
|
92
|
+
/** Relevance score for the search query (0.0 - 1.0, higher = better match) */
|
|
93
|
+
final_score?: number;
|
|
94
|
+
/** Whether this tool has been executed before (verified in production) */
|
|
95
|
+
has_last_execution?: boolean;
|
|
96
|
+
/** Most recent execution record, if available */
|
|
97
|
+
last_execution_record?: Record<string, unknown>;
|
|
98
|
+
/** Documentation URL for the tool */
|
|
99
|
+
docs_url?: string;
|
|
100
|
+
/** Protocol type */
|
|
101
|
+
protocol?: string;
|
|
93
102
|
}
|
|
94
103
|
/**
|
|
95
104
|
* Performance statistics for a search operation.
|
|
96
105
|
*/
|
|
97
106
|
export interface SearchStats {
|
|
98
107
|
/** Total time to complete the search in milliseconds */
|
|
99
|
-
search_time_ms
|
|
108
|
+
search_time_ms?: number;
|
|
109
|
+
/** Vector recall count */
|
|
110
|
+
vector_recall_count?: number;
|
|
111
|
+
/** Fulltext recall count */
|
|
112
|
+
fulltext_recall_count?: number;
|
|
100
113
|
}
|
|
101
114
|
/**
|
|
102
115
|
* Response from the Search Tools API.
|
|
@@ -115,58 +128,32 @@ export interface SearchResponse {
|
|
|
115
128
|
results: ToolInfo[];
|
|
116
129
|
/** Search performance statistics */
|
|
117
130
|
stats?: SearchStats;
|
|
131
|
+
/** User's remaining credits after this operation */
|
|
132
|
+
remaining_credits?: number;
|
|
133
|
+
/** Total elapsed time in milliseconds */
|
|
134
|
+
elapsed_time_ms?: number;
|
|
118
135
|
}
|
|
119
136
|
/**
|
|
120
137
|
* Request body for the Get Tools by IDs API.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* const request: GetToolsByIdsRequest = {
|
|
125
|
-
* tool_ids: ["tool-1", "tool-2"],
|
|
126
|
-
* search_id: "search-123",
|
|
127
|
-
* session_id: "abcd1234-ab12-ab12-ab12-abcdef123456"
|
|
128
|
-
* };
|
|
129
|
-
* ```
|
|
130
138
|
*/
|
|
131
139
|
export interface GetToolsByIdsRequest {
|
|
132
|
-
/**
|
|
133
|
-
* Array of tool IDs to retrieve information for.
|
|
134
|
-
*/
|
|
140
|
+
/** Array of tool IDs to retrieve information for. */
|
|
135
141
|
tool_ids: string[];
|
|
136
|
-
/**
|
|
137
|
-
* The search_id from the search that returned the tool(s).
|
|
138
|
-
* Optional but recommended for analytics and billing.
|
|
139
|
-
*/
|
|
142
|
+
/** The search_id from the search that returned the tool(s). */
|
|
140
143
|
search_id?: string;
|
|
141
|
-
/**
|
|
142
|
-
* Session identifier for tracking user sessions.
|
|
143
|
-
* Same ID corresponds to the same user session.
|
|
144
|
-
*/
|
|
144
|
+
/** Session identifier for tracking user sessions. */
|
|
145
145
|
session_id?: string;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Request body for the Execute Tool API.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```typescript
|
|
152
|
-
* const request: ExecuteRequest = {
|
|
153
|
-
* search_id: "abcd1234-ab12-ab12-ab12-abcdef123456",
|
|
154
|
-
* session_id: "abcd1234-ab12-ab12-ab12-abcdef123456",
|
|
155
|
-
* parameters: { city: "London", units: "metric" },
|
|
156
|
-
* max_response_size: 20480
|
|
157
|
-
* };
|
|
158
|
-
* ```
|
|
159
149
|
*/
|
|
160
150
|
export interface ExecuteRequest {
|
|
161
151
|
/**
|
|
162
152
|
* The search_id from the search that returned this tool.
|
|
163
|
-
* Links the execution to the original search for analytics.
|
|
153
|
+
* Links the execution to the original search for analytics and billing.
|
|
164
154
|
*/
|
|
165
155
|
search_id: string;
|
|
166
|
-
/**
|
|
167
|
-
* Session identifier for tracking user sessions.
|
|
168
|
-
* Same ID corresponds to the same user session.
|
|
169
|
-
*/
|
|
156
|
+
/** Session identifier for tracking user sessions. */
|
|
170
157
|
session_id?: string;
|
|
171
158
|
/**
|
|
172
159
|
* Key-value pairs of parameters to pass to the tool.
|
|
@@ -206,6 +193,11 @@ export interface ExecuteResultTruncated {
|
|
|
206
193
|
* Useful for previewing the data structure.
|
|
207
194
|
*/
|
|
208
195
|
truncated_content: string;
|
|
196
|
+
/**
|
|
197
|
+
* JSON Schema describing the structure of the full content.
|
|
198
|
+
* Helps the agent understand the data shape without downloading.
|
|
199
|
+
*/
|
|
200
|
+
content_schema?: Record<string, unknown>;
|
|
209
201
|
}
|
|
210
202
|
/**
|
|
211
203
|
* Union type for execution results (either full data or truncated).
|
|
@@ -235,8 +227,14 @@ export interface ExecuteResponse {
|
|
|
235
227
|
error_message?: string | null;
|
|
236
228
|
/** Execution duration in seconds */
|
|
237
229
|
execution_time?: number;
|
|
230
|
+
/** Execution duration in milliseconds (alternative field) */
|
|
231
|
+
elapsed_time_ms?: number;
|
|
232
|
+
/** Credits consumed by this execution */
|
|
233
|
+
cost?: number;
|
|
234
|
+
/** User's remaining credits after this execution */
|
|
235
|
+
remaining_credits?: number;
|
|
238
236
|
/** Timestamp of execution (ISO 8601 format) */
|
|
239
|
-
created_at
|
|
237
|
+
created_at?: string;
|
|
240
238
|
}
|
|
241
239
|
/**
|
|
242
240
|
* Configuration options for the Qveris API client.
|
|
@@ -246,6 +244,8 @@ export interface QverisClientConfig {
|
|
|
246
244
|
apiKey: string;
|
|
247
245
|
/** Base URL for the API (defaults to production) */
|
|
248
246
|
baseUrl?: string;
|
|
247
|
+
/** Default request timeout in milliseconds */
|
|
248
|
+
timeoutMs?: number;
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* Error response from the Qveris API.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"A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6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IAEf,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Qveris API Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* This module contains TypeScript types that match the Qveris API
|
|
5
|
-
*
|
|
4
|
+
* This module contains TypeScript types that match the Qveris API schema.
|
|
5
|
+
* Aligned with backend ToolInfo, SearchResponse, ToolCallResponse, and
|
|
6
|
+
* the REST API documentation at docs/en-US/rest-api.md.
|
|
6
7
|
*
|
|
7
8
|
* @module types
|
|
8
9
|
* @see {@link https://qveris.ai/api/v1} Qveris API Base URL
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qverisai/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Official QVeris AI MCP Server SDK - Search and execute tools via natural language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"qveris",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/QVerisAI/QVerisAI",
|
|
18
|
+
"directory": "packages/mcp"
|
|
18
19
|
},
|
|
19
|
-
"homepage": "https://
|
|
20
|
+
"homepage": "https://qveris.ai",
|
|
20
21
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/
|
|
22
|
+
"url": "https://github.com/QVerisAI/QVerisAI/issues"
|
|
22
23
|
},
|
|
23
24
|
"type": "module",
|
|
24
25
|
"main": "dist/index.js",
|