create_system_json
Generate a structured system JSON file to store and organize searchable data, instructions, or workflows for any domain. Includes name, domain, description, data, and optional tags for clarity and searchability.
Instructions
Create a new system JSON file for storing coherent detailed searchable data or instructions and workflows for any domain or action.
Parameters:
name: Name for the system JSON file (required) - alphanumeric, underscore, hyphen only
domain: Domain or category for the data (required)
description: Description of what this system JSON contains (required)
data: The structured data to store (required) - can be any JSON-serializable object
tags: Optional array of tags for searchability
Returns success status and confirmation message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | The structured data to store | |
| description | Yes | Description of what this system JSON contains | |
| domain | Yes | Domain or category for the data | |
| name | Yes | Name for the system JSON file (alphanumeric, underscore, hyphen only) | |
| tags | No | Optional array of tags for searchability |
Implementation Reference
- src/index.ts:102-158 (handler)Core implementation in SystemJSON class that validates inputs, creates searchable content, performs atomic file write for the system JSON file.async createSystemJSON( name: string, domain: string, description: string, data: Record<string, unknown>, tags: string[] = [] ): Promise<{ success: boolean; message: string }> { try { // Validate name (alphanumeric, underscore, hyphen only) if (!/^[a-zA-Z0-9_-]+$/.test(name)) { return { success: false, message: 'Name must contain only letters, numbers, underscores, and hyphens' }; } const fileName = `${name}.json`; const filePath = path.join(this.systemJsonPath, fileName); // Check if file already exists try { await fs.access(filePath); return { success: false, message: `System JSON "${name}" already exists` }; } catch { // File doesn't exist, which is what we want } // Create searchable content from data const searchable_content = this.createSearchableContent(data, description, tags); const systemData: SystemJSONData = { name, domain, description, data, searchable_content, tags, created: Date.now(), modified: Date.now() }; // Atomic write const tempPath = path.join(this.systemJsonPath, `${fileName}.tmp`); const jsonContent = JSON.stringify(systemData, null, 2); await fs.writeFile(tempPath, jsonContent, 'utf-8'); // Validate JSON before committing try { JSON.parse(jsonContent); await fs.rename(tempPath, filePath); } catch (parseError) { await fs.unlink(tempPath).catch(() => {}); throw new Error(`JSON validation failed: ${parseError}`); } return { success: true, message: `Created system JSON: ${name}` }; } catch (error) { return { success: false, message: `Failed to create system JSON: ${error}` }; } }
- src/index.ts:912-949 (handler)Wrapper method in AdvancedReasoningServer that calls the core SystemJSON.createSystemJSON and formats the MCP-compliant response.public async createSystemJSON( name: string, domain: string, description: string, data: Record<string, unknown>, tags: string[] = [] ): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> { try { const result = await this.systemJson.createSystemJSON(name, domain, description, data, tags); return { content: [{ type: "text", text: JSON.stringify({ name, domain, description, success: result.success, message: result.message, tags, created: Date.now() }, null, 2) }], isError: !result.success }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), status: 'failed' }, null, 2) }], isError: true }; } }
- src/index.ts:1342-1350 (handler)Dispatch logic in the MCP CallToolRequestSchema handler switch statement that routes tool calls to the reasoningServer method.case "create_system_json": const { name: sysJsonName, domain, description, data, tags } = args as { name: string; domain: string; description: string; data: Record<string, unknown>; tags?: string[] }; return await reasoningServer.createSystemJSON(sysJsonName, domain, description, data, tags);
- src/index.ts:1215-1238 (schema)MCP Tool definition including name, description, and input schema validation.const CREATE_SYSTEM_JSON_TOOL: Tool = { name: "create_system_json", description: `Create a new system JSON file for storing coherent detailed searchable data or instructions and workflows for any domain or action. Parameters: - name: Name for the system JSON file (required) - alphanumeric, underscore, hyphen only - domain: Domain or category for the data (required) - description: Description of what this system JSON contains (required) - data: The structured data to store (required) - can be any JSON-serializable object - tags: Optional array of tags for searchability Returns success status and confirmation message.`, inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the system JSON file (alphanumeric, underscore, hyphen only)" }, domain: { type: "string", description: "Domain or category for the data" }, description: { type: "string", description: "Description of what this system JSON contains" }, data: { type: "object", description: "The structured data to store" }, tags: { type: "array", items: { type: "string" }, description: "Optional array of tags for searchability" } }, required: ["name", "domain", "description", "data"] } };
- src/index.ts:1302-1315 (registration)Registration of the create_system_json tool (via CREATE_SYSTEM_JSON_TOOL) in the ListToolsRequestSchema handler, making it discoverable by MCP clients.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ ADVANCED_REASONING_TOOL, QUERY_MEMORY_TOOL, CREATE_LIBRARY_TOOL, LIST_LIBRARIES_TOOL, SWITCH_LIBRARY_TOOL, GET_LIBRARY_INFO_TOOL, CREATE_SYSTEM_JSON_TOOL, GET_SYSTEM_JSON_TOOL, SEARCH_SYSTEM_JSON_TOOL, LIST_SYSTEM_JSON_TOOL ], }));