import { hashProjectPath } from '../storage/base-store.js';
import * as sessionStore from '../storage/session-store.js';
export async function handleListSessions(params) {
    const projectId = hashProjectPath(params.projectPath);
    const limit = params.limit ?? 10;
    try {
        const items = await sessionStore.listItems(projectId, limit);
        const result = {
            projectId,
            count: items.length,
            sessions: items,
            message: items.length > 0
                ? `Found ${String(items.length)} session(s).`
                : 'No sessions found for this project.',
        };
        return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        return {
            content: [{ type: 'text', text: `Error listing sessions: ${message}` }],
            isError: true,
        };
    }
}
//# sourceMappingURL=list-sessions.js.map