Skip to main content
Glama
aliyun

TongXiao Common Search MCP Server

by aliyun

common_search

Search the web for clean, accurate information using enhanced real-time capabilities that integrate multiple data sources to deliver high-quality results.

Instructions

标准搜索接口提供增强的网络开放域的实时搜索能力,通过大模型优化与多数据源融合的技术,查询干净、准确、多样、高质量的结果。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索问题(长度:>=2 and <=100)

Implementation Reference

  • The handler function that executes the 'common_search' tool. It sends a POST request to the TongXiao API with the query, processes the search results into a formatted Markdown string with title, URL, site, date, and summary for each result, and returns it as text content.
    export async function handleCommonSearch(TONGXIAO_API_KEY: string, params: any) { const { query } = params const url = new URL("https://cloud-iqs.aliyuncs.com/search/llm"); const response = await fetch(url.toString(), { method: 'POST', headers: { 'Content-Type': 'application/json', "X-API-Key": TONGXIAO_API_KEY }, body: JSON.stringify({ "query": query, "numResults": 5 }) }); if (response.status != 200) { const errorData = await response.text(); handleSearchError('common_search', response.status, errorData); } const data = await response.json(); const pageItems = data.pageItems const pageResults: string[] = [] for (let pageItem of pageItems) { let publishDate; if (pageItem.publishTime) { let date = new Date(pageItem.publishTime); publishDate = date.toISOString().split('T')[0]; } else { publishDate = ''; } const pageResult = ` 标题:${pageItem.title || ''} URL:${pageItem.link || ''} 站点名称:${pageItem.hostname || ''} 发布时间:${publishDate} 摘要: ${pageItem.summary || pageItem.snippet || ''} `.trim(); pageResults.push(pageResult); } let markdown = `# 搜索结果\n` markdown += pageResults.join("\n\n---\n\n"); return { content: [{ type: "text", text: markdown }], isError: false }; }
  • The tool definition object including name, description, and inputSchema for the 'common_search' tool.
    export const COMMON_SEARCH_TOOL = { name: "common_search", description: "标准搜索接口提供增强的网络开放域的实时搜索能力,通过大模型优化与多数据源融合的技术,查询干净、准确、多样、高质量的结果。", inputSchema: { type: "object", properties: { query: { type: "string", description: "搜索问题(长度:>=2 and <=100)" } }, required: ["query"] } };
  • src/index.ts:25-30 (registration)
    Registers the 'common_search' tool in the TOOLS list (used for listTools) and maps its name to the handler function in TOOL_FUNCTIONS (used for callTool).
    const TOOLS = [ COMMON_SEARCH_TOOL, ]; const TOOL_FUNCTIONS = { [COMMON_SEARCH_TOOL.name]: handleCommonSearch }
  • src/index.ts:33-35 (registration)
    MCP server request handler for listing tools, which returns the registered TOOLS including 'common_search'.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
  • Helper function to handle and throw MCP errors for common search API failures based on HTTP status codes.
    function handleSearchError(api: string, status: number, errorData: any): never { let code: number; let message: string; switch (status) { case 404: message = "Specified access key is not found."; break; case 403: message = "Please activate AI search service"; break; case 429: message = "Request was denied due to user flow control."; break; default: message = errorData || "Unknown Error"; } throw new McpError(status, `${api} 搜索失败: ${message}`); }

Other Tools

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/aliyun/alibabacloud-iqs-tongxiao-mcp-server'

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