Skip to main content
Glama

get-current-context

Retrieve the current Azure DevOps context from a specified directory path, enabling integration with multiple organizations and projects using the DevOps Enhanced MCP server.

Instructions

Get current Azure DevOps context based on directory

Input Schema

NameRequiredDescriptionDefault
directoryNoDirectory path to check (defaults to current working directory)

Input Schema (JSON Schema)

{ "properties": { "directory": { "description": "Directory path to check (defaults to current working directory)", "type": "string" } }, "type": "object" }

Implementation Reference

  • The main handler function that implements the logic for the 'get-current-context' tool. It determines the current Azure DevOps context using either local configuration or directory detection and returns it as JSON.
    private handleGetCurrentContext(args?: any): any { const directory = args?.directory || process.cwd(); // If using local configuration, return current config if (!this.directoryDetector && this.currentConfig) { return { content: [{ type: 'text', text: JSON.stringify({ organizationUrl: this.currentConfig.organizationUrl, project: this.currentConfig.project, directory: directory, configurationSource: 'local', configFile: '.azure-devops.json' }, null, 2), }], }; } // Fall back to directory detector if available if (this.directoryDetector) { const context = this.directoryDetector.getProjectContext(directory); if (!context) { return { content: [{ type: 'text', text: 'No Azure DevOps context configured for the specified directory.', }], }; } return { content: [{ type: 'text', text: JSON.stringify({ organizationUrl: context.organizationUrl, project: context.projectName, directory: directory, configurationSource: 'environment', configuredDirectories: this.directoryDetector.getConfiguredDirectories(), }, null, 2), }], }; } return { content: [{ type: 'text', text: 'No Azure DevOps configuration found.', }], }; }
  • src/index.ts:332-344 (registration)
    Registration of the 'get-current-context' tool including its name, description, and input schema in the ListTools response.
    { name: 'get-current-context', description: 'Get current Azure DevOps context based on directory', inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Directory path to check (defaults to current working directory)', }, }, }, },
  • Input schema definition for the 'get-current-context' tool.
    inputSchema: { type: 'object', properties: { directory: { type: 'string', description: 'Directory path to check (defaults to current working directory)', }, },
  • Supporting helper method called by the tool handler to retrieve the project context (organization URL and project name) for a given directory.
    getProjectContext(currentDirectory?: string): { projectName: string; organizationUrl: string } | null { const config = this.detectConfiguration(currentDirectory); if (!config) { return null; } return { projectName: config.project, organizationUrl: config.organizationUrl }; }

Other Tools

Related 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