Skip to main content
Glama
angrysky56

Advanced Reasoning MCP Server

search_system_json

Search system JSON files by query to find matching documents with relevance scores for enhanced reasoning workflows.

Instructions

Search through system JSON files by query.

Parameters:

  • query: Search query to find matching system JSON files (required)

Returns matching files with relevance scores.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find matching system JSON files

Implementation Reference

  • Core implementation of searchSystemJSON in SystemJSON class: reads all .json files in system_json directory, parses content, calculates relevance score based on query matching searchable_content, filters scores >0.1, sorts by score descending.
    async searchSystemJSON(query: string): Promise<{ results: Array<{ name: string; score: number; data: SystemJSONData }> }> {
      try {
        const files = await fs.readdir(this.systemJsonPath);
        const results: Array<{ name: string; score: number; data: SystemJSONData }> = [];
    
        for (const file of files) {
          if (file.endsWith('.json') && !file.endsWith('.tmp')) {
            try {
              const filePath = path.join(this.systemJsonPath, file);
              const jsonContent = await fs.readFile(filePath, 'utf-8');
              const data = JSON.parse(jsonContent) as SystemJSONData;
    
              const score = this.calculateSearchScore(query, data);
              if (score > 0.1) {
                results.push({ name: data.name, score, data });
              }
            } catch (error) {
              // Skip corrupted files
              console.error(`Skipping corrupted system JSON file: ${file}`, error);
            }
          }
        }
    
        return { results: results.sort((a, b) => b.score - a.score) };
      } catch (error) {
        console.error('Failed to search system JSON:', error);
        return { results: [] };
      }
    }
  • Wrapper handler in AdvancedReasoningServer that invokes core SystemJSON.searchSystemJSON and formats the results into MCP-compatible response content (JSON string with summarized results).
    public async searchSystemJSON(query: string): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      try {
        const result = await this.systemJson.searchSystemJSON(query);
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              query,
              results: result.results.map(r => ({
                name: r.name,
                score: r.score,
                domain: r.data.domain,
                description: r.data.description,
                tags: r.data.tags
              })),
              totalResults: result.results.length
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: error instanceof Error ? error.message : String(error),
              status: 'failed'
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • MCP server dispatch handler for 'search_system_json' tool: extracts 'query' from arguments and delegates to reasoningServer.searchSystemJSON.
    case "search_system_json":
      const { query: searchQuery } = args as { query: string };
      return await reasoningServer.searchSystemJSON(searchQuery);
  • src/index.ts:1349-1364 (registration)
    Tool registration object defining name, description, and inputSchema for 'search_system_json', which is included in the server's tools list.
    const SEARCH_SYSTEM_JSON_TOOL: Tool = {
      name: "search_system_json",
      description: `Search through system JSON files by query.
    
    Parameters:
    - query: Search query to find matching system JSON files (required)
    
    Returns matching files with relevance scores.`,
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string", description: "Search query to find matching system JSON files" }
        },
        required: ["query"]
      }
    };
  • Input schema specifying the required 'query' string parameter for the search_system_json tool.
    inputSchema: {
      type: "object",
      properties: {
        query: { type: "string", description: "Search query to find matching system JSON files" }
      },
      required: ["query"]
    }

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/angrysky56/advanced-reasoning-mcp'

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