import { z } from 'zod';
import { LimitlessClient } from '../../lib/limitless-client.js';
import { Lifelog } from '../../types/limitless.js';
import { Tool } from '@modelcontextprotocol/sdk/types.js';
export const getLifelogSchema = z.object({
lifelogId: z.string().describe('The ID of the lifelog to retrieve'),
includeMarkdown: z.boolean().optional().describe('Include markdown content in response'),
includeHeadings: z.boolean().optional().describe('Include content headings in response'),
});
export type GetLifelogParams = z.infer<typeof getLifelogSchema>;
export const getLifelogTool: Tool = {
name: 'limitless_get_lifelog',
description: 'Get a specific lifelog by ID from Limitless',
inputSchema: {
type: 'object',
properties: {
lifelogId: { type: 'string', description: 'The ID of the lifelog to retrieve' },
includeMarkdown: { type: 'boolean', description: 'Include markdown content in response' },
includeHeadings: { type: 'boolean', description: 'Include content headings in response' },
},
required: ['lifelogId'],
},
};
export async function getLifelog(params: GetLifelogParams, client: LimitlessClient): Promise<Lifelog> {
const queryParams: any = {};
if (params.includeMarkdown !== undefined) queryParams.includeMarkdown = params.includeMarkdown;
if (params.includeHeadings !== undefined) queryParams.includeHeadings = params.includeHeadings;
return await client.get<Lifelog>(`/lifelogs/${params.lifelogId}`, queryParams);
}