get_account
Retrieve detailed account information by providing the space name and account ID to access specific account data within Octopus Deploy instances.
Instructions
Get details for a specific account by its ID
This tool retrieves detailed information about a specific account using its ID. The space name and account ID are both required.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes | The ID of the account to retrieve | |
| spaceName | Yes |
Implementation Reference
- src/tools/getAccount.ts:25-49 (handler)The async handler function that implements the core logic of the 'get_account' tool: creates an Octopus Deploy client, resolves the space ID, fetches the account resource by ID, maps it to a simplified structure, and returns it as a JSON string in the tool response format.async ({ spaceName, accountId }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<AccountResource>( "~/api/{spaceId}/accounts/{id}", { spaceId, id: accountId, } ); const account = mapAccountResource(response); return { content: [ { type: "text", text: JSON.stringify(account), }, ], }; } );
- src/tools/getAccount.ts:17-20 (schema)Zod input schema defining the required parameters: spaceName (string) and accountId (string).{ spaceName: z.string(), accountId: z.string().describe("The ID of the account to retrieve"), },
- src/tools/getAccount.ts:11-50 (registration)Registers the 'get_account' tool on the MCP server using server.tool(), including name, description, input schema, metadata, and inline handler function.export function registerGetAccountTool(server: McpServer) { server.tool( "get_account", `Get details for a specific account by its ID This tool retrieves detailed information about a specific account using its ID. The space name and account ID are both required.`, { spaceName: z.string(), accountId: z.string().describe("The ID of the account to retrieve"), }, { title: "Get a specific account by ID from an Octopus Deploy space", readOnlyHint: true, }, async ({ spaceName, accountId }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<AccountResource>( "~/api/{spaceId}/accounts/{id}", { spaceId, id: accountId, } ); const account = mapAccountResource(response); return { content: [ { type: "text", text: JSON.stringify(account), }, ], }; } ); }
- src/tools/getAccount.ts:52-56 (registration)Registers the tool metadata in the global TOOL_REGISTRY, specifying toolset 'accounts' and read-only, linking to the register function for conditional registration in index.ts.registerToolDefinition({ toolName: "get_account", config: { toolset: "accounts", readOnly: true }, registerFn: registerGetAccountTool, });