linear_get_viewer
Retrieve authenticated user information from Linear's issue tracking system to identify the current user account and access permissions.
Instructions
Get information about the authenticated user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/linear_get_viewer.ts:5-59 (handler)The main handler function that retrieves the authenticated Linear user (viewer) information using linearClient.viewer, extracts relevant fields, and returns it as JSON string in the tool response format. Handles errors appropriately.export const linearGetViewerHandler: ToolHandler = async () => { try { // Get the authenticated user (viewer) const viewer = await linearClient.viewer; if (!viewer) { return { content: [ { type: 'text', text: 'Error: Failed to get authenticated user', }, ], isError: true, }; } // Extract user data const userData = { id: await viewer.id, name: await viewer.name, displayName: await viewer.displayName, email: await viewer.email, active: await viewer.active, admin: await viewer.admin, avatarUrl: await viewer.avatarUrl, url: await viewer.url, }; return { content: [ { type: 'text', text: JSON.stringify(userData), }, ], }; } 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, }; } };
- src/tools/linear_get_viewer.ts:62-72 (registration)Registers the 'linear_get_viewer' tool using registerTool, providing name, description, empty input schema (no parameters needed), and links to the linearGetViewerHandler.export const linearGetViewerTool = registerTool( { name: 'linear_get_viewer', description: 'Get information about the authenticated user', inputSchema: { type: 'object', properties: {}, }, }, linearGetViewerHandler );
- src/tools/linear_get_viewer.ts:66-69 (schema)Input schema for the tool: an empty object schema since the tool takes no input parameters.inputSchema: { type: 'object', properties: {}, },