Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

list_tenants

Retrieve all tenants within a specified Octopus Deploy space, with optional filtering by project, tags, IDs, or name for targeted tenant management.

Instructions

List tenants in a space

This tool lists all tenants in a given space. The space name is required. Optionally provide skip and take parameters for pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsNoFilter by specific tenant IDs
partialNameNoFilter by partial tenant name match
projectIdNoFilter by specific project ID
skipNo
spaceNameYesThe space name
tagsNoFilter by tenant tags (comma-separated list)
takeNo

Implementation Reference

  • The main handler function for the 'list_tenants' tool. It uses the Octopus Deploy API client to query tenants in a space with optional filters and pagination, then formats and returns the results as JSON text.
    async ({ spaceName, skip, take, projectId, tags, ids, partialName }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const tenantRepository = new TenantRepository(client, spaceName); const tenantsResponse = await tenantRepository.list({ skip, take, projectId, tags, ids, partialName }); return { content: [ { type: "text", text: JSON.stringify({ totalResults: tenantsResponse.TotalResults, itemsPerPage: tenantsResponse.ItemsPerPage, numberOfPages: tenantsResponse.NumberOfPages, lastPageNumber: tenantsResponse.LastPageNumber, items: tenantsResponse.Items.map(tenant => ({ id: tenant.Id, name: tenant.Name, description: tenant.Description, projectEnvironments: tenant.ProjectEnvironments, tenantTags: tenant.TenantTags, clonedFromTenantId: tenant.ClonedFromTenantId, spaceId: tenant.SpaceId, publicUrl: getPublicUrl(`${configuration.instanceURL}/app#/{spaceId}/tenants/{tenantId}/overview`, { spaceId: tenant.SpaceId, tenantId: tenant.Id }), publicUrlInstruction: `You can view more details about this tenant in the Octopus Deploy web portal at the provided publicUrl.` })) }), }, ], }; }
  • Input schema for the 'list_tenants' tool using Zod, defining required spaceName and optional pagination/filter parameters.
    { spaceName: z.string().describe("The space name"), skip: z.number().optional(), take: z.number().optional(), projectId: z.string().optional().describe("Filter by specific project ID"), tags: z.string().optional().describe("Filter by tenant tags (comma-separated list)"), ids: z.array(z.string()).optional().describe("Filter by specific tenant IDs"), partialName: z.string().optional().describe("Filter by partial tenant name match") },
  • Registers the 'list_tenants' tool on the MCP server, including name, description, input schema, metadata, and handler.
    export function registerListTenantsTool(server: McpServer) { server.tool( "list_tenants", `List tenants in a space This tool lists all tenants in a given space. The space name is required. Optionally provide skip and take parameters for pagination.`, { spaceName: z.string().describe("The space name"), skip: z.number().optional(), take: z.number().optional(), projectId: z.string().optional().describe("Filter by specific project ID"), tags: z.string().optional().describe("Filter by tenant tags (comma-separated list)"), ids: z.array(z.string()).optional().describe("Filter by specific tenant IDs"), partialName: z.string().optional().describe("Filter by partial tenant name match") }, { title: "List all tenants in an Octopus Deploy space", readOnlyHint: true, }, async ({ spaceName, skip, take, projectId, tags, ids, partialName }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const tenantRepository = new TenantRepository(client, spaceName); const tenantsResponse = await tenantRepository.list({ skip, take, projectId, tags, ids, partialName }); return { content: [ { type: "text", text: JSON.stringify({ totalResults: tenantsResponse.TotalResults, itemsPerPage: tenantsResponse.ItemsPerPage, numberOfPages: tenantsResponse.NumberOfPages, lastPageNumber: tenantsResponse.LastPageNumber, items: tenantsResponse.Items.map(tenant => ({ id: tenant.Id, name: tenant.Name, description: tenant.Description, projectEnvironments: tenant.ProjectEnvironments, tenantTags: tenant.TenantTags, clonedFromTenantId: tenant.ClonedFromTenantId, spaceId: tenant.SpaceId, publicUrl: getPublicUrl(`${configuration.instanceURL}/app#/{spaceId}/tenants/{tenantId}/overview`, { spaceId: tenant.SpaceId, tenantId: tenant.Id }), publicUrlInstruction: `You can view more details about this tenant in the Octopus Deploy web portal at the provided publicUrl.` })) }), }, ], }; } ); }
  • Registers the tool definition in the global TOOL_REGISTRY for conditional enabling based on config.
    registerToolDefinition({ toolName: "list_tenants", config: { toolset: "tenants", readOnly: true }, registerFn: registerListTenantsTool, });

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/OctopusDeploy/mcp-server'

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