Skip to main content
Glama

get-current-context

Retrieve the active Azure DevOps authentication context for a specific directory, enabling integration with multiple organizations and projects.

Instructions

Get current Azure DevOps context based on directory

Input Schema

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

Implementation Reference

  • The primary handler function that executes the 'get-current-context' tool logic, returning the detected Azure DevOps context 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 in the ListToolsRequestSchema handler, including description and input schema definition.
    { 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)', }, },
  • Helper method used by the handler to detect project context from directory via DirectoryDetector class.
    getProjectContext(currentDirectory?: string): { projectName: string; organizationUrl: string } | null { const config = this.detectConfiguration(currentDirectory); if (!config) { return null; } return { projectName: config.project, organizationUrl: config.organizationUrl }; }

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