Skip to content

Commit 5f133bc

Browse files
committed
expose object literal and z.object wrapped schema
1 parent 7beb73e commit 5f133bc

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

packages/mcp/src/types/tools.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ import { z } from 'zod';
22

33
// Tool input/output schema
44

5-
export const CreateCardInputSchema = z.object({
5+
// Plain object schemas for MCP SDK compatibility
6+
export const CreateCardInputMCPSchema = {
67
datashape: z.string(),
7-
// individual datashapes define their own schema
88
data: z.any(),
99
tags: z.array(z.string()).optional(),
1010
elo: z.number().optional(),
1111
sourceRef: z.string().optional(),
12-
});
12+
};
13+
14+
// Zod schemas for runtime validation
15+
export const CreateCardInputSchema = z.object(CreateCardInputMCPSchema);
1316

1417
export type CreateCardInput = z.infer<typeof CreateCardInputSchema>;
1518

@@ -19,14 +22,15 @@ export interface CreateCardOutput {
1922
created: boolean;
2023
}
2124

22-
// Update Card Tool
23-
export const UpdateCardInputSchema = z.object({
25+
export const UpdateCardInputMCPSchema = {
2426
cardId: z.string(),
2527
data: z.any().optional(),
2628
tags: z.array(z.string()).optional(),
2729
elo: z.number().optional(),
2830
sourceRef: z.string().optional(),
29-
});
31+
};
32+
// Update Card Tool
33+
export const UpdateCardInputSchema = z.object(UpdateCardInputMCPSchema);
3034

3135
export type UpdateCardInput = z.infer<typeof UpdateCardInputSchema>;
3236

@@ -41,13 +45,15 @@ export interface UpdateCardOutput {
4145
};
4246
}
4347

44-
// Tag Card Tool
45-
export const TagCardInputSchema = z.object({
48+
export const TagCardInputMCPSchema = {
4649
cardId: z.string(),
4750
action: z.enum(['add', 'remove']),
4851
tags: z.array(z.string()),
4952
updateELO: z.boolean().optional().default(false),
50-
});
53+
};
54+
55+
// Tag Card Tool
56+
export const TagCardInputSchema = z.object(TagCardInputMCPSchema);
5157

5258
export type TagCardInput = z.infer<typeof TagCardInputSchema>;
5359

@@ -59,12 +65,14 @@ export interface TagCardOutput {
5965
currentTags: string[];
6066
}
6167

62-
// Delete Card Tool
63-
export const DeleteCardInputSchema = z.object({
68+
export const DeleteCardInputMCPSchema = {
6469
cardId: z.string(),
6570
confirm: z.boolean().default(false),
6671
reason: z.string().optional(),
67-
});
72+
};
73+
74+
// Delete Card Tool
75+
export const DeleteCardInputSchema = z.object(DeleteCardInputMCPSchema);
6876

6977
export type DeleteCardInput = z.infer<typeof DeleteCardInputSchema>;
7078

0 commit comments

Comments
 (0)