Skip to main content
Glama
get-plugin-name.js796 B
'use strict' // this symbol is assigned by fastify-plugin const { kPluginMeta } = require('./symbols') /** * @param {function} plugin * @param {object} [options] * @param {string} [options.name] * @returns {string} */ function getPluginName (plugin, options) { // use explicit function metadata if set if (plugin[kPluginMeta] && plugin[kPluginMeta].name) { return plugin[kPluginMeta].name } // use explicit name option if set if (options && options.name) { return options.name } // determine from the function if (plugin.name) { return plugin.name } else { // takes the first two lines of the function if nothing else works return plugin.toString().split('\n').slice(0, 2).map(s => s.trim()).join(' -- ') } } module.exports = { getPluginName }

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/krtw00/search-mcp'

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