Skip to main content
Glama

listConfigs

Find configuration files in your workspace by scanning for JSON, YAML, TOML, and other formats using customizable patterns to manage settings.

Instructions

List configuration files in the workspace matching specified patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeNoGlob patterns for config files

Implementation Reference

  • The handler function for the 'listConfigs' tool. It calls the searchFiles helper with an empty query and listOnly: true to list configuration files matching the provided glob patterns.
    async ({ include }: { include: string[] }) => { try { const items = await searchFiles("", include, { listOnly: true, maxResults: 200 }); return { content: items }; } catch (error) { return { content: [{ type: "text", text: `Error listing configs: ${error}` }], isError: true, }; } }
  • Input schema for the 'listConfigs' tool, defining the optional 'include' parameter with default glob patterns for common config file extensions.
    { include: z .array(z.string()) .default(["**/*.{json,jsonc,yaml,yml,toml}"]) .describe("Glob patterns for config files"), },
  • src/index.ts:112-132 (registration)
    Registration of the 'listConfigs' tool using mcp.tool(), including name, description, input schema, and inline handler function.
    mcp.tool( "listConfigs", "List configuration files in the workspace matching specified patterns", { include: z .array(z.string()) .default(["**/*.{json,jsonc,yaml,yml,toml}"]) .describe("Glob patterns for config files"), }, async ({ include }: { include: string[] }) => { try { const items = await searchFiles("", include, { listOnly: true, maxResults: 200 }); return { content: items }; } catch (error) { return { content: [{ type: "text", text: `Error listing configs: ${error}` }], isError: true, }; } } );
  • The searchFiles helper function, crucial for listConfigs as it performs glob file searching and listing (when listOnly=true), filtering, and preview generation.
    export async function searchFiles( query: string, include: string[], options: SearchOptions = {} ): Promise<SearchResultItem[]> { const { maxResults = 100, listOnly = false } = options; const files = await fg(include, { dot: false, ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"], unique: true, }); const results: SearchResultItem[] = []; for (const file of files) { if (listOnly) { results.push({ type: "text", text: file }); if (results.length >= maxResults) break; continue; } try { const content = await fs.readFile(file, "utf8"); if (!query || content.toLowerCase().includes(query.toLowerCase())) { const preview = content.slice(0, 2000); results.push({ type: "text", text: `# ${file}\n\n${preview}` }); } if (results.length >= maxResults) break; } catch { // ignore unreadable files } } return results; }

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/cloud-aspect/Config-MCP-Server'

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