Skip to main content
Glama

OpenAI SDK Knowledge MCP Server

by seratch
id-utils.ts759 B
export class IdUtils { private static readonly MAX_ID_LENGTH = 64; private static readonly HASH_LENGTH = 8; static ensureSafeId(proposedId: string): string { if (proposedId.length <= this.MAX_ID_LENGTH) { return proposedId; } const maxPrefixLength = this.MAX_ID_LENGTH - this.HASH_LENGTH - 1; const prefix = proposedId.substring(0, maxPrefixLength); const hash = this.generateHash(proposedId); return `${prefix}_${hash}`; } private static generateHash(input: string): string { let hash = 0; for (let i = 0; i < input.length; i++) { const char = input.charCodeAt(i); hash = (hash << 5) - hash + char; hash = hash & hash; } return Math.abs(hash).toString(16).padStart(8, "0"); } }

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/seratch/openai-sdk-knowledge-org'

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