@qverisai/mcp 0.1.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/dist/index.js ADDED
@@ -0,0 +1,268 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Qveris MCP Server
4
+ *
5
+ * A Model Context Protocol (MCP) server that provides access to the Qveris
6
+ * tool discovery and execution API. Enables LLMs to dynamically search for
7
+ * and execute third-party tools via natural language.
8
+ *
9
+ * @module @qverisai/mcp
10
+ * @version 0.1.0
11
+ *
12
+ * @example
13
+ * Configure in Claude Desktop or Cursor:
14
+ * ```json
15
+ * {
16
+ * "mcpServers": {
17
+ * "qveris": {
18
+ * "command": "npx",
19
+ * "args": ["@qverisai/mcp"],
20
+ * "env": { "QVERIS_API_KEY": "your-api-key" }
21
+ * }
22
+ * }
23
+ * }
24
+ * ```
25
+ */
26
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
27
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
28
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
29
+ import { v4 as uuidv4 } from 'uuid';
30
+ import { createClientFromEnv } from './api/client.js';
31
+ import { searchToolsSchema, executeSearchTools, } from './tools/search.js';
32
+ import { executeToolSchema, executeExecuteTool, } from './tools/execute.js';
33
+ import { getToolsByIdsSchema, executeGetToolsByIds, } from './tools/get-by-ids.js';
34
+ // ============================================================================
35
+ // Server Configuration
36
+ // ============================================================================
37
+ const SERVER_NAME = 'qveris';
38
+ const SERVER_VERSION = '0.1.0';
39
+ /**
40
+ * Main entry point for the Qveris MCP Server.
41
+ *
42
+ * Sets up the MCP server with stdio transport, registers the search_tools
43
+ * and execute_tool handlers, and starts listening for requests.
44
+ */
45
+ async function main() {
46
+ // Initialize API client (validates QVERIS_API_KEY)
47
+ let client;
48
+ try {
49
+ client = createClientFromEnv();
50
+ }
51
+ catch (error) {
52
+ console.error(error instanceof Error ? error.message : 'Failed to initialize Qveris client');
53
+ process.exit(1);
54
+ }
55
+ // Generate a default session ID for this server instance
56
+ const defaultSessionId = uuidv4();
57
+ // Create MCP server
58
+ const server = new Server({
59
+ name: SERVER_NAME,
60
+ version: SERVER_VERSION,
61
+ }, {
62
+ capabilities: {
63
+ tools: {},
64
+ },
65
+ });
66
+ // =========================================================================
67
+ // Tool Handlers
68
+ // =========================================================================
69
+ /**
70
+ * Lists available tools.
71
+ * Returns the search_tools, get_tools_by_ids, and execute_tool definitions.
72
+ */
73
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
74
+ return {
75
+ tools: [
76
+ {
77
+ name: 'search_tools',
78
+ description: 'Search for available tools based on natural language queries. ' +
79
+ 'Returns relevant tools that can help accomplish tasks. ' +
80
+ 'Use this to discover tools before executing them.',
81
+ inputSchema: searchToolsSchema,
82
+ },
83
+ {
84
+ name: 'get_tools_by_ids',
85
+ description: 'Get descriptions of tools based on their tool IDs. ' +
86
+ 'Useful for retrieving detailed information about specific tools ' +
87
+ 'when you already know their tool_ids from previous searches.',
88
+ inputSchema: getToolsByIdsSchema,
89
+ },
90
+ {
91
+ name: 'execute_tool',
92
+ description: 'Execute a specific remote tool with provided parameters. ' +
93
+ 'The tool_id and search_id must come from a previous search_tools call. ' +
94
+ 'Pass parameters to the tool through params_to_tool as a JSON string.',
95
+ inputSchema: executeToolSchema,
96
+ },
97
+ ],
98
+ };
99
+ });
100
+ /**
101
+ * Handles tool execution requests.
102
+ * Routes to the appropriate handler based on tool name.
103
+ */
104
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
105
+ const { name, arguments: args } = request.params;
106
+ try {
107
+ if (name === 'search_tools') {
108
+ const input = args;
109
+ // Validate required fields
110
+ if (!input.query || typeof input.query !== 'string') {
111
+ return {
112
+ content: [
113
+ {
114
+ type: 'text',
115
+ text: JSON.stringify({
116
+ error: 'Missing required parameter: query',
117
+ hint: 'Provide a natural language query describing the tool capability you need',
118
+ }),
119
+ },
120
+ ],
121
+ isError: true,
122
+ };
123
+ }
124
+ const result = await executeSearchTools(client, input, defaultSessionId);
125
+ return {
126
+ content: [
127
+ {
128
+ type: 'text',
129
+ text: JSON.stringify(result, null, 2),
130
+ },
131
+ ],
132
+ };
133
+ }
134
+ if (name === 'get_tools_by_ids') {
135
+ const input = args;
136
+ // Validate required fields
137
+ if (!input.tool_ids || !Array.isArray(input.tool_ids) || input.tool_ids.length === 0) {
138
+ return {
139
+ content: [
140
+ {
141
+ type: 'text',
142
+ text: JSON.stringify({
143
+ error: 'Missing or invalid required parameter: tool_ids',
144
+ hint: 'Provide an array of tool IDs (at least one) to retrieve tool information',
145
+ }),
146
+ },
147
+ ],
148
+ isError: true,
149
+ };
150
+ }
151
+ const result = await executeGetToolsByIds(client, input, defaultSessionId);
152
+ return {
153
+ content: [
154
+ {
155
+ type: 'text',
156
+ text: JSON.stringify(result, null, 2),
157
+ },
158
+ ],
159
+ };
160
+ }
161
+ if (name === 'execute_tool') {
162
+ const input = args;
163
+ // Validate required fields
164
+ const missingFields = [];
165
+ if (!input.tool_id)
166
+ missingFields.push('tool_id');
167
+ if (!input.search_id)
168
+ missingFields.push('search_id');
169
+ if (!input.params_to_tool)
170
+ missingFields.push('params_to_tool');
171
+ if (missingFields.length > 0) {
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: JSON.stringify({
177
+ error: `Missing required parameters: ${missingFields.join(', ')}`,
178
+ hint: 'tool_id and search_id must come from a previous search_tools call',
179
+ }),
180
+ },
181
+ ],
182
+ isError: true,
183
+ };
184
+ }
185
+ const result = await executeExecuteTool(client, input, defaultSessionId);
186
+ return {
187
+ content: [
188
+ {
189
+ type: 'text',
190
+ text: JSON.stringify(result, null, 2),
191
+ },
192
+ ],
193
+ };
194
+ }
195
+ // Unknown tool
196
+ return {
197
+ content: [
198
+ {
199
+ type: 'text',
200
+ text: JSON.stringify({
201
+ error: `Unknown tool: ${name}`,
202
+ available_tools: ['search_tools', 'get_tools_by_ids', 'execute_tool'],
203
+ }),
204
+ },
205
+ ],
206
+ isError: true,
207
+ };
208
+ }
209
+ catch (error) {
210
+ // Handle API errors
211
+ if (isApiError(error)) {
212
+ return {
213
+ content: [
214
+ {
215
+ type: 'text',
216
+ text: JSON.stringify({
217
+ error: error.message,
218
+ status: error.status,
219
+ details: error.details,
220
+ }),
221
+ },
222
+ ],
223
+ isError: true,
224
+ };
225
+ }
226
+ // Handle other errors (including fetch network errors)
227
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
228
+ const errorCause = error instanceof Error && error.cause instanceof Error
229
+ ? error.cause.message
230
+ : undefined;
231
+ return {
232
+ content: [
233
+ {
234
+ type: 'text',
235
+ text: JSON.stringify({
236
+ error: errorMessage,
237
+ ...(errorCause && { cause: errorCause }),
238
+ }),
239
+ },
240
+ ],
241
+ isError: true,
242
+ };
243
+ }
244
+ });
245
+ // =========================================================================
246
+ // Start Server
247
+ // =========================================================================
248
+ const transport = new StdioServerTransport();
249
+ await server.connect(transport);
250
+ // Log startup to stderr (stdout is reserved for MCP protocol)
251
+ console.error(`Qveris MCP Server v${SERVER_VERSION} started`);
252
+ console.error(`Session ID: ${defaultSessionId}`);
253
+ }
254
+ /**
255
+ * Type guard for API errors.
256
+ */
257
+ function isApiError(error) {
258
+ return (typeof error === 'object' &&
259
+ error !== null &&
260
+ 'status' in error &&
261
+ 'message' in error);
262
+ }
263
+ // Run the server
264
+ main().catch((error) => {
265
+ console.error('Fatal error:', error);
266
+ process.exit(1);
267
+ });
268
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,oCAAo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,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * execute_tool MCP Tool Implementation
3
+ *
4
+ * Executes a specific remote tool with provided parameters.
5
+ * The tool_id must come from a previous search_tools call.
6
+ *
7
+ * @module tools/execute
8
+ */
9
+ import type { QverisClient } from '../api/client.js';
10
+ import type { ExecuteResponse } from '../types.js';
11
+ /**
12
+ * Input parameters for the execute_tool tool.
13
+ */
14
+ export interface ExecuteToolInput {
15
+ /**
16
+ * The ID of the remote tool to execute.
17
+ * Must be obtained from search_tools results.
18
+ */
19
+ tool_id: string;
20
+ /**
21
+ * The search_id from the search_tools response that returned this tool.
22
+ * Links the execution to the original search for analytics and billing.
23
+ */
24
+ search_id: string;
25
+ /**
26
+ * JSON stringified dictionary of parameters to pass to the remote tool.
27
+ * Keys are parameter names, values can be of any type.
28
+ *
29
+ * @example '{"city": "London", "units": "metric"}'
30
+ * @example '{"query": "AI news", "limit": 10}'
31
+ */
32
+ params_to_tool: string;
33
+ /**
34
+ * Session identifier for tracking user sessions.
35
+ * If not provided, the server will use an auto-generated session ID.
36
+ */
37
+ session_id?: string;
38
+ /**
39
+ * Maximum size of response data in bytes.
40
+ * If the tool generates data longer than this limit, the response
41
+ * will be truncated and a download URL provided for the full content.
42
+ *
43
+ * @default 20480 (20KB)
44
+ * @minimum -1 (-1 means no limit)
45
+ */
46
+ max_response_size?: number;
47
+ }
48
+ /**
49
+ * JSON Schema for the execute_tool tool input.
50
+ * Used by MCP to validate and document the tool parameters.
51
+ */
52
+ export declare const executeToolSchema: {
53
+ type: "object";
54
+ properties: {
55
+ tool_id: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ search_id: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ params_to_tool: {
64
+ type: string;
65
+ description: string;
66
+ };
67
+ session_id: {
68
+ type: string;
69
+ description: string;
70
+ };
71
+ max_response_size: {
72
+ type: string;
73
+ description: string;
74
+ default: number;
75
+ };
76
+ };
77
+ required: string[];
78
+ };
79
+ /**
80
+ * Executes the execute_tool operation.
81
+ *
82
+ * @param client - Initialized Qveris API client
83
+ * @param input - Execution parameters
84
+ * @param defaultSessionId - Fallback session ID if not provided in input
85
+ * @returns Execution result from the tool
86
+ * @throws {Error} If params_to_tool is not valid JSON
87
+ */
88
+ export declare function executeExecuteTool(client: QverisClient, input: ExecuteToolInput, defaultSessionId: string): Promise<ExecuteResponse>;
89
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +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;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;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,CAoB1B"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * execute_tool MCP Tool Implementation
3
+ *
4
+ * Executes a specific remote tool with provided parameters.
5
+ * The tool_id must come from a previous search_tools call.
6
+ *
7
+ * @module tools/execute
8
+ */
9
+ /**
10
+ * JSON Schema for the execute_tool tool input.
11
+ * Used by MCP to validate and document the tool parameters.
12
+ */
13
+ export const executeToolSchema = {
14
+ type: 'object',
15
+ properties: {
16
+ tool_id: {
17
+ type: 'string',
18
+ description: 'The ID of the remote tool to execute. Must come from a previous search_tools call.',
19
+ },
20
+ search_id: {
21
+ type: 'string',
22
+ description: 'The search_id from the search_tools response that returned this tool. ' +
23
+ 'Required for linking execution to the original search.',
24
+ },
25
+ params_to_tool: {
26
+ type: 'string',
27
+ description: 'A JSON stringified dictionary of parameters to pass to the remote tool. ' +
28
+ 'Keys are param names and values can be of any type. ' +
29
+ 'Example: \'{"city": "London", "units": "metric"}\'',
30
+ },
31
+ session_id: {
32
+ type: 'string',
33
+ description: 'Session identifier for tracking user sessions. ' +
34
+ 'If not provided, an auto-generated session ID will be used.',
35
+ },
36
+ max_response_size: {
37
+ type: 'number',
38
+ description: 'Maximum size of response data in bytes. ' +
39
+ 'If tool generates data longer than this, it will be truncated and a download URL provided. ' +
40
+ 'Use -1 for no limit. Default is 20480 (20KB).',
41
+ default: 20480,
42
+ },
43
+ },
44
+ required: ['tool_id', 'search_id', 'params_to_tool'],
45
+ };
46
+ /**
47
+ * Executes the execute_tool operation.
48
+ *
49
+ * @param client - Initialized Qveris API client
50
+ * @param input - Execution parameters
51
+ * @param defaultSessionId - Fallback session ID if not provided in input
52
+ * @returns Execution result from the tool
53
+ * @throws {Error} If params_to_tool is not valid JSON
54
+ */
55
+ export async function executeExecuteTool(client, input, defaultSessionId) {
56
+ // Parse the JSON parameters
57
+ let parameters;
58
+ try {
59
+ parameters = JSON.parse(input.params_to_tool);
60
+ }
61
+ catch (error) {
62
+ throw new Error(`Invalid JSON in params_to_tool: ${error instanceof Error ? error.message : 'Unknown parse error'}. ` +
63
+ `Received: ${input.params_to_tool}`);
64
+ }
65
+ const response = await client.executeTool(input.tool_id, {
66
+ search_id: input.search_id,
67
+ session_id: input.session_id ?? defaultSessionId,
68
+ parameters,
69
+ max_response_size: input.max_response_size,
70
+ });
71
+ return response;
72
+ }
73
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+CH;;;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,0EAA0E;gBAC1E,sDAAsD;gBACtD,oDAAoD;SACvD;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,iDAAiD;gBACjD,6DAA6D;SAChE;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0CAA0C;gBAC1C,6FAA6F;gBAC7F,+CAA+C;YACjD,OAAO,EAAE,KAAK;SACf;KACF;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,gBAAgB,CAAC;CACrD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAoB,EACpB,KAAuB,EACvB,gBAAwB;IAExB,4BAA4B;IAC5B,IAAI,UAAmC,CAAC;IACxC,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAA4B,CAAC;IAC3E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,IAAI;YACrG,aAAa,KAAK,CAAC,cAAc,EAAE,CACpC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE;QACvD,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,gBAAgB;QAChD,UAAU;QACV,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;KAC3C,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * get_tools_by_ids MCP Tool Implementation
3
+ *
4
+ * Retrieves tool descriptions based on tool IDs.
5
+ * Useful for getting detailed information about specific tools
6
+ * when you already know their tool_ids.
7
+ *
8
+ * @module tools/get-by-ids
9
+ */
10
+ import type { QverisClient } from '../api/client.js';
11
+ import type { SearchResponse } from '../types.js';
12
+ /**
13
+ * Input parameters for the get_tools_by_ids tool.
14
+ */
15
+ export interface GetToolsByIdsInput {
16
+ /**
17
+ * Array of tool IDs to retrieve information for.
18
+ * Must be obtained from previous search_tools results.
19
+ *
20
+ * @example ["weather-tool-1", "email-tool-2"]
21
+ */
22
+ tool_ids: string[];
23
+ /**
24
+ * The search_id from the search_tools response that returned the tool(s).
25
+ * Optional but recommended for analytics and billing.
26
+ */
27
+ search_id?: string;
28
+ /**
29
+ * Session identifier for tracking user sessions.
30
+ * If not provided, the server will use an auto-generated session ID.
31
+ */
32
+ session_id?: string;
33
+ }
34
+ /**
35
+ * JSON Schema for the get_tools_by_ids tool input.
36
+ * Used by MCP to validate and document the tool parameters.
37
+ */
38
+ export declare const getToolsByIdsSchema: {
39
+ type: "object";
40
+ properties: {
41
+ tool_ids: {
42
+ type: string;
43
+ items: {
44
+ type: string;
45
+ };
46
+ description: string;
47
+ minItems: number;
48
+ };
49
+ search_id: {
50
+ type: string;
51
+ description: string;
52
+ };
53
+ session_id: {
54
+ type: string;
55
+ description: string;
56
+ };
57
+ };
58
+ required: string[];
59
+ };
60
+ /**
61
+ * Executes the get_tools_by_ids operation.
62
+ *
63
+ * @param client - Initialized Qveris API client
64
+ * @param input - Request parameters with tool IDs
65
+ * @param defaultSessionId - Fallback session ID if not provided in input
66
+ * @returns Tool information for the requested IDs
67
+ */
68
+ export declare function executeGetToolsByIds(client: QverisClient, input: GetToolsByIdsInput, defaultSessionId: string): Promise<SearchResponse>;
69
+ //# sourceMappingURL=get-by-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-by-ids.d.ts","sourceRoot":"","sources":["../../src/tools/get-by-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;CA2B/B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,kBAAkB,EACzB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,cAAc,CAAC,CAQzB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * get_tools_by_ids MCP Tool Implementation
3
+ *
4
+ * Retrieves tool descriptions based on tool IDs.
5
+ * Useful for getting detailed information about specific tools
6
+ * when you already know their tool_ids.
7
+ *
8
+ * @module tools/get-by-ids
9
+ */
10
+ /**
11
+ * JSON Schema for the get_tools_by_ids tool input.
12
+ * Used by MCP to validate and document the tool parameters.
13
+ */
14
+ export const getToolsByIdsSchema = {
15
+ type: 'object',
16
+ properties: {
17
+ tool_ids: {
18
+ type: 'array',
19
+ items: {
20
+ type: 'string',
21
+ },
22
+ description: 'Array of tool IDs to retrieve information for. ' +
23
+ 'These IDs should come from previous search_tools results.',
24
+ minItems: 1,
25
+ },
26
+ search_id: {
27
+ type: 'string',
28
+ description: 'The search_id from the search_tools response that returned the tool(s). ' +
29
+ 'Optional but recommended for linking to the original search.',
30
+ },
31
+ session_id: {
32
+ type: 'string',
33
+ description: 'Session identifier for tracking user sessions. ' +
34
+ 'If not provided, an auto-generated session ID will be used.',
35
+ },
36
+ },
37
+ required: ['tool_ids'],
38
+ };
39
+ /**
40
+ * Executes the get_tools_by_ids operation.
41
+ *
42
+ * @param client - Initialized Qveris API client
43
+ * @param input - Request parameters with tool IDs
44
+ * @param defaultSessionId - Fallback session ID if not provided in input
45
+ * @returns Tool information for the requested IDs
46
+ */
47
+ export async function executeGetToolsByIds(client, input, defaultSessionId) {
48
+ const response = await client.getToolsByIds({
49
+ tool_ids: input.tool_ids,
50
+ search_id: input.search_id,
51
+ session_id: input.session_id ?? defaultSessionId,
52
+ });
53
+ return response;
54
+ }
55
+ //# sourceMappingURL=get-by-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-by-ids.js","sourceRoot":"","sources":["../../src/tools/get-by-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8BH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;aACf;YACD,WAAW,EACT,iDAAiD;gBACjD,2DAA2D;YAC7D,QAAQ,EAAE,CAAC;SACZ;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0EAA0E;gBAC1E,8DAA8D;SACjE;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,iDAAiD;gBACjD,6DAA6D;SAChE;KACF;IACD,QAAQ,EAAE,CAAC,UAAU,CAAC;CACvB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAoB,EACpB,KAAyB,EACzB,gBAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;QAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,gBAAgB;KACjD,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * search_tools MCP Tool Implementation
3
+ *
4
+ * Searches for available tools based on natural language queries.
5
+ * Returns relevant tools that can help accomplish tasks.
6
+ *
7
+ * @module tools/search
8
+ */
9
+ import type { QverisClient } from '../api/client.js';
10
+ import type { SearchResponse } from '../types.js';
11
+ /**
12
+ * Input parameters for the search_tools tool.
13
+ */
14
+ export interface SearchToolsInput {
15
+ /**
16
+ * The search query describing the general capability of the tool.
17
+ * Should describe what you want to accomplish, not specific parameters.
18
+ *
19
+ * @example "weather forecast API"
20
+ * @example "send email notification"
21
+ * @example "stock price lookup"
22
+ */
23
+ query: string;
24
+ /**
25
+ * Maximum number of results to return.
26
+ * @default 20
27
+ * @minimum 1
28
+ * @maximum 100
29
+ */
30
+ limit?: number;
31
+ /**
32
+ * Session identifier for tracking user sessions.
33
+ * If not provided, the server will use an auto-generated session ID.
34
+ */
35
+ session_id?: string;
36
+ }
37
+ /**
38
+ * JSON Schema for the search_tools tool input.
39
+ * Used by MCP to validate and document the tool parameters.
40
+ */
41
+ export declare const searchToolsSchema: {
42
+ type: "object";
43
+ properties: {
44
+ query: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ limit: {
49
+ type: string;
50
+ description: string;
51
+ default: number;
52
+ minimum: number;
53
+ maximum: number;
54
+ };
55
+ session_id: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ };
60
+ required: string[];
61
+ };
62
+ /**
63
+ * Executes the search_tools operation.
64
+ *
65
+ * @param client - Initialized Qveris API client
66
+ * @param input - Search parameters
67
+ * @param defaultSessionId - Fallback session ID if not provided in input
68
+ * @returns Search results with matching tools
69
+ */
70
+ export declare function executeSearchTools(client: QverisClient, input: SearchToolsInput, defaultSessionId: string): Promise<SearchResponse>;
71
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAyB7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,cAAc,CAAC,CAQzB"}