query_company_court_litigation_related_info
Retrieve court litigation records for Chinese companies by full name to assess legal risks and compliance status.
Instructions
Obtain the litigation - related information of a target company in court by its full name. Please use the fuzzy query tool to obtain the company full name before calling this tool.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>"
},
"name": "query_company_court_litigation_related_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | company full name |
Implementation Reference
- src/index.ts:259-274 (handler)The handler function for the tool. It receives the company full name, constructs a requestData object specifying various litigation data types, calls the yushantwo helper with product ID 'PBB183', and returns the API response formatted as MCP content.
async ({name}) => { const requestData = { name: name, dataType: "satparty,fdaparty,epbparty,qtsparty,xzhmd,pbcparty,news,cpws,ktgg,zxgg,shixin,fygg,ajlc,bgt,zcdj,zccf,jyyc,job" }; const prodId = "PBB183"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; } - src/index.ts:256-258 (schema)Input schema using Zod, defining a single string parameter 'name' for the company full name.
{ name: z.string().describe("company full name"), }, - src/index.ts:253-275 (registration)Registration of the tool using server.tool(), providing name, description, input schema, and inline handler function.
server.tool( "query_company_court_litigation_related_info", "Obtain the litigation - related information of a target company in court by its full name. Please use the fuzzy query tool to obtain the company full name before calling this tool.", { name: z.string().describe("company full name"), }, async ({name}) => { const requestData = { name: name, dataType: "satparty,fdaparty,epbparty,qtsparty,xzhmd,pbcparty,news,cpws,ktgg,zxgg,shixin,fygg,ajlc,bgt,zcdj,zccf,jyyc,job" }; const prodId = "PBB183"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; } ); - src/index.ts:49-86 (helper)Shared helper function yushantwo that handles the API call to Yushan service: generates request SN and time, encrypts the request body using AES, sends POST request, decrypts response, 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"; } }