Skip to content

Commit efb9e1d

Browse files
committed
refactor(mocks): add as const satisfies to all mock tool definitions
Applied 'as const satisfies McpToolDefinition[]' pattern consistently across all mock tool definitions (defaultMcpTools, accountMcpTools, mixedProviderTools) for improved type safety and immutability. This ensures TypeScript can infer the most specific literal types whilst maintaining type compatibility, following the project's typescript-patterns skill guidelines.
1 parent d8348fd commit efb9e1d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mocks/mcp-server.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function createMcpApp(options: MockMcpServerOptions): HonoApp {
9696

9797
// Pre-defined tool sets for common test scenarios
9898

99-
export const defaultMcpTools: McpToolDefinition[] = [
99+
export const defaultMcpTools = [
100100
{
101101
name: 'default_tool_1',
102102
description: 'Default Tool 1',
@@ -114,9 +114,9 @@ export const defaultMcpTools: McpToolDefinition[] = [
114114
required: ['id'],
115115
},
116116
},
117-
];
117+
] as const satisfies McpToolDefinition[];
118118

119-
export const accountMcpTools: Record<string, McpToolDefinition[]> = {
119+
export const accountMcpTools = {
120120
acc1: [
121121
{
122122
name: 'acc1_tool_1',
@@ -135,7 +135,7 @@ export const accountMcpTools: Record<string, McpToolDefinition[]> = {
135135
required: ['id'],
136136
},
137137
},
138-
],
138+
] as const satisfies McpToolDefinition[],
139139
acc2: [
140140
{
141141
name: 'acc2_tool_1',
@@ -154,7 +154,7 @@ export const accountMcpTools: Record<string, McpToolDefinition[]> = {
154154
required: ['id'],
155155
},
156156
},
157-
],
157+
] as const satisfies McpToolDefinition[],
158158
acc3: [
159159
{
160160
name: 'acc3_tool_1',
@@ -164,7 +164,7 @@ export const accountMcpTools: Record<string, McpToolDefinition[]> = {
164164
properties: { fields: { type: 'string' } },
165165
},
166166
},
167-
],
167+
] as const satisfies McpToolDefinition[],
168168
'test-account': [
169169
{
170170
name: 'dummy_action',
@@ -181,8 +181,8 @@ export const accountMcpTools: Record<string, McpToolDefinition[]> = {
181181
additionalProperties: false,
182182
},
183183
},
184-
],
185-
};
184+
] as const satisfies McpToolDefinition[],
185+
} as const;
186186

187187
export const mixedProviderTools = [
188188
{

0 commit comments

Comments
 (0)