Skip to main content
Glama

mcp-youtube

by kirbah
objectUtils.ts1.23 kB
/** * Creates a new object by deeply cloning the original and then removing properties * specified by an array of dot-notation paths. It does not mutate the original object. * * @param obj The source object. * @param paths An array of strings representing the paths to exclude (e.g., 'snippet.thumbnails'). * @returns A new object with the specified paths removed. */ export function omitPaths<T extends object>(obj: T, paths: string[]): T { // Use JSON.parse/stringify for a simple, effective deep clone for plain JSON objects. const newObj = JSON.parse(JSON.stringify(obj)) as T; for (const path of paths) { const parts = path.split("."); let current: any = newObj; // Navigate down the path to the parent of the target property for (let i = 0; i < parts.length - 1; i++) { const part = parts[i]; if (current && current[part] !== undefined) { current = current[part]; } else { // Path doesn't exist, so we can't delete anything. current = null; break; } } // If the parent exists, delete the final property if (current && typeof current === "object") { delete current[parts[parts.length - 1]]; } } return newObj; }

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/kirbah/mcp-youtube'

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