@@ -581,6 +581,51 @@ const tools: Tool[] = [
581581 required : [ 'project_id' ] ,
582582 } ,
583583 } ,
584+ {
585+ name : 'toggl_create_task' ,
586+ description : 'Create a task within a project. Tasks are sub-items used for more granular time tracking.' ,
587+ annotations : { readOnlyHint : false , idempotentHint : false , openWorldHint : true } ,
588+ inputSchema : {
589+ type : 'object' ,
590+ properties : {
591+ project_id : { type : 'number' , description : 'ID of the project to add the task to' } ,
592+ name : { type : 'string' , description : 'Task name (required)' } ,
593+ workspace_id : { type : 'number' , description : 'Workspace ID. Auto-resolved if only one workspace exists.' } ,
594+ estimated_seconds : { type : 'number' , description : 'Estimated duration in seconds (optional)' } ,
595+ } ,
596+ required : [ 'project_id' , 'name' ] ,
597+ } ,
598+ } ,
599+ {
600+ name : 'toggl_update_task' ,
601+ description : 'Rename a task or toggle its active state.' ,
602+ annotations : { readOnlyHint : false , idempotentHint : false , openWorldHint : true } ,
603+ inputSchema : {
604+ type : 'object' ,
605+ properties : {
606+ project_id : { type : 'number' , description : 'ID of the project the task belongs to' } ,
607+ task_id : { type : 'number' , description : 'ID of the task to update' } ,
608+ workspace_id : { type : 'number' , description : 'Workspace ID. Auto-resolved if only one workspace exists.' } ,
609+ name : { type : 'string' , description : 'New task name' } ,
610+ active : { type : 'boolean' , description : 'Set to false to deactivate the task' } ,
611+ } ,
612+ required : [ 'project_id' , 'task_id' ] ,
613+ } ,
614+ } ,
615+ {
616+ name : 'toggl_create_client' ,
617+ description : 'Create a new client in a workspace.' ,
618+ annotations : { readOnlyHint : false , idempotentHint : false , openWorldHint : true } ,
619+ inputSchema : {
620+ type : 'object' ,
621+ properties : {
622+ name : { type : 'string' , description : 'Client name (required)' } ,
623+ workspace_id : { type : 'number' , description : 'Workspace ID. Auto-resolved if only one workspace exists.' } ,
624+ notes : { type : 'string' , description : 'Optional notes about the client' } ,
625+ } ,
626+ required : [ 'name' ] ,
627+ } ,
628+ } ,
584629
585630 // Cache management
586631 {
@@ -1237,6 +1282,43 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
12371282 return jsonResponse ( { success : true , message : 'Project archived successfully' , project } ) ;
12381283 }
12391284
1285+ case 'toggl_create_task' : {
1286+ const workspaceId = await resolveWorkspaceForTool ( args , 'creating a task' ) ;
1287+ const projectId = args ?. project_id as number ;
1288+ const task = await api . createTask ( workspaceId , projectId , {
1289+ name : args ?. name as string ,
1290+ project_id : projectId ,
1291+ estimated_seconds : args ?. estimated_seconds as number | undefined ,
1292+ } ) ;
1293+ invalidateWorkspaceCache ( ) ;
1294+ return jsonResponse ( { success : true , task } ) ;
1295+ }
1296+
1297+ case 'toggl_update_task' : {
1298+ const workspaceId = await resolveWorkspaceForTool ( args , 'updating a task' ) ;
1299+ const params : Record < string , unknown > = { } ;
1300+ if ( args ?. name !== undefined ) params . name = args . name ;
1301+ if ( args ?. active !== undefined ) params . active = args . active ;
1302+ const task = await api . updateTask (
1303+ workspaceId ,
1304+ args ?. project_id as number ,
1305+ args ?. task_id as number ,
1306+ params as any
1307+ ) ;
1308+ invalidateWorkspaceCache ( ) ;
1309+ return jsonResponse ( { success : true , task } ) ;
1310+ }
1311+
1312+ case 'toggl_create_client' : {
1313+ const workspaceId = await resolveWorkspaceForTool ( args , 'creating a client' ) ;
1314+ const client = await api . createClient ( workspaceId , {
1315+ name : args ?. name as string ,
1316+ notes : args ?. notes as string | undefined ,
1317+ } ) ;
1318+ invalidateWorkspaceCache ( ) ;
1319+ return jsonResponse ( { success : true , client } ) ;
1320+ }
1321+
12401322 // Cache management
12411323 case 'toggl_warm_cache' : {
12421324 const workspaceId = await resolveWorkspaceForTool ( args , 'warming the cache' ) ;
0 commit comments