Skip to content

fix: store hook_event, tool_use_id, and tool_input as indexed columns instead of JSON blobs #37

@tumberger

Description

@tumberger

Problem

Several high-value fields are buried inside request_json JSON blobs in the mcp_events table instead of being stored as first-class indexed columns:

Field Current storage Impact
hook_event Inside request_json.hookEvent Cannot efficiently query "all PreToolUse events" without JSON path scan
tool_use_id Inside request_json.toolUseId Cannot efficiently correlate Pre/Post events without JSON extraction
tool_input Inside request_json.toolInput Cannot index or filter by input properties

Meanwhile tool_name and response_json are already proper columns.

Fix

This is an API/DB concern, not a CLI concern. The API handler should extract these fields from the proto message and store them in dedicated columns:

  1. Add hook_event column to mcp_events (or use the existing event_type column more precisely)
  2. Add tool_use_id column to mcp_events
  3. Consider promoting tool_input to its own JSON column (parallel to response_json)

Requires a DB migration.

Note

This issue is tracked here for visibility but the fix lives in the API repo, not the CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions