Skip to content

Commit 294d122

Browse files
CopilotJamieSinn
andauthored
fix: resolve TypeScript type inference error with MCP SDK 1.24.0 (#549)
* Initial plan * fix: resolve TypeScript type inference error with MCP SDK 1.24.0 Co-authored-by: JamieSinn <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: JamieSinn <[email protected]>
1 parent 489fdb8 commit 294d122

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

oclif.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "6.1.3",
2+
"version": "6.1.4",
33
"commands": {
44
"authCommand": {
55
"id": "authCommand",

src/mcp/server.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,37 @@ export class DevCycleMCPServer {
9393
toolConfig.outputSchema = config.outputSchema
9494
}
9595

96-
this.server.registerTool(name, toolConfig, async (args: unknown) => {
97-
try {
98-
const result = await handler(args)
96+
this.server.registerTool(
97+
name,
98+
toolConfig as any,
99+
async (args: unknown) => {
100+
try {
101+
const result = await handler(args)
102+
103+
// If the handler returned a plain string, send it as-is
104+
if (typeof result === 'string') {
105+
return {
106+
content: [
107+
{
108+
type: 'text' as const,
109+
text: result,
110+
},
111+
],
112+
}
113+
}
99114

100-
// If the handler returned a plain string, send it as-is
101-
if (typeof result === 'string') {
102115
return {
103116
content: [
104117
{
105118
type: 'text' as const,
106-
text: result,
119+
text: JSON.stringify(result, null, 2),
107120
},
108121
],
109122
}
123+
} catch (error) {
124+
return handleToolError(error, name)
110125
}
111-
112-
return {
113-
content: [
114-
{
115-
type: 'text' as const,
116-
text: JSON.stringify(result, null, 2),
117-
},
118-
],
119-
}
120-
} catch (error) {
121-
return handleToolError(error, name)
122-
}
123-
})
126+
},
127+
)
124128
}
125129
}

0 commit comments

Comments
 (0)