query_company_change_records
Retrieve company change records by entering the full company name to access historical modifications and updates for Chinese enterprises.
Instructions
Query the change records of an company by its full name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entName | Yes | company full name |
Implementation Reference
- src/index.ts:189-203 (handler)Handler function that takes company full name (entName), prepares request data, calls the shared yushantwo helper with product ID 'PBB031' to query change records via Yushan API, and returns the decrypted response as text content.async ({entName}) => { const requestData = { entName: entName }; const prodId = "PBB031"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; }
- src/index.ts:186-188 (schema)Input schema for the tool: requires 'entName' parameter as a string describing the company full name.{ entName: z.string().describe("company full name"), },
- src/index.ts:183-204 (registration)Registration of the 'query_company_change_records' tool using server.tool(), including name, description, Zod input schema, and inline async handler.server.tool( "query_company_change_records", "Query the change records of an company by its full name.", { entName: z.string().describe("company full name"), }, async ({entName}) => { const requestData = { entName: entName }; const prodId = "PBB031"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; } );
- src/index.ts:49-86 (helper)Shared utility function 'yushantwo' that performs AES-encrypted POST requests to the Yushan API using the provided product ID and request data, decrypts the response, and handles errors. Used by multiple 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"; } }