create_case
Create a new mystery case with required name and optional details such as occurrence time, location, and summary. Returns a unique case ID.
Instructions
새 사건을 생성합니다. name은 필수, 나머지는 선택. 생성된 사건의 id(UUID)를 반환합니다.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 사건명 | |
| occurrence | No | 발생 시각, datetime-local 형식 (예: "2026-04-20T14:30") | |
| occurrenceError | No | 발생 시각 오차(분) | |
| reportTime | No | 신고/인지 시각 | |
| location | No | 발생 장소 | |
| summary | No | 사건 요약 |
Implementation Reference
- src/tools.ts:110-136 (handler)The handler function for create_case. Creates a new CaseData object with provided inputs (defaulting missing optional fields), calls saveCase to persist it, and returns the new case's ID and URL.
handler: async (input: { name: string; occurrence?: string; occurrenceError?: number; reportTime?: string; location?: string; summary?: string; }) => { const newCase: CaseData = { caseInfo: { name: input.name, occurrence: input.occurrence ?? '', occurrenceError: input.occurrenceError ?? 0, reportTime: input.reportTime ?? '', location: input.location ?? '', summary: input.summary ?? '', }, timelineSettings: { mode: 'auto', manualStart: '', manualEnd: '' }, people: [], edges: [], customEvents: [], records: [], }; const id = await saveCase(newCase); return { id, url: caseUrl(id) }; }, }, - src/tools.ts:99-109 (schema)The input schema for create_case using Zod validation. name is required (min length 1); occurrence, occurrenceError, reportTime, location, summary are optional.
inputSchema: z.object({ name: z.string().min(1).describe('사건명'), occurrence: z .string() .optional() .describe('발생 시각, datetime-local 형식 (예: "2026-04-20T14:30")'), occurrenceError: z.number().int().min(0).optional().describe('발생 시각 오차(분)'), reportTime: z.string().optional().describe('신고/인지 시각'), location: z.string().optional().describe('발생 장소'), summary: z.string().optional().describe('사건 요약'), }), - src/tools.ts:95-136 (registration)The tool 'create_case' is registered as part of the exported `tools` array (ToolDef[]). The MCP server in src/index.ts imports this array and routes incoming tool calls via CallToolRequestSchema by matching the tool name.
{ name: 'create_case', description: '새 사건을 생성합니다. name은 필수, 나머지는 선택. 생성된 사건의 id(UUID)를 반환합니다.', inputSchema: z.object({ name: z.string().min(1).describe('사건명'), occurrence: z .string() .optional() .describe('발생 시각, datetime-local 형식 (예: "2026-04-20T14:30")'), occurrenceError: z.number().int().min(0).optional().describe('발생 시각 오차(분)'), reportTime: z.string().optional().describe('신고/인지 시각'), location: z.string().optional().describe('발생 장소'), summary: z.string().optional().describe('사건 요약'), }), handler: async (input: { name: string; occurrence?: string; occurrenceError?: number; reportTime?: string; location?: string; summary?: string; }) => { const newCase: CaseData = { caseInfo: { name: input.name, occurrence: input.occurrence ?? '', occurrenceError: input.occurrenceError ?? 0, reportTime: input.reportTime ?? '', location: input.location ?? '', summary: input.summary ?? '', }, timelineSettings: { mode: 'auto', manualStart: '', manualEnd: '' }, people: [], edges: [], customEvents: [], records: [], }; const id = await saveCase(newCase); return { id, url: caseUrl(id) }; }, }, - src/tools.ts:56-58 (helper)Helper function saveCase that calls the Supabase RPC 'mcp_save_case' to persist a case. Used by the create_case handler to save the newly created case.
async function saveCase(caseObj: CaseData): Promise<string> { return await callRpc<string>('mcp_save_case', { p_case: caseObj }); } - src/tools.ts:8-9 (helper)Helper function to build the case URL from its ID, used by create_case to return the URL of the newly created case.
const caseUrl = (id: string) => `${WEB_URL}/cases/${id}`; const listUrl = () => `${WEB_URL}/cases`;