detect
Identify AI-generated text using advanced detection methods like COPYLEAKS and HEMINGWAY. Generates task details for transparency and provides a task-specific URL for detailed analysis.
Instructions
Detect whether the text is AI-generated.Show to user the task detail url. Extract the taskId field, then concatenate the link in the following format: https://pre-www.text2go.ai/?utm_source=claude_mcp&taskId={taskId}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detectionTypeList | Yes | ||
| text | Yes | ||
| type | Yes |
Input Schema (JSON Schema)
{
"properties": {
"detectionTypeList": {
"items": {
"enum": [
"COPYLEAKS",
"HEMINGWAY"
],
"type": "string"
},
"type": "array"
},
"text": {
"type": "string"
},
"type": {
"enum": [
"original_text"
],
"type": "string"
}
},
"required": [
"type",
"text",
"detectionTypeList"
],
"type": "object"
}
Implementation Reference
- src/index.ts:95-125 (handler)The execution handler for the 'detect' tool. It validates input using AiDetectArgumentSchema, calls the external API for AI text detection, and formats the response.if (name === "detect") { const argument = AiDetectArgumentSchema.parse(args); const detectUrl = `${API_BASE}/rewrite/text-detection`; const detectData = await makeRequest<AiDetectResponse>(detectUrl, argument); if (!detectData) { return { content: [ { type: "text", text: "Failed to retrieve alerts data", }, ], }; } const responseData = { ...detectData ,text: undefined, }; return { content: [ { type: "text", text: JSON.stringify(responseData), }, ], }; } else {
- src/index.ts:41-60 (schema)JSON Schema definition for the 'detect' tool input, provided in tool registration.inputSchema: { type: "object", properties: { type: { type: "string", enum: ["original_text"], }, text: { type: "string", }, detectionTypeList: { type: "array", items: { type: "string", enum: ["COPYLEAKS", "HEMINGWAY"], }, }, }, required: ["type", "text", "detectionTypeList"], },
- src/index.ts:13-21 (schema)Zod schema used internally to parse and validate arguments for the 'detect' tool.const AiDetectArgumentSchema = z .object({ type: z.enum(["original_text"]), text: z.string(), detectionTypeList: z.array( z.enum(["COPYLEAKS", "HEMINGWAY"]) ), }) .required();
- src/index.ts:35-64 (registration)Registration of the 'detect' tool in the ListToolsRequestSchema handler, including its name, description, and input schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "detect", description: "Detect whether the text is AI-generated.Show to user the task detail url. Extract the taskId field, then concatenate the link in the following format: https://pre-www.text2go.ai/?utm_source=claude_mcp&taskId={taskId}", inputSchema: { type: "object", properties: { type: { type: "string", enum: ["original_text"], }, text: { type: "string", }, detectionTypeList: { type: "array", items: { type: "string", enum: ["COPYLEAKS", "HEMINGWAY"], }, }, }, required: ["type", "text", "detectionTypeList"], }, } ], }; });
- src/index.ts:66-88 (helper)Utility function used by the detect handler to make POST requests to the detection API.async function makeRequest<T>(url: string, data?: any): Promise<T | null> { const headers = { "User-Agent": USER_AGENT, "Accept": "application/json", "Content-Type": "application/json" }; try { const response = await fetch(url, { method: 'POST', headers, body: data ? JSON.stringify(data) : undefined }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return (await response.json()) as T; } catch (error) { console.error("Error making request:", error); return null; } }