add_record
Add a record to a case, specifying content and optional time to document events in the mystery timeline.
Instructions
사건 기록을 추가합니다. time은 datetime-local 문자열 (예: "2026-04-20T14:30") 또는 생략(시간 미지정).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseId | Yes | ||
| time | No | ||
| content | Yes |
Implementation Reference
- src/tools.ts:262-273 (handler)The 'add_record' tool handler function. Fetches the case, generates a new localId, pushes a new record object (with id, time, content, selected=false) onto c.records, then saves and returns { localId, url }.
handler: async (input: { caseId: string; time?: string; content: string }) => { const c = await fetchCase(input.caseId); const localId = nextLocalId(c.records); c.records.push({ id: localId, time: input.time ?? '', content: input.content, selected: false, }); await saveCase(c); return { localId, url: caseUrl(input.caseId) }; }, - src/tools.ts:257-261 (schema)Input schema for 'add_record' using Zod: requires caseId (UUID), optional time (string), and required content (string min length 1).
inputSchema: z.object({ caseId: z.string().uuid(), time: z.string().optional(), content: z.string().min(1), }), - src/tools.ts:253-274 (registration)The 'add_record' tool definition object in the tools array. Contains name, description, inputSchema, and handler.
{ name: 'add_record', description: '사건 기록을 추가합니다. time은 datetime-local 문자열 (예: "2026-04-20T14:30") 또는 생략(시간 미지정).', inputSchema: z.object({ caseId: z.string().uuid(), time: z.string().optional(), content: z.string().min(1), }), handler: async (input: { caseId: string; time?: string; content: string }) => { const c = await fetchCase(input.caseId); const localId = nextLocalId(c.records); c.records.push({ id: localId, time: input.time ?? '', content: input.content, selected: false, }); await saveCase(c); return { localId, url: caseUrl(input.caseId) }; }, }, - src/tools.ts:60-62 (helper)Helper function nextLocalId used by the handler to generate the next incremental local ID for records.
function nextLocalId(items: { id: number }[]): number { return items.reduce((max, it) => Math.max(max, it.id ?? 0), 0) + 1; }