Skip to main content
Glama

whoAmI

Retrieve details about the currently authenticated Jenkins user, including identity and permissions, to verify access and configure automation workflows.

Instructions

Get information about the current authenticated user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the whoAmI tool logic. It makes an API call to /whoAmI/api/json to retrieve current user information and returns a standardized success or failure response.
    export async function whoAmI(client) { try { const response = await client.get("/whoAmI/api/json"); if (response.status === 200) { return success("whoAmI", { user: response.data }); } return failure("whoAmI", "Failed to get user info", { statusCode: response.status, }); } catch (error) { return formatError(error, "get user info"); } }
  • Registration of the whoAmI tool in the central toolRegistry. Includes name, description, empty input schema (no parameters required), and reference to the handler function.
    whoAmI: { name: "whoAmI", description: "Get information about the current authenticated user", inputSchema: { type: "object", properties: {}, }, handler: whoAmI, },
  • Input schema for the whoAmI tool, defining an empty object (no input parameters required).
    inputSchema: { type: "object", properties: {}, },
  • Helper function formatError used in the whoAmI handler to standardize error responses.
    export function formatError(error, operation) { const status = error.response?.status; const errorInfo = { success: false, operation, message: error.message, statusCode: status, code: error.code, }; if (status === 403) { errorInfo.authError = true; errorInfo.message = "Permission denied - check job permissions or CSRF settings"; } else if (status === 401) { errorInfo.authError = true; errorInfo.message = "Authentication failed - check username and API token"; } else if (status === 404) { errorInfo.message = `Resource not found during ${operation}`; } if (error.response?.data && typeof error.response.data === "object") { errorInfo.responseData = error.response.data; } return errorInfo; }
  • Helper function success used to wrap successful responses in whoAmI.
    export function success(operation, data = {}) { return { success: true, operation, ...data }; }
  • Helper function failure used to wrap failure responses in whoAmI.
    export function failure(operation, message, meta = {}) { return { success: false, operation, message, ...meta }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/umishra1504/Jenkins-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server