Skip to main content
Glama

list_build_configs

Retrieve and filter build configurations from TeamCity with pagination support for efficient CI/CD pipeline management.

Instructions

List build configurations (supports pagination)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locatorNoOptional build type locator to filter
projectIdNoFilter by project ID
pageSizeNoItems per page (default 100)
maxPagesNoMax pages to fetch (when all=true)
allNoFetch all pages up to maxPages
fieldsNoOptional fields selector for server-side projection

Implementation Reference

  • Core handler function implementing list_build_configs tool logic: fetches, filters, sorts, caches TeamCity build configurations with optional metadata (VCS roots, parameters, project hierarchy) and advanced filtering (name, VCS, status).
    /**
     * List build configurations with optional filtering and metadata extraction
     */
    async listBuildConfigs(
      params: BuildConfigNavigatorParams = {}
    ): Promise<BuildConfigNavigatorResult> {
      const cacheKey = this.generateCacheKey(params);
    
      // Check cache first
      const cachedEntry = this.cache.get(cacheKey);
      if (cachedEntry != null && Date.now() - cachedEntry.timestamp < this.cacheTtlMs) {
        debug('Cache hit for build configurations', { cacheKey });
        return cachedEntry.data;
      }
    
      try {
        const locator = this.buildLocator(params);
        const fields = this.buildFields(params);
    
        debug('Fetching build configurations', { locator });
    
        const response = await this.client.modules.buildTypes.getAllBuildTypes(locator, fields);
    
        if (response.data == null || !isBuildTypesResponse(response.data)) {
          throw new Error('Invalid API response from TeamCity');
        }
    
        const buildConfigs = await this.processBuildConfigs(response.data, params);
        const totalCount = response.data.count ?? buildConfigs.length;
    
        const result: BuildConfigNavigatorResult = {
          buildConfigs,
          totalCount,
          hasMore: this.calculateHasMore(buildConfigs.length, totalCount, params.pagination),
          viewMode: params.viewMode ?? 'list',
          groupedByProject:
            params.viewMode === 'project-grouped'
              ? this.groupBuildConfigsByProject(buildConfigs)
              : undefined,
        };
    
        // Cache successful results
        this.cacheResult(cacheKey, result);
    
        return result;
      } catch (error) {
        logError(
          'Failed to fetch build configurations',
          error instanceof Error ? error : new Error(String(error)),
          {
            locator: this.buildLocator(params),
          }
        );
    
        throw this.transformError(error, params);
      }
    }
  • Input schema defining parameters for filtering, sorting, pagination, and metadata inclusion in list_build_configs tool.
    export interface BuildConfigNavigatorParams {
      projectId?: string;
      projectIds?: string[];
      namePattern?: string;
      includeVcsRoots?: boolean;
      includeParameters?: boolean;
      includeProjectHierarchy?: boolean;
      viewMode?: 'list' | 'project-grouped';
      vcsRootFilter?: {
        url?: string;
        branch?: string;
        vcsName?: string;
      };
      statusFilter?: {
        lastBuildStatus?: 'SUCCESS' | 'FAILURE' | 'ERROR' | 'UNKNOWN';
        paused?: boolean;
        hasRecentActivity?: boolean;
        activeSince?: Date;
      };
      sortBy?: 'name' | 'project' | 'lastModified';
      sortOrder?: 'asc' | 'desc';
      pagination?: {
        limit?: number;
        offset?: number;
      };
    }
  • Output schema for the list_build_configs tool result, including build configs list, counts, and optional project grouping.
    export interface BuildConfigNavigatorResult {
      buildConfigs: BuildConfig[];
      totalCount: number;
      hasMore: boolean;
      viewMode: 'list' | 'project-grouped';
      groupedByProject?: Record<string, ProjectGroup>;
    }
  • Helper method that processes raw TeamCity API response into structured BuildConfig objects, applies client-side filters and extractions.
    private async processBuildConfigs(
      data: BuildTypesResponse,
      params: BuildConfigNavigatorParams
    ): Promise<BuildConfig[]> {
      const buildTypes = data.buildType ?? [];
      let buildConfigs: BuildConfig[] = [];
    
      for (const buildType of buildTypes) {
        const buildConfig: BuildConfig = {
          id: buildType.id ?? '',
          name: buildType.name ?? '',
          projectId: buildType.projectId ?? buildType.project?.id ?? '',
          projectName: buildType.projectName ?? buildType.project?.name ?? '',
          description: buildType.description,
          href: buildType.href,
          webUrl: buildType.webUrl,
          lastBuildDate: buildType.lastBuildDate,
          lastBuildStatus: buildType.lastBuildStatus,
          paused: buildType.paused,
        };
    
        // Apply name pattern filtering if specified
        if (params.namePattern && !this.matchesPattern(buildConfig.name, params.namePattern)) {
          continue;
        }
    
        // Extract VCS roots if requested or needed for filtering
        const needVcsRoots = params.includeVcsRoots === true ? true : params.vcsRootFilter != null;
        if (needVcsRoots && buildType['vcs-root-entries']) {
          buildConfig.vcsRoots = this.extractVcsRoots(buildType['vcs-root-entries']);
    
          // Apply VCS root filtering if specified
          if (
            params.vcsRootFilter &&
            !this.matchesVcsRootFilter(buildConfig.vcsRoots, params.vcsRootFilter)
          ) {
            continue;
          }
        }
    
        // Extract parameters if requested
        if (params.includeParameters && buildType.parameters) {
          buildConfig.parameters = this.extractParameters(buildType.parameters);
        }
    
        // Extract project hierarchy if requested
        if (params.includeProjectHierarchy) {
          // Intentional sequential per-item hierarchy fetch; keeps API usage simple in list flows
          // eslint-disable-next-line no-await-in-loop
          buildConfig.projectHierarchy = await this.extractProjectHierarchy(buildConfig.projectId);
        }
    
        // Apply status filtering if specified
        if (params.statusFilter && !this.matchesStatusFilter(buildConfig, params.statusFilter)) {
          continue;
        }
    
        buildConfigs.push(buildConfig);
      }
    
      // Apply sorting if specified
      if (params.sortBy) {
        buildConfigs = this.sortBuildConfigs(buildConfigs, params.sortBy, params.sortOrder ?? 'asc');
      }
    
      // Note: Pagination is already applied at the API level via the locator
      // (see buildLocator method which adds count and start parameters)
      // So we don't need to apply client-side pagination here
    
      return buildConfigs;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions pagination support, which is useful, but doesn't describe authentication requirements, rate limits, error conditions, or what the output looks like. For a read operation with 6 parameters, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just 5 words, front-loading the core purpose ('List build configurations') and adding only essential additional information ('supports pagination'). Every word earns its place with zero wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what a 'build configuration' represents in this context, how results are structured, or provide usage examples. The pagination mention is helpful but doesn't compensate for the overall lack of context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by mentioning pagination support, which relates to 'pageSize', 'maxPages', and 'all' parameters. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('build configurations'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'list_builds' or 'get_build_config', which could cause confusion about when to use this specific tool versus those alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for listing builds and configurations (e.g., 'list_builds', 'get_build_config'), there's no indication of when this paginated list is preferred over other listing or retrieval tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Daghis/teamcity-mcp'

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