query_company_basic_info
Retrieve basic company details such as name, legal representative, and registered capital in China by providing the full company name for a quick overview.
Instructions
Query and return basic information such as company name, legal representative, and registered capital by company full name to understand the company overview. Please use the fuzzy query tool to obtain the company full name before calling this tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entname | Yes | company full name |
Implementation Reference
- src/index.ts:143-157 (handler)The tool handler function that takes 'entname' (company full name), calls the yushantwo helper with prodId 'PBB021' to query the API, and returns the response as text content.async ({entname}) => { const requestData = { entname: entname }; const prodId = "PBB021"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; }
- src/index.ts:140-142 (schema)Zod input schema defining 'entname' parameter as a string describing the company full name.{ entname: z.string().describe("company full name"), },
- src/index.ts:137-158 (registration)Registration of the 'query_company_basic_info' tool on the MCP server, including name, description, schema, and inline handler.server.tool( "query_company_basic_info", "Query and return basic information such as company name, legal representative, and registered capital by company full name to understand the company overview. Please use the fuzzy query tool to obtain the company full name before calling this tool.", { entname: z.string().describe("company full name"), }, async ({entname}) => { const requestData = { entname: entname }; const prodId = "PBB021"; const data = await yushantwo(requestData, prodId); return { content: [ { type: "text", text: data, }, ], }; } );
- src/index.ts:49-86 (helper)Shared helper function to make encrypted API calls to the Yushan service, used by multiple tools including query_company_basic_info.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"; } }