Skip to main content
Glama

searchSettings

Search configuration and settings files (JSON/JSONC) for specific keys or values within your development workspace.

Instructions

Search configuration and settings files (JSON/JSONC) for keys or values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term to find in settings files
includeNoCustom glob patterns for settings files

Implementation Reference

  • src/index.ts:32-56 (registration)
    Registers the searchSettings tool with the MCP server, defining its description, input schema, and handler function.
    mcp.tool(
      "searchSettings",
      "Search configuration and settings files (JSON/JSONC) for keys or values",
      {
        query: z.string().describe("Search term to find in settings files"),
        include: z.array(z.string()).optional().describe("Custom glob patterns for settings files"),
      },
      async ({ query, include }: { query: string; include?: string[] }) => {
        try {
          const patterns = include ?? [
            "**/.vscode/settings.json",
            "**/settings.json",
            "**/*.json",
            "**/*.jsonc",
          ];
          const results = await searchFiles(query, patterns, { maxResults: 50 });
          return { content: results };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error searching settings: ${error}` }],
            isError: true,
          };
        }
      }
    );
  • Handler function for searchSettings tool. Searches configuration files using predefined patterns or custom includes, leveraging the shared searchFiles helper.
    async ({ query, include }: { query: string; include?: string[] }) => {
      try {
        const patterns = include ?? [
          "**/.vscode/settings.json",
          "**/settings.json",
          "**/*.json",
          "**/*.jsonc",
        ];
        const results = await searchFiles(query, patterns, { maxResults: 50 });
        return { content: results };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error searching settings: ${error}` }],
          isError: true,
        };
      }
    }
  • Input schema for searchSettings tool using Zod: query (required string) and optional include array.
    {
      query: z.string().describe("Search term to find in settings files"),
      include: z.array(z.string()).optional().describe("Custom glob patterns for settings files"),
    },
  • Shared helper function searchFiles that performs glob-based file search and content matching, used by searchSettings to find matches in settings files.
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions what files are searched (JSON/JSONC settings files) but doesn't describe important behaviors: whether this is read-only (implied but not stated), what happens with no matches, if search is case-sensitive, performance characteristics, or error conditions. For a search tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that clearly states the tool's core function. It's appropriately sized and front-loaded with the essential information - no wasted words or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 2 parameters (100% schema coverage) and no annotations, the description provides basic context about file types and search targets. However, without an output schema, it doesn't describe what results look like (structure, format, pagination). The description is adequate but has clear gaps in behavioral transparency and usage guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters ('query' and 'include'). The description adds minimal value beyond the schema - it implies the query searches 'keys or values' in settings files, but doesn't provide additional syntax, format details, or examples. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: searching configuration and settings files for keys or values, specifying the file formats (JSON/JSONC). It distinguishes from 'searchDocs' by focusing on settings files rather than general documentation, but doesn't explicitly differentiate from 'getConfig' or 'listConfigs' which might also access configuration data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'searchDocs' (for documentation), 'getConfig' (to retrieve specific config), or 'listConfigs' (to enumerate configs). It mentions the tool's scope (settings files) but gives no explicit when/when-not rules or comparison with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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