Skip to main content
Glama

COA Goldfish MCP

by anortham
WorkspaceService.csโ€ข2.68 kB
using Microsoft.Extensions.Logging; namespace COA.Goldfish.McpServer.Services; public class WorkspaceService { private readonly ILogger<WorkspaceService> _logger; private readonly IPathResolutionService _pathResolution; /// <summary> /// Reserved workspace ID for cross-project global items /// </summary> public const string GlobalWorkspaceId = "__global__"; /// <summary> /// Default workspace when none is specified /// </summary> public const string DefaultWorkspaceId = "default"; public WorkspaceService(ILogger<WorkspaceService> logger, IPathResolutionService pathResolution) { _logger = logger; _pathResolution = pathResolution; } /// <summary> /// Get current workspace with proper path resolution /// </summary> public string GetCurrentWorkspace() { try { // Use the path resolution service to get workspace name var primaryWorkspacePath = _pathResolution.GetPrimaryWorkspacePath(); var workspaceName = _pathResolution.GetWorkspaceName(primaryWorkspacePath); _logger.LogDebug("Detected workspace: {WorkspaceName} from path: {WorkspacePath}", workspaceName, primaryWorkspacePath); return workspaceName; } catch (Exception ex) { _logger.LogError(ex, "Failed to detect workspace, using default"); return DefaultWorkspaceId; } } /// <summary> /// Check if a workspace ID is the global workspace /// </summary> public bool IsGlobalWorkspace(string workspaceId) { return string.Equals(workspaceId, GlobalWorkspaceId, StringComparison.OrdinalIgnoreCase); } /// <summary> /// Get workspace display name for UI/logging /// </summary> public string GetWorkspaceDisplayName(string workspaceId) { if (IsGlobalWorkspace(workspaceId)) { return "Global (Cross-Project)"; } if (workspaceId == DefaultWorkspaceId) { return "Default Workspace"; } return workspaceId; } /// <summary> /// Resolve workspace ID with fallback logic /// </summary> public string ResolveWorkspaceId(string? requestedWorkspace) { if (!string.IsNullOrEmpty(requestedWorkspace)) { // Handle special keywords if (requestedWorkspace.Equals("global", StringComparison.OrdinalIgnoreCase)) { return GlobalWorkspaceId; } return requestedWorkspace; } return GetCurrentWorkspace(); } }

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/anortham/coa-goldfish-mcp'

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