get_current_user
Retrieve information 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 creates an Octopus Deploy client using environment config, fetches the current user via the API, maps the response, and returns it as a JSON string in MCP content format.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)Registers the 'get_current_user' tool on the MCP server with description, empty input schema, output hints, and inline 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 into the global TOOL_REGISTRY, specifying toolset 'context' and read-only nature, linking to the register function.registerToolDefinition({ toolName: "get_current_user", config: { toolset: "context", readOnly: true }, registerFn: registerGetCurrentUserTool, });
- src/tools/getCurrentUser.ts:6-15 (schema)TypeScript interface defining the structure of the user object fetched from the Octopus Deploy API, used for type safety in the handler.interface CurrentUser { Id: string; Username: string; DisplayName: string; IsActive: boolean; IsService: boolean; EmailAddress: string; CanPasswordBeEdited: boolean; IsRequestor: boolean; }