Skip to main content
Glama
state.js2.36 kB
import { LocalSymbolIndex } from './services/local-symbol-index.js'; export class ServerState { activeTechnology; activeFrameworkData; frameworkIndex; expandedIdentifiers = new Set(); lastDiscovery; localSymbolIndex; getActiveTechnology() { return this.activeTechnology; } setActiveTechnology(technology) { const previousTechnology = this.activeTechnology; this.activeTechnology = technology; if (!technology) { this.resetIndexForNewTechnology(); } else if (previousTechnology?.identifier !== technology.identifier) { // Technology changed, reset index this.resetIndexForNewTechnology(); } } getActiveFrameworkData() { return this.activeFrameworkData; } setActiveFrameworkData(data) { this.activeFrameworkData = data; } clearActiveFrameworkData() { this.activeFrameworkData = undefined; } getFrameworkIndex() { return this.frameworkIndex; } setFrameworkIndex(index) { this.frameworkIndex = index; } clearFrameworkIndex() { this.frameworkIndex = undefined; this.expandedIdentifiers.clear(); } hasExpandedIdentifier(identifier) { return this.expandedIdentifiers.has(identifier); } markIdentifierExpanded(identifier) { this.expandedIdentifiers.add(identifier); } getLastDiscovery() { return this.lastDiscovery; } setLastDiscovery(lastDiscovery) { this.lastDiscovery = lastDiscovery; } getLocalSymbolIndex(client) { if (!this.localSymbolIndex) { const technologyIdentifier = this.activeTechnology?.identifier ?.replace('doc://com.apple.documentation/', '') ?.replace(/^documentation\//, ''); this.localSymbolIndex = new LocalSymbolIndex(client, technologyIdentifier); } return this.localSymbolIndex; } clearLocalSymbolIndex() { this.localSymbolIndex = undefined; } // Reset index when technology changes resetIndexForNewTechnology() { this.localSymbolIndex = undefined; this.activeFrameworkData = undefined; this.frameworkIndex = undefined; this.expandedIdentifiers.clear(); } } //# sourceMappingURL=state.js.map

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/MightyDillah/apple-doc-mcp'

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