classify_text
Predict research concepts and confidence scores from text inputs like titles and abstracts to categorize scholarly content.
Instructions
Classify arbitrary text to predict research concepts and confidence scores
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Title text to classify | |
| abstract | No | Abstract text to classify | |
| mailto | No | Email for rate limits | |
| api_key | No | Premium API key |
Implementation Reference
- src/tools/classifyText.ts:3-18 (handler)The classifyText function that executes the core logic of the classify_text MCP tool. It extracts title, abstract, and mailto from args, builds params, calls makeOpenAlexRequest to the /text endpoint for classification, and returns the JSON response formatted as MCP tool output.export async function classifyText(args: any) { const { title, abstract, mailto } = args; const params: Record<string, any> = {}; if (title) params.title = title; if (abstract) params.abstract = abstract; if (mailto) params.mailto = mailto; return { content: [{ type: "text", text: JSON.stringify(await makeOpenAlexRequest("/text", params), null, 2) }] }; }
- src/index.ts:245-253 (schema)Input schema for the classify_text tool defining the expected properties: title, abstract, mailto, and api_key with their types and descriptions.inputSchema: { type: "object", properties: { title: { type: "string", description: "Title text to classify" }, abstract: { type: "string", description: "Abstract text to classify" }, mailto: { type: "string", description: "Email for rate limits" }, api_key: { type: "string", description: "Premium API key" } } }
- src/index.ts:242-254 (registration)The classify_text tool registration in the ListTools response array, specifying name, description, and input schema.{ name: "classify_text", description: "Classify arbitrary text to predict research concepts and confidence scores", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title text to classify" }, abstract: { type: "string", description: "Abstract text to classify" }, mailto: { type: "string", description: "Email for rate limits" }, api_key: { type: "string", description: "Premium API key" } } } },
- src/index.ts:299-300 (registration)Dispatch registration in the CallToolRequest handler switch statement that routes classify_text calls to the classifyText function.case "classify_text": return await classifyText(args);
- src/index.ts:31-31 (registration)Import of the classifyText handler function used by the classify_text tool.import { classifyText } from "./tools/classifyText.js";