Skip to main content
Glama
CancellationToken.js614 B
const Cancelled = { isCancellationRequested: true, }; class Token { _isCancelled = false; get isCancellationRequested() { return this._isCancelled; } cancel() { this._isCancelled = true; } } export class CancellationTokenSource { _token = undefined; get token() { if (!this._token) { this._token = new Token(); } return this._token; } cancel() { if (!this._token) { this._token = Cancelled; } else if (this._token instanceof Token) { this._token.cancel(); } } }

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/Yuki4-dev/grpc-mcp'

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