create_system_json
Create structured JSON files to store searchable data, instructions, and workflows for any domain with organized parameters and tags.
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 |
|---|---|---|---|
| name | Yes | Name for the system JSON file (alphanumeric, underscore, hyphen only) | |
| domain | Yes | Domain or category for the data | |
| description | Yes | Description of what this system JSON contains | |
| data | Yes | The structured data to store | |
| tags | No | Optional array of tags for searchability |
Implementation Reference
- src/index.ts:113-169 (handler)Core handler function in SystemJSON class that validates the name, checks for existing files, generates searchable content, and performs atomic file write to create 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:1004-1040 (handler)Wrapper handler in AdvancedReasoningServer that delegates to SystemJSON.createSystemJSON and formats the MCP tool 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:1307-1330 (schema)Schema and metadata definition for the create_system_json tool, including input validation schema.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:1394-1407 (registration)Registration of create_system_json tool (as CREATE_SYSTEM_JSON_TOOL) in the list of available tools for ListToolsRequest.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 ], }));
- src/index.ts:1434-1442 (registration)Tool call dispatcher in CallToolRequestSchema handler that routes calls to the createSystemJSON 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);