query_company_abnormal_business_operation
Identify and retrieve details of abnormal business operations for a company by its full name using fuzzy query results for accurate data extraction.
Instructions
Query the abnormal business operation information of an company by its full name. Please use the fuzzy query tool to obtain the company full name before calling this tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyWord | Yes | company full name |
Implementation Reference
- src/index.ts:283-297 (handler)Handler function that takes the company full name as 'keyWord', prepares request data, calls the shared yushantwo API helper with product ID 'PBB055', and returns the response as structured text content.async ({keyWord}) => { const requestData = { keyWord: keyWord }; const prodId = "PBB055"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; }
- src/index.ts:280-282 (schema)Zod schema for the tool input, requiring a 'keyWord' string parameter described as the company full name.{ keyWord: z.string().describe("company full name") },
- src/index.ts:277-298 (registration)Full registration of the tool via server.tool call, specifying name, description, input schema, and handler function.server.tool( "query_company_abnormal_business_operation", "Query the abnormal business operation information of an company by its full name. Please use the fuzzy query tool to obtain the company full name before calling this tool.", { keyWord: z.string().describe("company full name") }, async ({keyWord}) => { const requestData = { keyWord: keyWord }; const prodId = "PBB055"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; } );
- src/index.ts:49-86 (helper)Shared helper function that makes encrypted POST requests to the Yushan API endpoint, generates request signatures, handles AES encryption/decryption, and returns the decrypted response string. Used by all tools including this one.async function yushantwo(requestData: RequestData, prodId: string): Promise<string> { const url = "***"; const reqTime = Date.now(); const requestSN = Array.from({ length: 32 }, () => "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678"[Math.floor(Math.random() * 58)]).join(""); const requestBody = JSON.stringify({ prod_id: prodId, req_data: requestData, req_time: reqTime, request_sn: requestSN, }); // 加密请求数据 const encryptedRequest = encrypt(requestBody, apiKey); const headers = { AES_KEY: apiKey, ACCT_ID: apiUserId, ENCODE: "AES256", }; try { const response = await fetch(url, { method: "POST", headers: headers, body: encryptedRequest, }); const responseText = await response.text(); // 解密返回数据 const decryptedString = decrypt(responseText, apiKey); return decryptedString; } catch (e) { console.error("Error:", e); return "error"; } }