Skip to main content
Glama
deepsearch.ts1.32 kB
import { DeepSearchMCPClient, type SearchOptions, type SearchResult } from "../deepsearch_mcp/client.js"; import { DeepSearchTransport } from "../source/api.js"; import { logger, type Logger } from "../source/logger.js"; interface AgentOptions { client?: DeepSearchMCPClient; transport?: DeepSearchTransport; } export class DeepSearchAgent { private readonly client: DeepSearchMCPClient; private readonly transport?: DeepSearchTransport; private readonly logger: Logger; constructor(options: AgentOptions = {}) { const agentLogger = logger.child({ agent: "deepsearch" }); agentLogger.debug("初始化 DeepSearchAgent", { providedClient: Boolean(options.client) }); if (options.client) { this.client = options.client; this.transport = options.transport; } else { const transport = options.transport ?? DeepSearchTransport.fromEnv(); this.client = new DeepSearchMCPClient(transport, { toolName: "deepsearch" }); this.transport = transport; } this.logger = agentLogger; } search(query: string, options: SearchOptions = {}): Promise<SearchResult> { this.logger.info("执行检索", { query, options }); return this.client.search(query, options); } close(): void { this.logger.debug("关闭代理"); this.transport?.close(); } }

Implementation Reference

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/yuemingruoan/DeepSearch-MCP'

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