linear_get_user_issues
Retrieve issues assigned to a specific user from Linear's issue tracking system, including options to filter archived items and set result limits.
Instructions
Get issues assigned to a user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeArchived | No | Include archived issues | |
| limit | No | Maximum number of issues to return (default: 50) | |
| userId | No | User ID (omit for authenticated user) |
Implementation Reference
- The main handler function that executes the tool logic: fetches user's assigned issues from Linear (by userId or viewer), processes issue details (state, team), returns JSON with user data, pagination info, and issue list. Handles errors gracefully.export const linearGetUserIssuesHandler: ToolHandler = async args => { const params = args as { userId?: string; includeArchived?: boolean; limit?: number; }; try { const limit = params.limit || 50; const includeArchived = params.includeArchived || false; let user; // If userId is provided, get that user, otherwise get the current authenticated user if (params.userId) { user = await linearClient.user(params.userId); if (!user) { return { content: [ { type: 'text', text: `Error: User with ID ${params.userId} not found`, }, ], isError: true, }; } } else { user = await linearClient.viewer; } // Get assigned issues for the user const assignedIssues = await user.assignedIssues({ first: limit, includeArchived, }); if (!assignedIssues || !assignedIssues.nodes) { return { content: [ { type: 'text', text: "Error: Failed to fetch user's issues", }, ], isError: true, }; } // Process the results const issues = await Promise.all( assignedIssues.nodes.map(async issue => { const state = await issue.state; const team = await issue.team; return { id: await issue.id, number: await issue.number, title: await issue.title, url: await issue.url, priority: await issue.priority, state: state ? await state.name : null, teamName: team ? await team.name : null, createdAt: await issue.createdAt, }; }) ); const userData = { id: await user.id, name: await user.name, displayName: await user.displayName, }; return { content: [ { type: 'text', text: JSON.stringify({ user: userData, pageInfo: { hasNextPage: assignedIssues.pageInfo.hasNextPage, endCursor: assignedIssues.pageInfo.endCursor, }, issues, }), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error: ${errorMessage}`, }, ], isError: true, }; } };
- Input schema defining optional parameters: userId (string), includeArchived (boolean), limit (number).inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'User ID (omit for authenticated user)', }, includeArchived: { type: 'boolean', description: 'Include archived issues', }, limit: { type: 'number', description: 'Maximum number of issues to return (default: 50)', }, }, },
- src/tools/linear_get_user_issues.ts:114-137 (registration)Local registration of the tool using registerTool, specifying name, description, inputSchema, and linking to the handler.export const linearGetUserIssuesTool = registerTool( { name: 'linear_get_user_issues', description: 'Get issues assigned to a user', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'User ID (omit for authenticated user)', }, includeArchived: { type: 'boolean', description: 'Include archived issues', }, limit: { type: 'number', description: 'Maximum number of issues to return (default: 50)', }, }, }, }, linearGetUserIssuesHandler );
- src/tools/index.ts:5-5 (registration)Global registration via import in index.ts, which side-effect registers all tools by importing their registration modules.import './linear_get_user_issues.js';