@qase/mcp-server 1.0.0 → 1.1.1
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/CHANGELOG.md +34 -0
- package/README.md +151 -2
- package/build/client/index.d.ts +50 -6
- package/build/client/index.d.ts.map +1 -1
- package/build/client/index.js +114 -18
- package/build/client/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +170 -62
- package/build/index.js.map +1 -1
- package/build/operations/attachments.js +35 -16
- package/build/operations/attachments.js.map +1 -1
- package/build/operations/authors.js +4 -4
- package/build/operations/authors.js.map +1 -1
- package/build/operations/cases.js +75 -34
- package/build/operations/cases.js.map +1 -1
- package/build/operations/configurations.d.ts +2 -0
- package/build/operations/configurations.d.ts.map +1 -1
- package/build/operations/configurations.js +28 -8
- package/build/operations/configurations.js.map +1 -1
- package/build/operations/custom-fields.js +7 -7
- package/build/operations/custom-fields.js.map +1 -1
- package/build/operations/defects.js +59 -29
- package/build/operations/defects.js.map +1 -1
- package/build/operations/environments.js +7 -7
- package/build/operations/environments.js.map +1 -1
- package/build/operations/milestones.js +6 -6
- package/build/operations/milestones.js.map +1 -1
- package/build/operations/plans.js +6 -6
- package/build/operations/plans.js.map +1 -1
- package/build/operations/projects.js +8 -8
- package/build/operations/projects.js.map +1 -1
- package/build/operations/results.js +7 -7
- package/build/operations/results.js.map +1 -1
- package/build/operations/runs.js +16 -10
- package/build/operations/runs.js.map +1 -1
- package/build/operations/search.js +10 -13
- package/build/operations/search.js.map +1 -1
- package/build/operations/shared-parameters.d.ts +2 -0
- package/build/operations/shared-parameters.d.ts.map +1 -1
- package/build/operations/shared-parameters.js +30 -78
- package/build/operations/shared-parameters.js.map +1 -1
- package/build/operations/shared-steps.js +6 -6
- package/build/operations/shared-steps.js.map +1 -1
- package/build/operations/suites.js +6 -6
- package/build/operations/suites.js.map +1 -1
- package/build/operations/system-fields.d.ts +2 -0
- package/build/operations/system-fields.d.ts.map +1 -1
- package/build/operations/system-fields.js +8 -2
- package/build/operations/system-fields.js.map +1 -1
- package/build/operations/users.d.ts +2 -0
- package/build/operations/users.d.ts.map +1 -1
- package/build/operations/users.js +19 -11
- package/build/operations/users.js.map +1 -1
- package/build/transports/sse.d.ts +10 -0
- package/build/transports/sse.d.ts.map +1 -0
- package/build/transports/sse.js +38 -0
- package/build/transports/sse.js.map +1 -0
- package/build/transports/streamableHttp.d.ts +9 -0
- package/build/transports/streamableHttp.d.ts.map +1 -0
- package/build/transports/streamableHttp.js +169 -0
- package/build/transports/streamableHttp.js.map +1 -0
- package/build/utils/auth-context.d.ts +8 -0
- package/build/utils/auth-context.d.ts.map +1 -0
- package/build/utils/auth-context.js +8 -0
- package/build/utils/auth-context.js.map +1 -0
- package/build/utils/case-enums.d.ts +6 -0
- package/build/utils/case-enums.d.ts.map +1 -0
- package/build/utils/case-enums.js +91 -0
- package/build/utils/case-enums.js.map +1 -0
- package/build/utils/errors.d.ts +25 -0
- package/build/utils/errors.d.ts.map +1 -1
- package/build/utils/errors.js +78 -0
- package/build/utils/errors.js.map +1 -1
- package/build/utils/registry.d.ts.map +1 -1
- package/build/utils/registry.js +4 -0
- package/build/utils/registry.js.map +1 -1
- package/build/utils/test-helpers.d.ts +2 -2
- package/build/utils/test-helpers.d.ts.map +1 -1
- package/build/utils/test-helpers.js +16 -0
- package/build/utils/test-helpers.js.map +1 -1
- package/package.json +17 -5
- package/server.json +36 -0
package/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* It exposes 90+ tools for managing projects, test cases, runs, results, defects, and more.
|
|
7
7
|
*
|
|
8
8
|
* Architecture:
|
|
9
|
-
* -
|
|
9
|
+
* - Supports multiple transports: stdio, sse, streamable-http
|
|
10
10
|
* - Tools are registered via the global tool registry
|
|
11
11
|
* - Operation modules self-register their tools on import
|
|
12
12
|
* - All API errors are handled gracefully with user-friendly messages
|
|
@@ -15,7 +15,9 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
15
15
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
16
16
|
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
17
17
|
import { toolRegistry } from './utils/registry.js';
|
|
18
|
-
import { formatApiError } from './utils/errors.js';
|
|
18
|
+
import { formatApiError, ToolExecutionError } from './utils/errors.js';
|
|
19
|
+
import { setupSSETransport } from './transports/sse.js';
|
|
20
|
+
import { setupStreamableHttpTransport } from './transports/streamableHttp.js';
|
|
19
21
|
// Import operation modules - each module registers its tools on import
|
|
20
22
|
import './operations/projects.js';
|
|
21
23
|
import './operations/cases.js';
|
|
@@ -36,81 +38,187 @@ import './operations/configurations.js';
|
|
|
36
38
|
import './operations/users.js';
|
|
37
39
|
import './operations/search.js';
|
|
38
40
|
/**
|
|
39
|
-
* Create
|
|
40
|
-
*/
|
|
41
|
-
const server = new Server({
|
|
42
|
-
name: 'qase-mcp-server',
|
|
43
|
-
version: '1.0.0',
|
|
44
|
-
}, {
|
|
45
|
-
capabilities: {
|
|
46
|
-
tools: {},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
/**
|
|
50
|
-
* Handler: List all available tools
|
|
41
|
+
* Create and configure a new MCP Server instance.
|
|
51
42
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
43
|
+
* Called once for stdio/SSE (single connection) and once per session for
|
|
44
|
+
* Streamable HTTP (multiple concurrent connections). Each session needs its
|
|
45
|
+
* own Server instance because the SDK enforces one transport per server.
|
|
54
46
|
*/
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
47
|
+
function createServer() {
|
|
48
|
+
const server = new Server({
|
|
49
|
+
name: 'qase-mcp-server',
|
|
50
|
+
version: '1.1.0',
|
|
51
|
+
}, {
|
|
52
|
+
capabilities: {
|
|
53
|
+
tools: {},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Handler: List all available tools
|
|
58
|
+
*
|
|
59
|
+
* Returns all tools registered in the tool registry.
|
|
60
|
+
* Called when the MCP client wants to discover available tools.
|
|
61
|
+
*/
|
|
62
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
63
|
+
const tools = toolRegistry.getTools();
|
|
64
|
+
console.error(`[Server] Listing ${tools.length} tools`);
|
|
65
|
+
return { tools };
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Handler: Execute a tool
|
|
69
|
+
*
|
|
70
|
+
* Executes the specified tool with provided arguments.
|
|
71
|
+
* Arguments are validated against the tool's schema before execution.
|
|
72
|
+
*/
|
|
73
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
74
|
+
const { name, arguments: args } = request.params;
|
|
75
|
+
console.error(`[Server] Executing tool: ${name}`);
|
|
76
|
+
// Get tool handler from registry
|
|
77
|
+
const handler = toolRegistry.getHandler(name);
|
|
78
|
+
if (!handler) {
|
|
79
|
+
throw new Error(`Unknown tool: ${name}. Use list_tools to see available tools.`);
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
// Execute the tool handler with provided arguments
|
|
83
|
+
const result = await handler(args || {});
|
|
84
|
+
// Return result in MCP format
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
text: JSON.stringify(result, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
// Handle tool execution errors (expected failures like validation, API errors)
|
|
96
|
+
// These are returned with isError: true so the LLM can understand and recover
|
|
97
|
+
if (error instanceof ToolExecutionError) {
|
|
98
|
+
console.error(`[Server] Tool '${name}' execution error:`, error.message);
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: 'text',
|
|
103
|
+
text: error.toUserMessage(),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
isError: true,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Handle unexpected errors (protocol-level failures)
|
|
110
|
+
// Format error message using our error utilities
|
|
111
|
+
const errorMessage = formatApiError(error);
|
|
112
|
+
console.error(`[Server] Tool '${name}' unexpected error:`, errorMessage);
|
|
113
|
+
// Return as tool execution error with isError: true for better LLM recovery
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: 'text',
|
|
118
|
+
text: errorMessage,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return server;
|
|
126
|
+
}
|
|
60
127
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* Executes the specified tool with provided arguments.
|
|
64
|
-
* Arguments are validated against the tool's schema before execution.
|
|
128
|
+
* Parse command line arguments
|
|
65
129
|
*/
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
130
|
+
function parseArgs() {
|
|
131
|
+
const args = process.argv.slice(2);
|
|
132
|
+
// Default values
|
|
133
|
+
let transport = 'stdio';
|
|
134
|
+
let port = 3000;
|
|
135
|
+
let host = '0.0.0.0';
|
|
136
|
+
// Parse --transport
|
|
137
|
+
const transportIndex = args.indexOf('--transport');
|
|
138
|
+
if (transportIndex !== -1 && transportIndex + 1 < args.length) {
|
|
139
|
+
transport = args[transportIndex + 1];
|
|
73
140
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: 'text',
|
|
82
|
-
text: JSON.stringify(result, null, 2),
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
141
|
+
// Parse --port
|
|
142
|
+
const portIndex = args.indexOf('--port');
|
|
143
|
+
if (portIndex !== -1 && portIndex + 1 < args.length) {
|
|
144
|
+
const parsedPort = parseInt(args[portIndex + 1], 10);
|
|
145
|
+
if (!isNaN(parsedPort)) {
|
|
146
|
+
port = parsedPort;
|
|
147
|
+
}
|
|
86
148
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
throw new Error(`Tool '${name}' execution failed: ${errorMessage}`);
|
|
149
|
+
// Parse --host
|
|
150
|
+
const hostIndex = args.indexOf('--host');
|
|
151
|
+
if (hostIndex !== -1 && hostIndex + 1 < args.length) {
|
|
152
|
+
host = args[hostIndex + 1];
|
|
92
153
|
}
|
|
93
|
-
}
|
|
154
|
+
return { transport, port, host };
|
|
155
|
+
}
|
|
94
156
|
/**
|
|
95
157
|
* Main function - Start the MCP server
|
|
96
158
|
*/
|
|
97
159
|
async function main() {
|
|
98
|
-
|
|
99
|
-
const transport = new StdioServerTransport();
|
|
100
|
-
// Connect server to transport
|
|
101
|
-
await server.connect(transport);
|
|
160
|
+
const { transport, port, host } = parseArgs();
|
|
102
161
|
// Log server information to stderr (stdout is used for MCP protocol)
|
|
103
|
-
console.error('
|
|
104
|
-
console.error('║
|
|
105
|
-
console.error('
|
|
162
|
+
console.error('╔══════════════════════════════════════════════════════════════╗');
|
|
163
|
+
console.error('║ Qase MCP Server v1.1.0 ║');
|
|
164
|
+
console.error('╚══════════════════════════════════════════════════════════════╝');
|
|
106
165
|
console.error('');
|
|
107
|
-
console.error(`✓ Server started successfully`);
|
|
108
166
|
console.error(`✓ Registered ${toolRegistry.getToolCount()} tools`);
|
|
109
|
-
console.error(`✓ Ready to receive requests`);
|
|
110
|
-
console.error('');
|
|
111
|
-
console.error('Note: This server uses stdio transport for communication.');
|
|
112
|
-
console.error(' It is designed to be run by MCP clients (Claude, Cursor, etc.)');
|
|
113
167
|
console.error('');
|
|
168
|
+
try {
|
|
169
|
+
switch (transport) {
|
|
170
|
+
case 'stdio': {
|
|
171
|
+
// Create stdio transport for communication
|
|
172
|
+
const stdioTransport = new StdioServerTransport();
|
|
173
|
+
// Connect server to transport
|
|
174
|
+
await createServer().connect(stdioTransport);
|
|
175
|
+
console.error(`✓ Server started successfully`);
|
|
176
|
+
console.error(`✓ Transport: stdio`);
|
|
177
|
+
console.error(`✓ Ready to receive requests`);
|
|
178
|
+
console.error('');
|
|
179
|
+
console.error('Note: This server uses stdio transport for communication.');
|
|
180
|
+
console.error(' It is designed to be run by MCP clients (Claude, Cursor, etc.)');
|
|
181
|
+
console.error('');
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
case 'sse': {
|
|
185
|
+
console.error(`✓ Starting server with SSE transport on http://${host}:${port}/sse`);
|
|
186
|
+
setupSSETransport(createServer(), {
|
|
187
|
+
port,
|
|
188
|
+
host,
|
|
189
|
+
sseEndpoint: '/sse',
|
|
190
|
+
messagesEndpoint: '/messages',
|
|
191
|
+
});
|
|
192
|
+
console.error(`✓ Server started successfully`);
|
|
193
|
+
console.error(`✓ Transport: SSE (Server-Sent Events)`);
|
|
194
|
+
console.error(`✓ Ready to receive requests`);
|
|
195
|
+
console.error('');
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case 'streamable-http': {
|
|
199
|
+
console.error(`✓ Starting server with Streamable HTTP transport on http://${host}:${port}/mcp`);
|
|
200
|
+
setupStreamableHttpTransport(createServer, {
|
|
201
|
+
port,
|
|
202
|
+
host,
|
|
203
|
+
endpoint: '/mcp',
|
|
204
|
+
});
|
|
205
|
+
console.error(`✓ Server started successfully`);
|
|
206
|
+
console.error(`✓ Transport: Streamable HTTP`);
|
|
207
|
+
console.error(`✓ Ready to receive requests`);
|
|
208
|
+
console.error('');
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
default:
|
|
212
|
+
throw new Error(`Unsupported transport type: ${transport}. Supported types: stdio, sse, streamable-http`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.error('═══════════════════════════════════════════════════════════════');
|
|
217
|
+
console.error('FATAL ERROR: Server failed to start');
|
|
218
|
+
console.error('═══════════════════════════════════════════════════════════════');
|
|
219
|
+
console.error(error);
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
114
222
|
}
|
|
115
223
|
/**
|
|
116
224
|
* Run the server and handle errors
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,uEAAuE;AACvE,OAAO,0BAA0B,CAAC;AAClC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAC9B,O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O,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Attachments are files associated with test cases, steps, and results.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
+
import { createReadStream, existsSync } from 'fs';
|
|
8
9
|
import { getApiClient } from '../client/index.js';
|
|
9
10
|
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
-
import { toResultAsync } from '../utils/errors.js';
|
|
11
|
+
import { toResultAsync, createToolError } from '../utils/errors.js';
|
|
11
12
|
import { ProjectCodeSchema, HashSchema } from '../utils/validation.js';
|
|
12
13
|
// ============================================================================
|
|
13
14
|
// SCHEMAS
|
|
@@ -16,7 +17,14 @@ import { ProjectCodeSchema, HashSchema } from '../utils/validation.js';
|
|
|
16
17
|
* Schema for listing attachments
|
|
17
18
|
*/
|
|
18
19
|
const ListAttachmentsSchema = z.object({
|
|
19
|
-
limit: z
|
|
20
|
+
limit: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.positive()
|
|
24
|
+
.max(100)
|
|
25
|
+
.optional()
|
|
26
|
+
.default(10)
|
|
27
|
+
.describe('Maximum number of items (default: 10, max: 100)'),
|
|
20
28
|
offset: z.number().int().nonnegative().optional().describe('Number of items to skip'),
|
|
21
29
|
});
|
|
22
30
|
/**
|
|
@@ -29,8 +37,8 @@ const GetAttachmentSchema = z.object({
|
|
|
29
37
|
* Schema for uploading an attachment
|
|
30
38
|
*/
|
|
31
39
|
const UploadAttachmentSchema = z.object({
|
|
32
|
-
code: ProjectCodeSchema.
|
|
33
|
-
file: z.string().describe('File content as base64 encoded string or file path'),
|
|
40
|
+
code: ProjectCodeSchema.describe('Project code'),
|
|
41
|
+
file: z.string().describe('File content as base64 encoded string or absolute file path'),
|
|
34
42
|
filename: z.string().describe('Original filename with extension'),
|
|
35
43
|
});
|
|
36
44
|
/**
|
|
@@ -50,7 +58,7 @@ async function listAttachments(args) {
|
|
|
50
58
|
const { limit, offset } = args;
|
|
51
59
|
const result = await toResultAsync(client.attachments.getAttachments(limit, offset));
|
|
52
60
|
return result.match((response) => response.data.result, (error) => {
|
|
53
|
-
throw
|
|
61
|
+
throw createToolError(error, 'attachment operation');
|
|
54
62
|
});
|
|
55
63
|
}
|
|
56
64
|
/**
|
|
@@ -61,25 +69,36 @@ async function getAttachment(args) {
|
|
|
61
69
|
const { hash } = args;
|
|
62
70
|
const result = await toResultAsync(client.attachments.getAttachment(hash));
|
|
63
71
|
return result.match((response) => response.data.result, (error) => {
|
|
64
|
-
throw
|
|
72
|
+
throw createToolError(error, 'attachment operation');
|
|
65
73
|
});
|
|
66
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Prepare file data for upload.
|
|
77
|
+
* Accepts a base64-encoded string or an absolute file path.
|
|
78
|
+
* Returns an object compatible with the SDK's FormData append: { name, value }.
|
|
79
|
+
*/
|
|
80
|
+
function prepareFileData(file, filename) {
|
|
81
|
+
// If the string looks like a file path and exists on disk, stream it
|
|
82
|
+
if (file.startsWith('/') && existsSync(file)) {
|
|
83
|
+
return { name: filename, value: createReadStream(file) };
|
|
84
|
+
}
|
|
85
|
+
// Otherwise treat it as base64 content
|
|
86
|
+
const isBase64 = /^[A-Za-z0-9+/=\s]+$/.test(file);
|
|
87
|
+
return {
|
|
88
|
+
name: filename,
|
|
89
|
+
value: Buffer.from(file, isBase64 ? 'base64' : undefined),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
67
92
|
/**
|
|
68
93
|
* Upload a new attachment
|
|
69
94
|
*/
|
|
70
95
|
async function uploadAttachment(args) {
|
|
71
96
|
const client = getApiClient();
|
|
72
97
|
const { code, file, filename } = args;
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
file,
|
|
76
|
-
filename,
|
|
77
|
-
};
|
|
78
|
-
const result = await toResultAsync(code
|
|
79
|
-
? client.attachments.uploadAttachment(code, uploadData)
|
|
80
|
-
: client.attachments.uploadAttachment(uploadData));
|
|
98
|
+
const fileData = prepareFileData(file, filename);
|
|
99
|
+
const result = await toResultAsync(client.attachments.uploadAttachment(code, [fileData]));
|
|
81
100
|
return result.match((response) => response.data.result, (error) => {
|
|
82
|
-
throw
|
|
101
|
+
throw createToolError(error, 'attachment operation');
|
|
83
102
|
});
|
|
84
103
|
}
|
|
85
104
|
/**
|
|
@@ -90,7 +109,7 @@ async function deleteAttachment(args) {
|
|
|
90
109
|
const { hash } = args;
|
|
91
110
|
const result = await toResultAsync(client.attachments.deleteAttachment(hash));
|
|
92
111
|
return result.match((_response) => ({ success: true, hash }), (error) => {
|
|
93
|
-
throw
|
|
112
|
+
throw createToolError(error, 'attachment operation');
|
|
94
113
|
});
|
|
95
114
|
}
|
|
96
115
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/operations/attachments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/operations/attachments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC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IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,8CAA8C;IAC3D,MAAM,EAAE,qBAAqB;IAC7B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,2DAA2D;IACxE,MAAM,EAAE,mBAAmB;IAC3B,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,8BAA8B;IAC3C,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { getApiClient } from '../client/index.js';
|
|
9
9
|
import { toolRegistry } from '../utils/registry.js';
|
|
10
|
-
import { toResultAsync } from '../utils/errors.js';
|
|
10
|
+
import { toResultAsync, createToolError } from '../utils/errors.js';
|
|
11
11
|
import { IdSchema } from '../utils/validation.js';
|
|
12
12
|
// ============================================================================
|
|
13
13
|
// SCHEMAS
|
|
@@ -34,9 +34,9 @@ const GetAuthorSchema = z.object({
|
|
|
34
34
|
async function listAuthors(args) {
|
|
35
35
|
const client = getApiClient();
|
|
36
36
|
const { limit, offset } = args;
|
|
37
|
-
const result = await toResultAsync(client.authors.getAuthors(limit, offset));
|
|
37
|
+
const result = await toResultAsync(client.authors.getAuthors(undefined, undefined, limit, offset));
|
|
38
38
|
return result.match((response) => response.data.result, (error) => {
|
|
39
|
-
throw
|
|
39
|
+
throw createToolError(error, 'author operation');
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
@@ -47,7 +47,7 @@ async function getAuthor(args) {
|
|
|
47
47
|
const { id } = args;
|
|
48
48
|
const result = await toResultAsync(client.authors.getAuthor(id));
|
|
49
49
|
return result.match((response) => response.data.result, (error) => {
|
|
50
|
-
throw
|
|
50
|
+
throw createToolError(error, 'author operation');
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authors.js","sourceRoot":"","sources":["../../src/operations/authors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"authors.js","sourceRoot":"","sources":["../../src/operations/authors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC1F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EA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