list_accounts
Retrieve all accounts within a specified Octopus Deploy space, with optional filtering by name, account type, or other parameters to manage access credentials.
Instructions
List accounts in a space
This tool lists all accounts in a given space. The space name is required. You can optionally filter by various parameters like name, account type, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountType | No | ||
| ids | No | ||
| partialName | No | ||
| skip | No | ||
| spaceName | Yes | ||
| take | No |
Implementation Reference
- src/tools/listAccounts.ts:30-70 (handler)The main handler function for the 'list_accounts' tool. It creates an Octopus Deploy client, resolves the space ID, queries the accounts API endpoint with optional filters, maps the account resources, and returns a structured JSON response.async ({ spaceName, skip, take, ids, partialName, accountType, }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<ResourceCollection<AccountResource>>( "~/api/{spaceId}/accounts{?skip,take,ids,partialName,accountType}", { spaceId, skip, take, ids, partialName, accountType, } ); const accounts = response.Items.map((account: AccountResource) => mapAccountResource(account)); return { content: [ { type: "text", text: JSON.stringify({ totalResults: response.TotalResults, itemsPerPage: response.ItemsPerPage, numberOfPages: response.NumberOfPages, lastPageNumber: response.LastPageNumber, items: accounts, }), }, ], }; }
- src/tools/listAccounts.ts:18-25 (schema)Input schema defined using Zod for the tool parameters: spaceName (required), skip, take, ids, partialName, accountType (optional).{ spaceName: z.string(), skip: z.number().optional(), take: z.number().optional(), ids: z.array(z.string()).optional(), partialName: z.string().optional(), accountType: z.nativeEnum(AccountType).optional(), },
- src/tools/listAccounts.ts:12-72 (registration)Primary registration function for the 'list_accounts' tool on the MCP server, including name, description, input schema, output hints, and handler.export function registerListAccountsTool(server: McpServer) { server.tool( "list_accounts", `List accounts in a space This tool lists all accounts in a given space. The space name is required. You can optionally filter by various parameters like name, account type, etc.`, { spaceName: z.string(), skip: z.number().optional(), take: z.number().optional(), ids: z.array(z.string()).optional(), partialName: z.string().optional(), accountType: z.nativeEnum(AccountType).optional(), }, { title: "List all accounts in an Octopus Deploy space", readOnlyHint: true, }, async ({ spaceName, skip, take, ids, partialName, accountType, }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const spaceId = await resolveSpaceId(client, spaceName); const response = await client.get<ResourceCollection<AccountResource>>( "~/api/{spaceId}/accounts{?skip,take,ids,partialName,accountType}", { spaceId, skip, take, ids, partialName, accountType, } ); const accounts = response.Items.map((account: AccountResource) => mapAccountResource(account)); return { content: [ { type: "text", text: JSON.stringify({ totalResults: response.TotalResults, itemsPerPage: response.ItemsPerPage, numberOfPages: response.NumberOfPages, lastPageNumber: response.LastPageNumber, items: accounts, }), }, ], }; } ); }
- src/tools/listAccounts.ts:74-78 (registration)Self-registration of the tool definition into the global TOOL_REGISTRY, specifying toolset 'accounts' and read-only nature for conditional enabling in index.ts.registerToolDefinition({ toolName: "list_accounts", config: { toolset: "accounts", readOnly: true }, registerFn: registerListAccountsTool, });