Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

persistence-disable

Disable file-based persistence in XC-MCP, ensuring in-memory caching only. Optionally clears existing cache data to free disk space or meet privacy or CI/CD requirements. Use for troubleshooting or when persistent state management is unnecessary.

Instructions

🔒 Disable Persistent State Management - Return to in-memory caching only.

Safely disables file-based persistence and optionally clears existing cache data. After disabling, XC-MCP will operate with in-memory caching only, losing state on server restart.

Use this when: • Privacy requirements change • Disk space is limited • Switching to CI/CD mode where persistence isn't needed • Troubleshooting cache-related issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearDataNoWhether to delete existing cached data files when disabling persistence

Implementation Reference

  • The handler function that implements the persistence-disable tool logic. It handles the disable operation, optionally clears data, interacts with persistenceManager, and returns structured JSON response.
    export async function persistenceDisableTool(args: any): Promise<ToolResult> {
      try {
        const { clearData = false } = args as PersistenceDisableArgs;
    
        if (!persistenceManager.isEnabled()) {
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(
                  {
                    success: false,
                    message: 'Persistence is already disabled',
                    clearData: false,
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
    
        // Get storage info before disabling (if data is being cleared)
        const storageInfo = clearData ? await persistenceManager.getStatus(true) : null;
    
        const result = await persistenceManager.disable(clearData);
    
        if (result.success) {
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(
                  {
                    success: true,
                    message: result.message,
                    clearedData: clearData,
                    previousStorageInfo: storageInfo?.storageInfo || null,
                    effect: 'XC-MCP will now operate with in-memory caching only',
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } else {
          throw new McpError(
            ErrorCode.InternalError,
            `Failed to disable persistence: ${result.message}`
          );
        }
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to disable persistence: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Input schema/type definition for the persistence-disable tool arguments.
    interface PersistenceDisableArgs {
      clearData?: boolean;
    }
  • Routing logic in the consolidated 'persistence' tool that delegates to the disable handler when operation='disable'.
    case 'disable':
      return persistenceDisableTool({ clearData: args.clearData ?? false });
    case 'status':
  • Registration of the consolidated 'persistence' tool, which handles 'persistence-disable' functionality via operation='disable'. Backwards compatibility docs reference 'persistence-disable'.
      server.registerTool(
        'persistence',
        {
          description: getDescription(PERSISTENCE_DOCS, PERSISTENCE_DOCS_MINI),
          inputSchema: {
            operation: z.enum(['enable', 'disable', 'status']),
            cacheDir: z.string().optional(),
            clearData: z.boolean().default(false),
            includeStorageInfo: z.boolean().default(true),
          },
          ...DEFER_LOADING_CONFIG,
        },
        async args => {
          try {
            await validateXcodeInstallation();
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            return (await persistenceTool(args)) as any;
          } catch (error) {
            if (error instanceof McpError) throw error;
            throw new McpError(
              ErrorCode.InternalError,
              `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`
            );
          }
        }
      );
    }
  • Documentation string for the persistence-disable tool.
    export const PERSISTENCE_DISABLE_DOCS = `
    # persistence-disable
    
    🔌 **Disable persistent state management and return to in-memory-only caching** - Turn off persistence.
    
    Safely deactivates file-based persistence and optionally deletes existing cache data files. After disabling, XC-MCP operates with in-memory caching only, losing all learned state on server restart. Useful for privacy requirements, disk space constraints, or troubleshooting cache-related issues.
    
    ## Advantages
    
    • Meet privacy requirements that prohibit persistent storage
    • Free up disk space when storage is limited
    • Switch to CI/CD mode where persistence isn't beneficial
    • Troubleshoot issues potentially caused by stale cached data
    
    ## Parameters
    
    ### Required
    - (None)
    
    ### Optional
    - clearData (boolean): Whether to delete existing cache files when disabling. Defaults to false
    
    ## Returns
    
    - Tool execution results with persistence deactivation confirmation
    - Confirmation of whether cache files were cleared
    - Previous storage information (if clearData was true)
    - Operational effect description
    
    ## Related Tools
    
    - persistence-enable: Turn on persistence
    - persistence-status: View persistence system status
    
    ## Notes
    
    - Tool is auto-registered with MCP server
    - Defaults to keeping cache files (just stopping writes)
    - Set clearData: true to delete all cache files
    - Operation is immediate and irreversible
    `;

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/conorluddy/xc-mcp'

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