refactor: update dependencies and fix TypeScript instantiation depth issues

Updates ModelContextProtocol SDK and multiple dependent libraries to latest versions. Refactors TypeScript schemas to avoid instantiation depth issues by widening Zod types and using explicit type parameters.
This commit is contained in:
weishu
2025-12-25 22:56:08 +08:00
parent 38e8fe8d02
commit 3765cc539b
7 changed files with 79 additions and 74 deletions
+10 -7
View File
@@ -39,13 +39,16 @@ export async function startHappyServer(client: ApiSessionClient) {
version: "1.0.0",
});
mcp.registerTool('change_title', {
// Avoid TS instantiation depth issues by widening the schema type.
const changeTitleInputSchema: z.ZodTypeAny = z.object({
title: z.string().describe('The new title for the chat session'),
});
mcp.registerTool<any, any>('change_title', {
description: 'Change the title of the current chat session',
title: 'Change Chat Title',
inputSchema: {
title: z.string().describe('The new title for the chat session'),
},
}, async (args) => {
inputSchema: changeTitleInputSchema,
}, async (args: { title: string }) => {
const response = await handler(args.title);
logger.debug('[hapiMCP] Response:', response);
@@ -53,7 +56,7 @@ export async function startHappyServer(client: ApiSessionClient) {
return {
content: [
{
type: 'text',
type: 'text' as const,
text: `Successfully changed chat title to: "${args.title}"`,
},
],
@@ -63,7 +66,7 @@ export async function startHappyServer(client: ApiSessionClient) {
return {
content: [
{
type: 'text',
type: 'text' as const,
text: `Failed to change chat title: ${response.error || 'Unknown error'}`,
},
],