Skip to content

Commit 706ed8f

Browse files
authored
feat: Add user's id to user_info tool (#84)
1 parent ac2fd6e commit 706ed8f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/tools/__tests__/user-info.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe(`${USER_INFO} tool`, () => {
6969

7070
// Test text content contains expected information
7171
const textContent = extractTextContent(result)
72+
expect(textContent).toContain('User ID:** 123')
7273
expect(textContent).toContain('Test User')
7374
expect(textContent).toContain('test@example.com')
7475
expect(textContent).toContain('Europe/Madrid')
@@ -81,6 +82,7 @@ describe(`${USER_INFO} tool`, () => {
8182
expect(structuredContent).toEqual(
8283
expect.objectContaining({
8384
type: 'user_info',
85+
userId: '123',
8486
fullName: 'Test User',
8587
email: 'test@example.com',
8688
timezone: 'Europe/Madrid',

src/tools/user-info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type UserPlan = 'Todoist Free' | 'Todoist Pro' | 'Todoist Business'
99

1010
type UserInfoStructured = Record<string, unknown> & {
1111
type: 'user_info'
12+
userId: string
1213
fullName: string
1314
timezone: string
1415
currentLocalTime: string
@@ -125,6 +126,7 @@ async function generateUserInfo(
125126
const lines: string[] = [
126127
'# User Information',
127128
'',
129+
`**User ID:** ${user.id}`,
128130
`**Full Name:** ${user.fullName}`,
129131
`**Email:** ${user.email}`,
130132
`**Timezone:** ${timezone}`,
@@ -150,6 +152,7 @@ async function generateUserInfo(
150152
// Generate structured content
151153
const structuredContent: UserInfoStructured = {
152154
type: 'user_info',
155+
userId: user.id,
153156
fullName: user.fullName,
154157
timezone: timezone,
155158
currentLocalTime: localTime,
@@ -171,7 +174,7 @@ async function generateUserInfo(
171174
const userInfo = {
172175
name: ToolNames.USER_INFO,
173176
description:
174-
'Get comprehensive user information including full name, email, timezone with current local time, week start day preferences, current week dates, daily/weekly goal progress, and user plan (Free/Pro/Business).',
177+
'Get comprehensive user information including user ID, full name, email, timezone with current local time, week start day preferences, current week dates, daily/weekly goal progress, and user plan (Free/Pro/Business).',
175178
parameters: ArgsSchema,
176179
async execute(_args, client) {
177180
const result = await generateUserInfo(client)

0 commit comments

Comments
 (0)