get_collaborators
Retrieve all collaborators for a Todoist project by providing the project ID to manage team access and permissions.
Instructions
Get all collaborators for a project in Todoist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/projects.ts:82-90 (registration)Registers the get_collaborators tool with MCP server via createApiHandler factory, defining its name, description, input schema (project id), HTTP method, and Todoist API endpoint path.createApiHandler({ name: 'get_collaborators', description: 'Get all collaborators for a project in Todoist', schemaShape: { id: z.string(), }, method: 'GET', path: '/projects/{id}/collaborators', });
- src/tools/projects.ts:86-87 (schema)Input schema for get_collaborators tool: requires a string 'id' parameter for the project.id: z.string(), },
- src/utils/handlers.ts:92-145 (handler)Handler function executed for get_collaborators: parses path template '/projects/{id}/collaborators', validates and encodes the 'id' parameter, calls todoistApi.get on the constructed path with any additional params, and returns the result.const handler = async (args: z.infer<z.ZodObject<T>>): Promise<R> => { let finalPath = options.path; const pathParams: Record<string, string> = {}; // Extract path parameters (e.g., {id}) and replace them with actual values const pathParamRegex = /{([^}]+)}/g; let match; while ((match = pathParamRegex.exec(options.path)) !== null) { const fullMatch = match[0]; // e.g., "{id}" const paramName = match[1]; // e.g., "id" if (args[paramName] === undefined) { throw new Error(`Path parameter ${paramName} is required but not provided`); } // Validate and encode path parameter using the centralized security function const safeParamValue = validatePathParameter(args[paramName], paramName); finalPath = finalPath.replace(fullMatch, safeParamValue); pathParams[paramName] = String(args[paramName]); } // Collect non-path parameters for query string or request body const otherParams = Object.entries(args).reduce( (acc, [key, value]) => { if (value !== undefined && !pathParams[key]) { acc[key] = value; } return acc; }, {} as Record<string, any> ); // Apply custom parameter transformation if provided const finalParams = options.transformParams ? options.transformParams(args) : otherParams; // Execute the API request based on HTTP method let result; switch (options.method) { case 'GET': result = await todoistApi.get(finalPath, finalParams); break; case 'POST': log('POST', finalPath, finalParams); result = await todoistApi.post(finalPath, finalParams); break; case 'DELETE': result = await todoistApi.delete(finalPath); break; } // Apply result post-processing if provided return options.processResult ? options.processResult(result, args) : result; };
- src/utils/handlers.ts:76-77 (helper)Final MCP tool registration via server.tool callback, which wraps the handler in error handling and JSON response formatting.server.tool(name, description, paramsSchema, mcpToolCallback as unknown as ToolCallback<T>); }