Skip to content

Commit 2a746fc

Browse files
committed
feat: extend schema generator to support testAutoExposure function
- Add testAutoExposure method definition to manual methods array - Include input/output schema definitions for string input and structured output - Add API route handler logic for standalone function import and execution - Fix unused parameter warning by prefixing with underscore for testAutoExposure - Enable automatic exposure of the new test function via MCP and REST API
1 parent 58bd8a2 commit 2a746fc

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

scripts/generate-schemas.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,33 @@ function extractMethodsFromFileOperations() {
212212
additionalProperties: false
213213
},
214214
examples: []
215+
},
216+
{
217+
name: 'testAutoExposure',
218+
group: 'Testing',
219+
description: 'Test function to demonstrate auto-exposure pattern',
220+
inputSchema: {
221+
type: 'object',
222+
properties: {
223+
input: {
224+
type: 'string',
225+
description: 'The input message to echo'
226+
}
227+
},
228+
required: ['input'],
229+
additionalProperties: false
230+
},
231+
outputSchema: {
232+
type: 'object',
233+
properties: {
234+
message: { type: 'string' },
235+
timestamp: { type: 'string' },
236+
success: { type: 'boolean' }
237+
},
238+
required: ['message', 'timestamp', 'success'],
239+
additionalProperties: false
240+
},
241+
examples: ['markmv test "Hello World"']
215242
}
216243
];
217244

@@ -420,7 +447,7 @@ ${Object.keys(schemas.definitions).map(methodName => `
420447
export async function create${methodName}Handler(
421448
req: IncomingMessage,
422449
res: ServerResponse,
423-
markmvInstance: FileOperations
450+
${methodName === 'testAutoExposure' ? '_markmvInstance: FileOperations' : 'markmvInstance: FileOperations'}
424451
): Promise<void> {
425452
try {
426453
// Parse request body
@@ -483,6 +510,15 @@ ${methodName === 'moveFile' ? `
483510
}
484511
} else {
485512
throw new Error('Invalid parameters for validateOperation');
513+
}` : methodName === 'testAutoExposure' ? `
514+
const input = bodyObj.input;
515+
516+
if (typeof input === 'string') {
517+
// Import and call the standalone function
518+
const { testAutoExposure } = await import('../index.js');
519+
result = await testAutoExposure(input);
520+
} else {
521+
throw new Error('Invalid parameters for testAutoExposure');
486522
}` : `
487523
throw new Error('Method ${methodName} not implemented');`}
488524

0 commit comments

Comments
 (0)