We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hkonda015/McpServer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
chunking.py•505 B
from __future__ import annotations
from typing import List
def chunk_text(text: str, chunk_size: int = 800, overlap: int = 100) -> List[str]:
if chunk_size <= 0:
return [text]
chunks: List[str] = []
start = 0
n = len(text)
while start < n:
end = min(n, start + chunk_size)
chunks.append(text[start:end])
if end == n:
break
start = end - overlap if overlap > 0 else end
if start < 0:
start = 0
return chunks