add_person
Add a person to a mystery case with name, gender, roles, and optional details like birth date and notes. Returns the local ID of the added person.
Instructions
사건에 인물을 추가합니다. roles 예: ["피해자"], ["용의자"], ["참고인"], ["수사관"]. 추가된 인물의 local id를 반환합니다.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseId | Yes | ||
| name | Yes | ||
| gender | Yes | ||
| roles | No | ||
| birthYear | No | ||
| birthMonth | No | ||
| birthDay | No | ||
| note | No | 인물 메모 | |
| notables | No | 특이사항 항목들 | |
| x | No | 인물관계도 X 좌표 (기본 0) | |
| y | No | 인물관계도 Y 좌표 (기본 0) |
Implementation Reference
- src/tools.ts:183-217 (handler)The handler function that executes the add_person tool logic. It fetches the case, generates a local ID, pushes a new person with the provided fields (name, gender, roles, birth date, note, notables, coordinates), defaults (deceased: false, deathTime: '', deathCause: '', alibis: []), saves the case, and returns the localId + url.
handler: async (input: { caseId: string; name: string; gender: 'male' | 'female'; roles?: string[]; birthYear?: number; birthMonth?: number; birthDay?: number; note?: string; notables?: string[]; x?: number; y?: number; }) => { const c = await fetchCase(input.caseId); const localId = nextLocalId(c.people); c.people.push({ id: localId, name: input.name, gender: input.gender, x: Math.round(input.x ?? 0), y: Math.round(input.y ?? 0), birthYear: input.birthYear ?? null, birthMonth: input.birthMonth ?? null, birthDay: input.birthDay ?? null, roles: input.roles ?? [], note: input.note ?? '', deceased: false, deathTime: '', deathCause: '', notables: input.notables ?? [], alibis: [], }); await saveCase(c); return { localId, url: caseUrl(input.caseId) }; }, - src/tools.ts:170-181 (schema)Zod input schema for add_person. Validates caseId (UUID), name (min 1), gender (male/female), and optional fields: roles (string array), birthYear/Month/Day, note, notables (string array), x/y coordinates.
inputSchema: z.object({ caseId: z.string().uuid(), name: z.string().min(1), gender: z.enum(['male', 'female']), roles: z.array(z.string()).optional(), birthYear: z.number().int().optional(), birthMonth: z.number().int().min(1).max(12).optional(), birthDay: z.number().int().min(1).max(31).optional(), note: z.string().optional().describe('인물 메모'), notables: z.array(z.string()).optional().describe('특이사항 항목들'), x: z.number().optional().describe('인물관계도 X 좌표 (기본 0)'), y: z.number().optional().describe('인물관계도 Y 좌표 (기본 0)'), - src/tools.ts:166-218 (registration)The add_person tool registered in the tools array with name 'add_person', its description, inputSchema, and handler. Part of the exported 'tools' array (ToolDef[]).
{ name: 'add_person', description: '사건에 인물을 추가합니다. roles 예: ["피해자"], ["용의자"], ["참고인"], ["수사관"]. 추가된 인물의 local id를 반환합니다.', inputSchema: z.object({ caseId: z.string().uuid(), name: z.string().min(1), gender: z.enum(['male', 'female']), roles: z.array(z.string()).optional(), birthYear: z.number().int().optional(), birthMonth: z.number().int().min(1).max(12).optional(), birthDay: z.number().int().min(1).max(31).optional(), note: z.string().optional().describe('인물 메모'), notables: z.array(z.string()).optional().describe('특이사항 항목들'), x: z.number().optional().describe('인물관계도 X 좌표 (기본 0)'), y: z.number().optional().describe('인물관계도 Y 좌표 (기본 0)'), }), handler: async (input: { caseId: string; name: string; gender: 'male' | 'female'; roles?: string[]; birthYear?: number; birthMonth?: number; birthDay?: number; note?: string; notables?: string[]; x?: number; y?: number; }) => { const c = await fetchCase(input.caseId); const localId = nextLocalId(c.people); c.people.push({ id: localId, name: input.name, gender: input.gender, x: Math.round(input.x ?? 0), y: Math.round(input.y ?? 0), birthYear: input.birthYear ?? null, birthMonth: input.birthMonth ?? null, birthDay: input.birthDay ?? null, roles: input.roles ?? [], note: input.note ?? '', deceased: false, deathTime: '', deathCause: '', notables: input.notables ?? [], alibis: [], }); await saveCase(c); return { localId, url: caseUrl(input.caseId) }; }, },