Skip to main content
Glama
sanitize.d.ts819 B
/** * Sanitize user-provided context to prevent prompt injection * * Strategy: * 1. Truncate to max length * 2. Detect obvious injection patterns * 3. Escape special characters * 4. Wrap in clear delimiters */ export declare function sanitizeContext(context: string): { sanitized: string; wasModified: boolean; warnings: string[]; }; /** * Escape backticks in text to prevent markdown code block breaking */ export declare function escapeBackticks(text: string): string; /** * Wrap context in safe delimiters that make it clear this is user data */ export declare function wrapUserContext(context: string): string; /** * Validate a string is safe (non-null, non-undefined) */ export declare function safeString(value: unknown, fallback?: string): string; //# sourceMappingURL=sanitize.d.ts.map

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cryptosquanch/legends-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server