generate_personal_summary
Generate a personal book memory summary from Kindle highlights by analyzing themes, key ideas, and actionable takeaways to create structured insights without external AI calls.
Instructions
Builds a prompt package for the host model to generate a personal book memory summary from highlights alone. Use this when processing a single book manually.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| author | Yes | ||
| highlights | Yes |
Implementation Reference
- src/index.ts:157-164 (handler)Handler case for 'generate_personal_summary' tool. Validates args and calls buildSummaryPromptPackage to generate the prompt package for the AI model.
case "generate_personal_summary": { const result = buildSummaryPromptPackage( args as { title: string; author: string; highlights: string[] } ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } - Zod input schema definition for the tool with validation rules for title (non-empty), author (non-empty), and highlights (array with at least one item). Also exports the inferred TypeScript type.
export const GeneratePersonalSummaryInputSchema = z.object({ title: z.string().min(1, "title must not be empty"), author: z.string().min(1, "author must not be empty"), highlights: z .array(z.string().min(1)) .min(1, "highlights must contain at least one item"), }); export type GeneratePersonalSummaryToolInput = z.infer< typeof GeneratePersonalSummaryInputSchema >; - src/index.ts:105-118 (registration)Tool registration in the MCP server. Defines the tool name 'generate_personal_summary', description, and JSON schema for the input parameters (title, author, highlights).
{ name: "generate_personal_summary", description: "Builds a prompt package for the host model to generate a personal book memory summary from highlights alone. Use this when processing a single book manually.", inputSchema: { type: "object", properties: { title: { type: "string" }, author: { type: "string" }, highlights: { type: "array", items: { type: "string" } }, }, required: ["title", "author", "highlights"], }, }, - Core helper function that validates input, deduplicates highlights, formats them, and builds a PromptPackage with system prompt, user prompt, and output schema for the AI to generate the summary.
export function buildSummaryPromptPackage( input: GeneratePersonalSummaryToolInput ): PromptPackage { const validated = GeneratePersonalSummaryInputSchema.parse(input); const deduped = deduplicateHighlights(validated.highlights); const formattedHighlights = formatHighlights(deduped); const user_prompt = `Here are my Kindle highlights from "${validated.title}" by ${validated.author} (${deduped.length} highlights):\n\n${formattedHighlights}\n\nGenerate a structured personal memory summary based solely on these highlights. Respond with a JSON object matching the output_schema.`; return { system_prompt: SYSTEM_PROMPT, user_prompt, output_schema: OUTPUT_SCHEMA, instructions: "Use system_prompt as your system instruction, user_prompt as the user message, and produce a JSON object matching output_schema. Do not use any knowledge beyond the highlights provided.", }; } - src/types/index.ts:20-24 (helper)TypeScript interface defining the input structure for the generate_personal_summary tool.
export interface GeneratePersonalSummaryInput { title: string; author: string; highlights: string[]; }