Skip to main content
Glama

get-repositories

Retrieve Azure DevOps project repositories with optional links to manage codebase access across multiple organizations.

Instructions

Get repositories from Azure DevOps project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeLinksNoInclude repository links in response

Implementation Reference

  • Executes the get-repositories tool by calling the Azure DevOps Git repositories API endpoint '/git/repositories', processes the response to extract key repository information, and formats it as MCP content.
    private async getRepositories(args: any): Promise<any> {
      try {
        const result = await this.makeApiRequest('/git/repositories?api-version=7.1');
    
        const repositories = result.value.map((repo: any) => ({
          id: repo.id,
          name: repo.name,
          url: repo.webUrl,
          defaultBranch: repo.defaultBranch,
          size: repo.size,
          ...(args.includeLinks && { links: repo._links })
        }));
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              count: repositories.length,
              repositories
            }, null, 2),
          }],
        };
      } catch (error) {
        throw new Error(`Failed to get repositories: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • src/index.ts:229-241 (registration)
    Registers the 'get-repositories' tool in the MCP server's listTools response, providing the tool name, description, and input schema.
    {
      name: 'get-repositories',
      description: 'Get repositories from Azure DevOps project',
      inputSchema: {
        type: 'object',
        properties: {
          includeLinks: {
            type: 'boolean',
            description: 'Include repository links in response',
          },
        },
      },
    },
  • Switch case in handleToolCall method that dispatches tool calls named 'get-repositories' to the getRepositories handler method.
    case 'get-repositories':
      return await this.getRepositories(args || {});
  • Helper method used by getRepositories to make authenticated API requests to Azure DevOps.
    private async makeApiRequest(endpoint: string, method: string = 'GET', body?: any): Promise<any> {
      if (!this.currentConfig) {
        throw new Error('No configuration available');
      }
    
      const { organizationUrl, pat, project } = this.currentConfig;
      const baseUrl = `${organizationUrl}/${project}/_apis`;
      const requestUrl = `${baseUrl}${endpoint}`;
      
      return new Promise((resolve, reject) => {
        const urlParts = new url.URL(requestUrl);
        const postData = body ? JSON.stringify(body) : undefined;
        
        const options = {
          hostname: urlParts.hostname,
          port: urlParts.port || 443,
          path: urlParts.pathname + urlParts.search,
          method,
          headers: {
            'Authorization': `Basic ${Buffer.from(`:${pat}`).toString('base64')}`,
            'Content-Type': method === 'PATCH' && endpoint.includes('/wit/workitems/')
              ? 'application/json-patch+json'
              : 'application/json',
            'Accept': 'application/json',
            // For preview APIs, we need to properly handle the API version in the URL, not headers
            ...(postData && { 'Content-Length': Buffer.byteLength(postData) }),
          },
        };
    
        const req = https.request(options, (res) => {
          let data = '';
          
          res.on('data', (chunk) => {
            data += chunk;
          });
          
          res.on('end', () => {
            try {
              if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
                const result = data ? JSON.parse(data) : {};
                resolve(result);
              } else {
                reject(new Error(`HTTP ${res.statusCode}: ${data}`));
              }
            } catch (error) {
              reject(new Error(`Failed to parse response: ${error}`));
            }
          });
        });
    
        req.on('error', (error) => {
          reject(new Error(`Request failed: ${error.message}`));
        });
    
        if (postData) {
          req.write(postData);
        }
        
        req.end();
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention whether this is a read-only operation, if it requires authentication, rate limits, pagination, or what the response format looks like (e.g., list of repositories with details). This leaves significant gaps for a tool with potential complexity.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It earns its place by clearly stating what the tool does, making it appropriately sized and well-structured.

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?

Given no annotations, no output schema, and a simple parameter set, the description is incomplete. It lacks details on behavioral aspects (e.g., safety, response format) and doesn't compensate for the absence of structured data, making it inadequate for full agent understanding in a context with sibling tools.

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?

The input schema has 100% description coverage, with one parameter (includeLinks) fully documented in the schema. The description adds no additional parameter information beyond the schema, so it meets the baseline of 3 for high schema coverage without compensating value.

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 action ('Get') and resource ('repositories'), specifying the source ('from Azure DevOps project'). It distinguishes from siblings like get-builds or get-pull-requests by focusing on repositories. However, it doesn't specify scope (e.g., all repositories vs. filtered), which prevents a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives like get-work-items or get-pull-requests. The description implies usage for retrieving repositories but lacks context on prerequisites, filtering needs, or explicit exclusions, leaving the agent to infer based on tool names alone.

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/wangkanai/devops-enhanced-mcp'

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