get_current_user
Retrieve details about the currently authenticated user from the Octopus Deploy API to verify identity and access permissions.
Instructions
Get information about the current authenticated user
This tool retrieves information about the currently authenticated user from the Octopus Deploy API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/getCurrentUser.ts:28-53 (handler)The core handler function that implements the 'get_current_user' tool logic. It uses the shared client configuration helper to create an Octopus Deploy API client, fetches the current user details from the '/api/users/me' endpoint, maps the response fields to a clean object, and returns it as a text content block containing JSON.async () => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const user = await client.get<CurrentUser>("~/api/users/me"); const currentUser = { id: user.Id, username: user.Username, displayName: user.DisplayName, isActive: user.IsActive, isService: user.IsService, emailAddress: user.EmailAddress, canPasswordBeEdited: user.CanPasswordBeEdited, isRequestor: user.IsRequestor, }; return { content: [ { type: "text", text: JSON.stringify(currentUser), }, ], }; }
- src/tools/getCurrentUser.ts:17-55 (registration)The primary registration function for the 'get_current_user' tool. It calls server.tool() with the tool name, multi-line description, empty input schema object, output metadata (title and readOnlyHint), and the handler function.export function registerGetCurrentUserTool(server: McpServer) { server.tool( "get_current_user", `Get information about the current authenticated user This tool retrieves information about the currently authenticated user from the Octopus Deploy API.`, {}, { title: "Get current user information", readOnlyHint: true, }, async () => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const user = await client.get<CurrentUser>("~/api/users/me"); const currentUser = { id: user.Id, username: user.Username, displayName: user.DisplayName, isActive: user.IsActive, isService: user.IsService, emailAddress: user.EmailAddress, canPasswordBeEdited: user.CanPasswordBeEdited, isRequestor: user.IsRequestor, }; return { content: [ { type: "text", text: JSON.stringify(currentUser), }, ], }; } ); }
- src/tools/getCurrentUser.ts:57-61 (registration)Self-registration of the tool definition into the global TOOL_REGISTRY. Specifies the tool name, configuration (toolset 'context', read-only), and the registration function to be called later by the index.ts registerTools.registerToolDefinition({ toolName: "get_current_user", config: { toolset: "context", readOnly: true }, registerFn: registerGetCurrentUserTool, });
- src/tools/getCurrentUser.ts:6-15 (schema)TypeScript interface matching the structure of the user object returned by the Octopus Deploy API's '~/api/users/me' endpoint, used for type-safe API response handling.interface CurrentUser { Id: string; Username: string; DisplayName: string; IsActive: boolean; IsService: boolean; EmailAddress: string; CanPasswordBeEdited: boolean; IsRequestor: boolean; }
- src/tools/index.ts:29-29 (registration)Import statement that triggers the execution of the registerToolDefinition in getCurrentUser.ts, adding it to the TOOL_REGISTRY for conditional registration during server setup.import './getCurrentUser.js';