linear_getViewer
Retrieve details of the authenticated user in the Linear project management system, enabling AI assistants to access and manage user-specific data efficiently.
Instructions
Get information about the currently authenticated user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/handlers/user-handlers.ts:7-16 (handler)The main handler function for the 'linear_getViewer' tool. It wraps the call to linearService.getUserInfo() with error handling.export function handleGetViewer(linearService: LinearService) { return async (args: unknown) => { try { return await linearService.getUserInfo(); } catch (error) { logError('Error getting viewer information', error); throw error; } }; }
- The MCPToolDefinition for 'linear_getViewer', including input and output schemas.export const getViewerToolDefinition: MCPToolDefinition = { name: 'linear_getViewer', description: 'Get information about the currently authenticated user', input_schema: { type: 'object', properties: {}, }, output_schema: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, email: { type: 'string' }, active: { type: 'boolean' }, displayName: { type: 'string' }, organization: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, }, }, }, }, };
- src/tools/handlers/index.ts:66-70 (registration)Registration of the handler for 'linear_getViewer' within the registerToolHandlers function.// User tools linear_getViewer: handleGetViewer(linearService), linear_getOrganization: handleGetOrganization(linearService), linear_getUsers: handleGetUsers(linearService), linear_getLabels: handleGetLabels(linearService),
- src/tools/definitions/index.ts:48-53 (registration)Inclusion of the 'linear_getViewer' tool definition in the allToolDefinitions array used for MCP registration.export const allToolDefinitions: MCPToolDefinition[] = [ // User tools getViewerToolDefinition, getOrganizationToolDefinition, getUsersToolDefinition, getLabelsToolDefinition,
- src/index.ts:44-55 (registration)Top-level request handler in MCP server that dynamically registers and dispatches to tool handlers including 'linear_getViewer'.handleRequest: async (req: { name: string; args: unknown }) => { const handlers = registerToolHandlers(linearService); const toolName = req.name; if (toolName in handlers) { // Use a type assertion here since we know the tool name is valid const handler = handlers[toolName as keyof typeof handlers]; return await handler(req.args); } else { throw new Error(`Unknown tool: ${toolName}`); } },