REST API and MCP integration for programmatic text processing. Hosted at https://emdashguard.com
with smart em dash replacement.
All API endpoints are available at: https://emdashguard.com
Process text to replace em dashes using the Smart Replace algorithm.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
text | string | Yes | - | Text containing em dashes to process |
smart | boolean | No | true | Enable Smart Replace algorithm |
replacement | string | No | "--" | Token to replace em dashes with (ignored when smart=true) |
spacing | boolean | No | true | Add spaces around replacements |
curl -X POST https://emdashguard.com/api/process-text \
-H "Content-Type: application/json" \
-d '{
"text": "The result was clear — success!",
"smart": true,
"replacement": "--",
"spacing": true
}'
{
"success": true,
"data": {
"processedText": "The result was clear: success!"
}
}
Smart Replace Behavior: When smart = true
, the replacement
parameter is ignored. Smart Replace automatically chooses the best replacement based on context analysis.
{
"success": false,
"error": {
"code": "INVALID_PARAMETERS",
"message": "Invalid parameters: Expected string, received number"
}
}
emdashguard supports the Model Context Protocol for seamless integration with AI agents and language models. The MCP server is hosted alongside the REST API and provides the emdash_remover
tool.
To use emdashguard with Claude Desktop, add this configuration to your claude_desktop_config.json
file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"emdashguard": {
"command": "npx",
"args": [
"mcp-remote",
"https://emdashguard.com/api/mcp"
]
}
}
}
Note: emdashguard uses HTTP endpoints for MCP integration via the mcp-remote package.
After adding this configuration:
User: "Clean up the em dashes in this text: The result was clear — success!"
Claude: I'll clean up the em dashes in your text using the emdashguard tool.
[Using emdash_remover tool]
The text has been processed! Here's the cleaned version:
"The result was clear: success!"
The Smart Replace algorithm detected this as an explanation context and replaced the em dash with a colon, which is more appropriate for this type of sentence structure.
User: "Remove em dashes from this document and use double hyphens instead of Smart Replace"
Claude: I'll process your text with emdashguard using double hyphens as the replacement token.
[Using emdash_remover tool with smart: false, replacement: "--"]
Your document has been processed with all em dashes replaced with double hyphens (--) as requested.
For other MCP-compatible applications, use this general configuration:
{
"mcpServers": {
"emdashguard": {
"command": "node",
"args": ["-e", "require('http').request('https://emdashguard.com/api/mcp/tools').end()"],
"env": {
"EMDASHGUARD_API_BASE": "https://emdashguard.com"
}
}
}
}
Retrieve available MCP tools.
{
"tools": [
{
"name": "emdash_remover",
"description": "Remove em dashes from text using Smart Replace technology. Analyzes context to choose between colons (for explanations) and replacement tokens (for dialogue/pauses). Supports custom replacement tokens and spacing options.",
"inputSchema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text containing em dashes to process"
},
"smart": {
"type": "boolean",
"description": "Enable Smart Replace algorithm",
"default": true
},
"replacement": {
"type": "string",
"description": "Token to replace em dashes with",
"default": "--"
},
"spacing": {
"type": "boolean",
"description": "Add spaces around replacements",
"default": true
}
},
"required": ["text"]
}
}
]
}
MCP (Model Context Protocol) JSON-RPC 2.0 endpoint for AI agents.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "emdash_remover",
"arguments": {
"text": "API — Application Programming Interface",
"smart": true,
"replacement": "--",
"spacing": true
}
}
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "API: Application Programming Interface"
}
]
}
}
curl -X POST https://emdashguard.com/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "emdash_remover",
"arguments": {
"text": "Note — this is important",
"smart": true
}
}
}'
The Smart Replace algorithm uses sentence boundary detection and pattern recognition to analyze text context and choose the most appropriate replacement for each em dash. It considers surrounding text, punctuation, and linguistic patterns to make intelligent replacement decisions.
The algorithm analyzes a dynamic context window around each em dash, examining:
Option | Description | Impact |
---|---|---|
smart: true | Enable context analysis | Intelligent replacement selection |
smart: false | Disable context analysis | Uniform replacement with chosen token |
spacing: true | Add spaces around replacements | Better readability |
spacing: false | No automatic spacing | Preserve original spacing |
// Basic text processing
const response = await fetch('https://emdashguard.com/api/process-text', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: 'The result was clear — success!',
smart: true
})
});
const data = await response.json();
console.log(data.data.processedText); // "The result was clear: success!"
import requests
response = requests.post('https://emdashguard.com/api/process-text', json={
'text': 'API — Application Programming Interface',
'smart': True,
'replacement': '--',
'spacing': True
})
data = response.json()
print(data['data']['processedText']) # "API: Application Programming Interface"
const axios = require('axios');
async function callMCP() {
const response = await axios.post('https://emdashguard.com/api/mcp', {
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'emdash_remover',
arguments: {
text: 'Note — this is important',
smart: true
}
}
});
console.log(response.data.result.content[0].text);
}
Code | HTTP Status | Description |
---|---|---|
INVALID_PARAMETERS | 400 | Missing or invalid request parameters |
TEXT_TOO_LARGE | 400 | Input text exceeds 100,000 character limit |
PROCESSING_ERROR | 500 | Internal processing error |
INVALID_TOOL | 400 | Unknown MCP tool name |
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human readable error message"
}
}
Currently no rate limiting is implemented. For production use, consider implementing appropriate rate limiting based on your needs.