import { AnthropicError } from "../../error.mjs";
import { readableStreamAsyncIterable } from "../../streaming.mjs";
import { LineDecoder } from "./line.mjs";
export class JSONLDecoder {
constructor(iterator, controller) {
this.iterator = iterator;
this.controller = controller;
}
async *decoder() {
const lineDecoder = new LineDecoder();
for await (const chunk of this.iterator) {
for (const line of lineDecoder.decode(chunk)) {
yield JSON.parse(line);
}
}
for (const line of lineDecoder.flush()) {
yield JSON.parse(line);
}
}
[Symbol.asyncIterator]() {
return this.decoder();
}
static fromResponse(response, controller) {
if (!response.body) {
controller.abort();
throw new AnthropicError(`Attempted to iterate over a response with no body`);
}
return new JSONLDecoder(readableStreamAsyncIterable(response.body), controller);
}
}
//# sourceMappingURL=jsonl.mjs.map
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/caiovicentino/mcpGOTAS'
If you have feedback or need assistance with the MCP directory API, please join our Discord server