import { z } from 'zod';
import { simctlJson } from '../executor/simctl.js';
import type { SimctlListOutput } from '../types/simctl.js';
export const listSchema = z.object({
filter: z
.enum(['devices', 'devicetypes', 'runtimes', 'pairs'])
.optional()
.describe('Filter to show only specific category'),
search: z
.string()
.optional()
.describe('Optional search term to filter results'),
});
export type ListInput = z.infer<typeof listSchema>;
export const listTool = {
name: 'simctl_list',
description: 'List available simulators, device types, runtimes, or device pairs',
inputSchema: listSchema,
handler: async (input: ListInput) => {
const args: string[] = [];
if (input.filter) {
args.push(input.filter);
}
if (input.search) {
args.push(input.search);
}
const result = simctlJson<SimctlListOutput>('list', args);
return {
content: [
{
type: 'text' as const,
text: JSON.stringify(result, null, 2),
},
],
};
},
};