Skip to main content
Glama

export_databricks_bundle

Destructive

Export ThumbGate logs and proof artifacts as a Databricks-ready analytics bundle.

Instructions

Export ThumbGate logs and proof artifacts as a Databricks-ready analytics bundle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputPathNo

Implementation Reference

  • Main handler function that exports ThumbGate feedback data (feedback events, memory records, sequences, attributions, and proof reports) into a Databricks-compatible analytics bundle. Reads JSONL data from feedback directories, annotates rows with bundle metadata, writes table JSONL files, generates a manifest.json, and builds a SQL template for loading into Databricks.
    function exportDatabricksBundle(feedbackDir = getDefaultFeedbackDir(), outputPath, options = {}) {
      const resolvedFeedbackDir = path.resolve(feedbackDir || getDefaultFeedbackDir());
      const resolvedProofDir = path.resolve(options.proofDir || DEFAULT_PROOF_DIR);
      const exportedAt = new Date().toISOString();
      const bundlePath = path.resolve(outputPath || path.join(
        resolvedFeedbackDir,
        'analytics',
        `databricks-${timestampSlug()}`
      ));
      const tablesDir = path.join(bundlePath, 'tables');
      ensureDir(tablesDir);
    
      const datasets = [
        {
          tableName: 'feedback_events',
          sourcePath: path.join(resolvedFeedbackDir, 'feedback-log.jsonl'),
          description: 'Raw ThumbGate feedback events from feedback-log.jsonl',
        },
        {
          tableName: 'memory_records',
          sourcePath: path.join(resolvedFeedbackDir, 'memory-log.jsonl'),
          description: 'Promoted learning and mistake memories from memory-log.jsonl',
        },
        {
          tableName: 'feedback_sequences',
          sourcePath: path.join(resolvedFeedbackDir, 'feedback-sequences.jsonl'),
          description: 'Sequence-model training rows derived from accepted feedback',
        },
        {
          tableName: 'feedback_attributions',
          sourcePath: path.join(resolvedFeedbackDir, 'attributed-feedback.jsonl'),
          description: 'Tool-call attribution rows for negative feedback events',
        },
      ];
    
      const tables = datasets.map((dataset) => {
        const rows = annotateRows(
          readJSONL(dataset.sourcePath),
          dataset.tableName,
          path.basename(dataset.sourcePath),
          exportedAt,
        );
        const fileName = `${dataset.tableName}.jsonl`;
        const relativePath = toBundleRelativePath('tables', fileName);
        writeJSONL(path.join(tablesDir, fileName), rows);
        return {
          tableName: dataset.tableName,
          relativePath,
          rowCount: rows.length,
          description: dataset.description,
        };
      });
    
      const proofRows = collectProofReports(resolvedProofDir, exportedAt);
      const proofRelativePath = toBundleRelativePath('tables', 'proof_reports.jsonl');
      writeJSONL(path.join(tablesDir, 'proof_reports.jsonl'), proofRows);
      tables.push({
        tableName: 'proof_reports',
        relativePath: proofRelativePath,
        rowCount: proofRows.length,
        description: 'Machine-readable proof artifacts discovered under proof/**/*.json',
      });
    
      const manifest = {
        format: 'databricks-analytics-bundle',
        version: 1,
        exportedAt,
        bundlePath,
        feedbackDir: resolvedFeedbackDir,
        proofDir: resolvedProofDir,
        placeholders: {
          catalog: '__CATALOG__',
          schema: '__SCHEMA__',
          bundleRoot: '__BUNDLE_ROOT__',
        },
        tables,
      };
    
      const manifestPath = path.join(bundlePath, 'manifest.json');
      const sqlTemplatePath = path.join(bundlePath, 'load_databricks.sql');
      fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
      fs.writeFileSync(sqlTemplatePath, buildSqlTemplate(manifest) + '\n');
    
      return {
        bundlePath,
        manifestPath,
        sqlTemplatePath,
        tableCount: tables.length,
        totalRows: tables.reduce((sum, table) => sum + table.rowCount, 0),
        tables,
      };
    }
  • Builds a SQL bootstrap template with CREATE TABLE statements using read_files() for each table in the manifest, with placeholders for catalog, schema, and bundle root.
    function buildSqlTemplate(manifest) {
      const lines = [
        '-- Databricks bootstrap for the exported analytics bundle.',
        '-- Replace __CATALOG__, __SCHEMA__, and __BUNDLE_ROOT__ before running.',
        '',
        'CREATE SCHEMA IF NOT EXISTS __CATALOG__.__SCHEMA__;',
        '',
      ];
    
      for (const table of manifest.tables) {
        lines.push(`CREATE OR REPLACE TABLE __CATALOG__.__SCHEMA__.${table.tableName} AS`);
        lines.push('SELECT *, _metadata.file_path AS source_file');
        lines.push(`FROM read_files('__BUNDLE_ROOT__/${normalizeBundleRelativePath(table.relativePath)}', format => 'json');`);
        lines.push('');
      }
    
      return lines.join('\n');
    }
  • Collects proof reports by recursively walking JSON files under the proof directory and annotating them with bundle metadata.
    function collectProofReports(proofDir, exportedAt) {
      return walkJsonFiles(proofDir)
        .map((filePath, index) => ({
          bundleDataset: 'proof_reports',
          bundleRowNumber: index + 1,
          bundleExportedAt: exportedAt,
          reportId: path.basename(filePath, '.json'),
          reportCategory: path.basename(path.dirname(filePath)),
          reportPath: normalizeBundleRelativePath(path.relative(proofDir, filePath)),
          report: readJSON(filePath),
        }))
        .filter((row) => row.report);
    }
  • MCP tool registration case for 'export_databricks_bundle'. Calls exportDatabricksBundle with an optional outputPath, enforcing the 'export_databricks' rate limit.
    case 'export_databricks_bundle': {
      enforceLimit('export_databricks');
      const outputPath = args.outputPath ? resolveSafePath(args.outputPath) : undefined;
      return toTextResult(exportDatabricksBundle(undefined, outputPath));
    }
  • Registration of 'export_databricks_bundle' in the WRITE_CAPABLE_TOOLS set, marking it as a write-capable tool for agent readiness/permission tiering.
    const WRITE_CAPABLE_TOOLS = new Set([
      'capture_feedback',
      'bootstrap_internal_agent',
      'prevention_rules',
      'export_dpo_pairs',
      'export_databricks_bundle',
      'construct_context_pack',
      'evaluate_context_pack',
      'generate_skill',
      'satisfy_gate',
      'set_task_scope',
      'approve_protected_action',
      'track_action',
      'register_claim_gate',
      'run_autoresearch',
    ]);
Behavior2/5

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

The annotations indicate destructiveHint: true, but the description does not elaborate on what is destroyed (e.g., logs after export, or temporary files). It does not add behavioral context beyond the annotation.

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

Conciseness3/5

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

The description is a single, focused sentence. However, it omits essential details (usage, parameters), making it under-specified despite its brevity.

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

Completeness2/5

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

The tool has no output schema and one parameter. The description does not explain return values, side effects, or the exact nature of the exported bundle, leaving significant gaps for an agent to use the tool effectively.

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

Parameters1/5

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

The sole parameter 'outputPath' has no description in the schema (0% coverage). The description does not mention the parameter or its purpose, leaving the agent to guess its meaning.

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

Purpose5/5

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

The description clearly states the action ('Export'), the resource ('ThumbGate logs and proof artifacts'), and the output format ('Databricks-ready analytics bundle'). It distinguishes itself from sibling export tools by specifying the source and format.

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?

No guidance on when to use this tool versus alternatives like export_dpo_pairs or export_hf_dataset. No prerequisites or context for usage are provided.

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/IgorGanapolsky/ThumbGate'

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