Use o CleanTextLab com Strands Agents (MCP)
•2 min read
Use o CleanTextLab com Strands Agents (MCP)
O Strands Agents facilita a criação de agentes em Python. O CleanTextLab adiciona ferramentas determinísticas (formatadores, limpadores, conversores) via MCP, para que seu agente delegue operações exatas sem reimplementá-las.
Este guia mostra duas opções:
- MCP local (stdio) com
npx cleantextlab-mcp - MCP hospedado (SSE) com
https://cleantextlab.com/api/mcp/sse
Pré-requisitos
- Python 3.10+
- Uma chave API Pro do CleanTextLab
- Strands Agents instalado
python -m venv .venv
source .venv/bin/activate
pip install strands-agents
Opção A: MCP local via npx (recomendado no dev local)
from strands import Agent
from strands.tools.mcp import MCPClient
from mcp import stdio_client, StdioServerParameters
cleantextlab = MCPClient(
lambda: stdio_client(
StdioServerParameters(
command="npx",
args=["-y", "cleantextlab-mcp"],
env={"CLEANTEXTLAB_API_KEY": "ctl_live_YOUR_KEY"},
)
)
)
with cleantextlab:
agent = Agent(tools=cleantextlab.list_tools_sync())
agent("Remove line breaks from: Hello\\nworld")
Opção B: MCP hospedado (SSE)
from strands import Agent
from strands.tools.mcp import MCPClient
from mcp import sse_client, SSEServerParameters
cleantextlab = MCPClient(
lambda: sse_client(
SSEServerParameters(
url="https://cleantextlab.com/api/mcp/sse",
headers={"x-api-key": "ctl_live_YOUR_KEY"},
)
)
)
with cleantextlab:
agent = Agent(tools=cleantextlab.list_tools_sync())
agent("Generate an ASCII tree from: src/app/page.tsx")
Por que MCP para agentes?
- Saída determinística para tarefas de formatação
- Menos tokens ao delegar operações pesadas
- Ferramentas reutilizáveis em workflows de agentes
Próximos passos
Pronto para construir? Obtenha sua chave API e conecte o CleanTextLab aos seus agentes.
Try the tools mentioned
Jump straight into the most relevant tools for this post.
Share this post