Brainiall NLP
Sentiment, toxicity, entity extraction, PII, translation, summary, QA, fraud scoring, safety audit.
我该使用它吗
质量与安全性
发现(2)
- LOW在 link_entities_to_wikidata 中
- LOW在 detect_prompt_injection 中
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"nlp": {
"url": "https://api.brainiall.com/mcp/nlp/mcp"
}
}
}远程端点
https://api.brainiall.com/mcp/nlp/mcpstreamable-http它能做什么
工具清单
工具(22)
🟢analyze_toxicity(text)
Analyze text for toxic content. Returns scores for 6 categories: toxic, severe_toxic, obscene, threat, insult, identity_hate. Each score is 0.0-1.0. BERT-based classifier with sub-15ms latency on GPU. Args: text: Text to analyze for toxicity (hate speech, insults, threats). Returns: dict with keys: - toxic (float 0-1): Overall toxicity score - severe_toxic (float 0-1): Severe toxicity score - obscene (float 0-1): Obscenity score - threat (float 0-1): Threat score - insult (float 0-1): Insult score - identity_hate (float 0-1): Identity-based hate score - is_toxic (bool): Whether text exceeds toxicity threshold
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to analyze for toxicity (hate speech, insults, threats)",
"maxLength": 100000,
"type": "string"
}
},
"required": [
"text"
]
}🟢analyze_sentiment(text, model)
Analyze text sentiment. Returns positive/negative classification with confidence scores. Brainiall Sentiment engine-based with sub-10ms latency. Multiple domain-specific model variants available. Args: text: Text to analyze for sentiment (positive/negative). model: Model variant -- 'general' (default), 'financial', 'twitter'. Returns: dict with keys: - label (str): 'positive' or 'negative' - score (float 0-1): Confidence score for the predicted label - scores (dict): All label scores (positive, negative)
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to analyze for sentiment (positive/negative)",
"maxLength": 100000,
"type": "string"
},
"model": {
"default": "general",
"description": "Model variant: 'general' (default), 'financial', 'twitter'",
"type": "string"
}
},
"required": [
"text"
]
}🟢extract_entities(text)
Extract named entities (NER) from text. Identifies persons, organizations, locations, and miscellaneous entities with span offsets and confidence scores. BERT-NER based with sub-50ms latency. Args: text: Text to extract named entities from. Returns: dict with keys: - entities (list): Detected entities, each containing: - text (str): Entity text - label (str): Entity type (PER, ORG, LOC, MISC) - start (int): Character offset start - end (int): Character offset end - score (float 0-1): Confidence score - count (int): Total number of entities found
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to extract named entities from (persons, organizations, locations)",
"maxLength": 100000,
"type": "string"
}
},
"required": [
"text"
]
}🟢detect_pii(text, redact)
Detect personally identifiable information (PII) in text. Finds emails, phone numbers, SSNs, credit cards, IP addresses, and person names. Optionally returns redacted text with PII replaced by type labels (e.g. [EMAIL], [PHONE]). BERT-NER + regex ensemble. Args: text: Text to scan for personally identifiable information. redact: If true, return redacted text with PII replaced by [TYPE]. Returns: dict with keys: - pii_found (list): Detected PII items, each containing: - text (str): The PII value found - type (str): PII type (EMAIL, PHONE, SSN, CREDIT_CARD, IP, PERSON) - start (int): Character offset start - end (int): Character offset end - score (float 0-1): Detection confidence - count (int): Total PII items found - redacted_text (str|null): Text with PII replaced (when redact=true) - has_pii (bool): Whether any PII was detected
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to scan for personally identifiable information",
"maxLength": 100000,
"type": "string"
},
"redact": {
"default": false,
"description": "If true, return redacted text with PII replaced by [TYPE]",
"type": "boolean"
}
},
"required": [
"text"
]
}🟢detect_language(text, top_k)
Detect the language of text. Supports 176 languages using fastText. Sub-1ms inference latency. Returns ISO 639-1 codes with confidence scores. Args: text: Text to identify the language of. top_k: Number of top language predictions to return (default: 3). Returns: dict with keys: - language (str): Top predicted language ISO 639-1 code - confidence (float 0-1): Confidence for top prediction - predictions (list): Top-k predictions, each with: - language (str): ISO 639-1 code - confidence (float 0-1): Prediction confidence
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to identify the language of",
"maxLength": 100000,
"type": "string"
},
"top_k": {
"default": 3,
"description": "Number of top language predictions to return",
"type": "integer"
}
},
"required": [
"text"
]
}🟢check_nlp_service
Check health status of NLP API services and loaded models. Returns: dict with keys: - status (str): 'healthy' or error state - models (dict): Loaded model status per capability - version (str): API version
输入模式
{
"type": "object",
"properties": {}
}🟢translate_text(text, target_lang, source_lang)
Translate text between 100+ languages. Args: text: The text to translate. target_lang: Target language code. source_lang: Source language code; omit to auto-detect. Returns: dict with the translated text (key: translated_text) and the detected source language if auto-detected.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "The text to translate",
"maxLength": 50000,
"type": "string"
},
"target_lang": {
"description": "Target language code (e.g. 'pt', 'es', 'fr', 'de', 'ja')",
"type": "string"
},
"source_lang": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Source language code; omit to auto-detect"
}
},
"required": [
"text",
"target_lang"
]
}🟢summarize_text(text, mode, max_length)
Summarize text — extractive (verbatim key sentences in original order) or abstractive (concise rewrite). Args: text: The text to summarize. mode: 'abstractive' or 'extractive'. max_length: Target maximum length of the summary, in words. Returns: dict with the summary (key: summary) plus word/char counts.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "The text to summarize",
"maxLength": 50000,
"type": "string"
},
"mode": {
"default": "abstractive",
"description": "'abstractive' (concise rewrite) or 'extractive' (most important sentences, verbatim)",
"type": "string"
},
"max_length": {
"default": 150,
"description": "Target maximum length of the summary, in words",
"maximum": 1000,
"minimum": 10,
"type": "integer"
}
},
"required": [
"text"
]
}🟢answer_question(text, question)
Answer a question using ONLY the supplied text; returns the supporting sentence(s) with character offsets. Replies found:false rather than guessing when the answer isn't present in the text. Args: text: The text/document to answer from. question: The question to answer. Returns: dict with keys: answer (str|null), found (bool), supporting_spans (list of {text, start, end}).
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "The text/document to answer from",
"maxLength": 50000,
"type": "string"
},
"question": {
"description": "The question to answer",
"maxLength": 1000,
"type": "string"
}
},
"required": [
"text",
"question"
]
}⚪knowledge_ingest(namespace, text, title)
Ingest a document into a knowledge base: it is chunked, embedded and stored for you (managed RAG). Args: namespace: The knowledge-base namespace. text: The document text. title: Optional title. Returns: dict with keys: doc_id (str), n_chunks (int).
输入模式
{
"type": "object",
"properties": {
"namespace": {
"description": "The knowledge-base namespace to ingest into (alphanumeric/hyphen)",
"maxLength": 128,
"type": "string"
},
"text": {
"description": "The document text to ingest",
"maxLength": 200000,
"type": "string"
},
"title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional title for the document"
}
},
"required": [
"namespace",
"text"
]
}🟢knowledge_query(namespace, question, top_k, rerank, synthesize)
Retrieve the most relevant passages from a knowledge base plus (optionally) a grounded, cited answer. Returns found:false rather than a guess when the passages don't contain the answer. Args: namespace: The knowledge-base namespace. question: The natural-language question. top_k: How many passages to retrieve. rerank: Re-order retrieved passages before answering. synthesize: Also return a grounded answer. Returns: dict with keys: answer (str|null), found (bool), passages (list), synthesized (bool), reranked (bool), ...
输入模式
{
"type": "object",
"properties": {
"namespace": {
"description": "The knowledge-base namespace to query",
"maxLength": 128,
"type": "string"
},
"question": {
"description": "The natural-language question",
"maxLength": 2000,
"type": "string"
},
"top_k": {
"default": 6,
"description": "How many passages to retrieve",
"maximum": 50,
"minimum": 1,
"type": "integer"
},
"rerank": {
"default": false,
"description": "Re-order the retrieved passages before answering",
"type": "boolean"
},
"synthesize": {
"default": true,
"description": "Also return a concise answer grounded only in the retrieved passages",
"type": "boolean"
}
},
"required": [
"namespace",
"question"
]
}🟢knowledge_list_documents(namespace)
List the documents stored in a knowledge base (most recent first). Args: namespace: The knowledge-base namespace. Returns: dict with keys: documents (list of {doc_id, title, ...}).
输入模式
{
"type": "object",
"properties": {
"namespace": {
"description": "The knowledge-base namespace",
"maxLength": 128,
"type": "string"
}
},
"required": [
"namespace"
]
}🟢fraud_score(amount, currency, avg_txn_amount_30d, txn_count_1h, txn_count_24h, ...)
Score a transaction or account event for fraud risk. Send whatever signals you have — all optional. Returns a 0-1 fraud probability, a risk level, the exact risk factors that drove the score (each with its weight, direction and a human-readable detail), and a recommended decision (allow|review|deny). Returns: dict with keys: fraud_probability (float), risk_level (str), decision (str), risk_score_points (float), risk_factors (list of {factor, weight, direction, detail}), decision_bands (dict).
输入模式
{
"type": "object",
"properties": {
"amount": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "The transaction amount"
},
"currency": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "ISO 4217 currency code"
},
"avg_txn_amount_30d": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "The account's avg transaction amount over the last 30 days (for amount-anomaly scoring)"
},
"txn_count_1h": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Number of transactions on this account in the last hour"
},
"txn_count_24h": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Number of transactions on this account in the last 24h"
},
"distinct_cards_24h": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Distinct cards used on this account in 24h"
},
"distinct_countries_24h": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Distinct countries seen on this account in 24h"
},
"is_new_device": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "First time seeing this device"
},
"is_new_ip": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "First time seeing this IP"
},
"is_tor": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Request originated from a Tor exit node"
},
"is_proxy_or_vpn": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Request originated from a proxy/VPN/datacenter IP"
},
"card_country": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "ISO country code of the payment instrument"
},
"ip_country": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "ISO country code geolocated from the IP"
},
"account_age_days": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Age of the account in days"
},
"avs_match": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Whether the address-verification check matched"
},
"cvv_provided": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Whether the CVV was provided"
},
"prior_chargebacks": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Number of prior chargebacks on this account"
},
"event_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Your identifier for this event (echoed back; use with fraud_feedback)"
}
}
}⚪fraud_feedback(event_id, label, notes)
Report the confirmed outcome of an event so the fraud model can be re-calibrated to your data. Args: event_id: The event identifier. label: 'fraud' | 'legitimate' | 'chargeback' | 'dispute'. notes: Optional free-text notes. Returns: dict with keys: event_id (str), label (str), accepted (bool), feedback_id (int).
输入模式
{
"type": "object",
"properties": {
"event_id": {
"description": "The event_id you passed to fraud_score (or your own identifier)",
"maxLength": 256,
"type": "string"
},
"label": {
"description": "The confirmed outcome: 'fraud' | 'legitimate' | 'chargeback' | 'dispute'",
"type": "string"
},
"notes": {
"anyOf": [
{
"maxLength": 2000,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional free-text notes"
}
},
"required": [
"event_id",
"label"
]
}🟢extract_key_phrases(text, top_k, max_ngram)
Statistical key-phrase extraction — top-N ranked phrases. Brainiall Key Phrases engine. Pure-statistical (TF + position + casing + stopword filter), no ML cost.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Input text",
"minLength": 1,
"type": "string"
},
"top_k": {
"default": 10,
"description": "Number of phrases to return",
"maximum": 50,
"minimum": 1,
"type": "integer"
},
"max_ngram": {
"default": 3,
"description": "Max words per phrase (1-4)",
"maximum": 4,
"minimum": 1,
"type": "integer"
}
},
"required": [
"text"
]
}🟢aspect_sentiment(text, aspects)
Sentiment per aspect. Brainiall Aspect Sentiment engine. Splits the text into sentences mentioning each aspect, classifies each, aggregates.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Input text",
"type": "string"
},
"aspects": {
"description": "Aspect terms to score (e.g. ['camera','battery','price'])",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"text",
"aspects"
]
}🟢classify_text_custom(text, labels, multi_label)
Zero-shot text classification — define your labels at call time. No training, no data upload. Brainiall Custom Classifier engine. Returns {top_label, scores, confidence}.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Input text",
"type": "string"
},
"labels": {
"description": "Your candidate labels (2-20 of them)",
"items": {
"type": "string"
},
"type": "array"
},
"multi_label": {
"default": false,
"description": "If True, multiple labels can apply",
"type": "boolean"
}
},
"required": [
"text",
"labels"
]
}🟢link_entities_to_wikidata(text, max_entities)
Named-entity recognition + canonical linking to Wikidata Q-ids. Brainiall Entity Linker engine. Disambiguates 'Apple' the company from 'apple' the fruit.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Input text",
"type": "string"
},
"max_entities": {
"default": 20,
"description": "Max entities to return",
"maximum": 100,
"minimum": 1,
"type": "integer"
}
},
"required": [
"text"
]
}🟢detect_conversational_pii(turns)
Multi-turn PII detection with cross-turn coreference. Brainiall Conversational PII engine. Same surface text + type across turns gets the same entity_id.
输入模式
{
"type": "object",
"properties": {
"turns": {
"description": "List of [role, content] dicts representing a dialogue",
"items": {
"additionalProperties": true,
"type": "object"
},
"type": "array"
}
},
"required": [
"turns"
]
}🟢detect_prompt_injection(prompt)
Classify a prompt before it reaches your LLM. Brainiall Prompt Shield engine. Returns category (jailbreak | prompt_injection | data_exfiltration | impersonation | none), severity, reason, confidence.
输入模式
{
"type": "object",
"properties": {
"prompt": {
"description": "The prompt text to classify (NOT executed)",
"maxLength": 20000,
"minLength": 1,
"type": "string"
}
},
"required": [
"prompt"
]
}🟢check_groundedness(claim, source)
Hallucination check: is a claim actually supported by a source text? Brainiall Groundedness engine. Returns {grounded, confidence, supporting_span, reason}.
输入模式
{
"type": "object",
"properties": {
"claim": {
"description": "The claim to verify",
"maxLength": 4000,
"type": "string"
},
"source": {
"description": "The source text the claim should be grounded in",
"maxLength": 20000,
"type": "string"
}
},
"required": [
"claim",
"source"
]
}🟢detect_protected_material(text)
Detect copyrighted text in user input — famous lyrics, literary openings, proprietary code. Brainiall Protected Material engine. Returns matched spans with source attribution.
输入模式
{
"type": "object",
"properties": {
"text": {
"description": "Text to scan for copyrighted material",
"maxLength": 20000,
"type": "string"
}
},
"required": [
"text"
]
}社区
证据