Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(error-tracking): expose symbol set MCP tools (#57379)

Catalin Irimiea70f94dcb522
diff --git a/frontend/src/lib/components/Errors/types.ts b/frontend/src/lib/components/Errors/types.ts
index 0cf3d2fbf26f..681ae19544d3 100644
--- a/frontend/src/lib/components/Errors/types.ts
+++ b/frontend/src/lib/components/Errors/types.ts
@@ -89,8 +89,8 @@ export interface ErrorTrackingSymbolSet {
team_id: number
last_used: string
created_at: string
- storage_ptr: string | null
failure_reason: string | null
+ has_uploaded_file: boolean
release: ErrorTrackingRelease | null
}
diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.py
index 9e909edd1289..2414a75b41d4 100644
--- a/posthog/hogql/database/schema/system.py
+++ b/posthog/hogql/database/schema/system.py
@@ -768,6 +768,21 @@ error_tracking_releases: PostgresTable = PostgresTable(
},
)
+error_tracking_symbol_sets: PostgresTable = PostgresTable(
+ name="error_tracking_symbol_sets",
+ postgres_table_name="posthog_errortrackingsymbolset",
+ access_scope="error_tracking",
+ fields={
+ "id": StringDatabaseField(name="id"),
+ "team_id": IntegerDatabaseField(name="team_id"),
+ "ref": StringDatabaseField(name="ref"),
+ "release_id": StringDatabaseField(name="release_id", nullable=True),
+ "created_at": DateTimeDatabaseField(name="created_at"),
+ "last_used": DateTimeDatabaseField(name="last_used", nullable=True),
+ "failure_reason": StringDatabaseField(name="failure_reason", nullable=True),
+ },
+)
+
logs_views: PostgresTable = PostgresTable(
name="logs_views",
postgres_table_name="logs_logsview",
@@ -1077,6 +1092,7 @@ class SystemTables(TableNode):
),
"error_tracking_issues": TableNode(name="error_tracking_issues", table=error_tracking_issues),
"error_tracking_releases": TableNode(name="error_tracking_releases", table=error_tracking_releases),
+ "error_tracking_symbol_sets": TableNode(name="error_tracking_symbol_sets", table=error_tracking_symbol_sets),
"error_tracking_suppression_rules": TableNode(
name="error_tracking_suppression_rules", table=error_tracking_suppression_rules
),
diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.py
index 2b275e7ee628..6848d6c617c3 100644
--- a/posthog/hogql/database/schema/test/test_system_tables.py
+++ b/posthog/hogql/database/schema/test/test_system_tables.py
@@ -4,6 +4,7 @@ from parameterized import parameterized
from posthog.hogql.context import HogQLContext
from posthog.hogql.database.database import Database
+from posthog.hogql.database.models import Table
from posthog.hogql.database.schema.system import SystemTables
from posthog.hogql.parser import parse_select
from posthog.hogql.printer import prepare_and_print_ast
@@ -40,7 +41,7 @@ from products.data_warehouse.backend.models.external_data_source import External
from products.data_warehouse.backend.models.table import DataWarehouseTable as DataWarehouseTableModel
from products.early_access_features.backend.models import EarlyAccessFeature
from products.endpoints.backend.models import Endpoint, EndpointVersion
-from products.error_tracking.backend.models import ErrorTrackingIssue
+from products.error_tracking.backend.models import ErrorTrackingIssue, ErrorTrackingSymbolSet
from products.experiments.backend.models.experiment import Experiment
from products.llm_analytics.backend.models.review_queues import ReviewQueue, ReviewQueueItem
from products.llm_analytics.backend.models.score_definitions import ScoreDefinition
@@ -92,6 +93,13 @@ class TestSystemTablesTeamScoping(BaseTest):
f"or add to excluded_tables with a reason."
)
+ def test_error_tracking_symbol_sets_does_not_expose_storage_internals(self):
+ table = SystemTables().children["error_tracking_symbol_sets"].get()
+ assert isinstance(table, Table)
+
+ assert "storage_ptr" not in table.fields
+ assert "content_hash" not in table.fields
+
def _create_batch_export(team: Team, label: str):
from posthog.batch_exports.models import BatchExport, BatchExportDestination
@@ -275,6 +283,12 @@ def _create_error_tracking_release(team: Team, label: str):
)
+def _create_error_tracking_symbol_set(team: Team, label: str) -> ErrorTrackingSymbolSet:
+ return ErrorTrackingSymbolSet.objects.create(
+ team=team, ref=f"symbol_set_{label}", storage_ptr=f"symbolsets/{label}"
+ )
+
+
def _create_hog_flow(team: Team, label: str) -> HogFlow:
return HogFlow.objects.create(team=team, name=f"flow_{label}")
@@ -503,6 +517,7 @@ SYSTEM_TABLE_FACTORIES = [
("source_sync_jobs", _create_source_sync_job),
("error_tracking_issues", _create_error_tracking_issue),
("error_tracking_releases", _create_error_tracking_release),
+ ("error_tracking_symbol_sets", _create_error_tracking_symbol_set),
("error_tracking_suppression_rules", _create_error_tracking_suppression_rule),
("experiments", _create_experiment),
("exports", _create_export),
diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambr
index f4d43352458e..471c3e836f8a 100644
--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr
+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr
@@ -4206,6 +4206,74 @@
"row_count": null,
"type": "system"
},
+ "system.error_tracking_symbol_sets": {
+ "fields": {
+ "id": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "id",
+ "id": null,
+ "name": "id",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "ref": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "ref",
+ "id": null,
+ "name": "ref",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "release_id": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "release_id",
+ "id": null,
+ "name": "release_id",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "created_at": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "created_at",
+ "id": null,
+ "name": "created_at",
+ "schema_valid": true,
+ "table": null,
+ "type": "datetime"
+ },
+ "last_used": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "last_used",
+ "id": null,
+ "name": "last_used",
+ "schema_valid": true,
+ "table": null,
+ "type": "datetime"
+ },
+ "failure_reason": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "failure_reason",
+ "id": null,
+ "name": "failure_reason",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ }
+ },
+ "id": "system.error_tracking_symbol_sets",
+ "name": "system.error_tracking_symbol_sets",
+ "row_count": null,
+ "type": "system"
+ },
"system.error_tracking_suppression_rules": {
"fields": {
"id": {
@@ -11322,6 +11390,74 @@
"row_count": null,
"type": "system"
},
+ "system.error_tracking_symbol_sets": {
+ "fields": {
+ "id": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "id",
+ "id": null,
+ "name": "id",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "ref": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "ref",
+ "id": null,
+ "name": "ref",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "release_id": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "release_id",
+ "id": null,
+ "name": "release_id",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
+ "created_at": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "created_at",
+ "id": null,
+ "name": "created_at",
+ "schema_valid": true,
+ "table": null,
+ "type": "datetime"
+ },
+ "last_used": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "last_used",
+ "id": null,
+ "name": "last_used",
+ "schema_valid": true,
+ "table": null,
+ "type": "datetime"
+ },
+ "failure_reason": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "failure_reason",
+ "id": null,
+ "name": "failure_reason",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ }
+ },
+ "id": "system.error_tracking_symbol_sets",
+ "name": "system.error_tracking_symbol_sets",
+ "row_count": null,
+ "type": "system"
+ },
"system.error_tracking_suppression_rules": {
"fields": {
"id": {
diff --git a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr
index aa8c03c2ea57..4b59eafdfff8 100644
--- a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr
+++ b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr
@@ -110,7 +110,7 @@
This is a list of all the available tables in the database:
```
- ['events', 'groups', 'persons', 'sessions', 'logs', 'query_log', 'system.activity_logs', 'system.actions', 'system.alerts', 'system.annotations', 'system.batch_export_backfills', 'system.batch_exports', 'system.cohort_calculation_history', 'system.cohorts', 'system.dashboards', 'system.data_modeling_jobs', 'system.data_modeling_views', 'system.data_modeling_endpoint_versions', 'system.data_modeling_endpoints', 'system.data_warehouse_sources', 'system.data_warehouse_tables', 'system.error_tracking_assignment_rules', 'system.error_tracking_issue_assignments', 'system.error_tracking_issue_fingerprints', 'system.error_tracking_issues', 'system.error_tracking_releases', 'system.error_tracking_suppression_rules', 'system.early_access_features', 'system.experiments', 'system.exports', 'system.feature_flags', 'system.groups', 'system.group_type_mappings', 'system.hog_flows', 'system.hog_functions', 'system.ingestion_warnings', 'system.integrations', 'system.integration_repository_cache', 'system.insight_variables', 'system.logs_alerts', 'system.logs_views', 'system.insights', 'system.notebooks', 'system.sandbox_environments', 'system.review_queue_items', 'system.review_queues', 'system.session_recording_playlists', 'system.session_recordings', 'system.source_schemas', 'system.source_sync_jobs', 'system.support_tickets', 'system.surveys', 'system.task_runs', 'system.tasks', 'system.teams', 'system.trace_review_scores', 'system.trace_reviews', 'system.usage_metrics']
+ ['events', 'groups', 'persons', 'sessions', 'logs', 'query_log', 'system.activity_logs', 'system.actions', 'system.alerts', 'system.annotations', 'system.batch_export_backfills', 'system.batch_exports', 'system.cohort_calculation_history', 'system.cohorts', 'system.dashboards', 'system.data_modeling_jobs', 'system.data_modeling_views', 'system.data_modeling_endpoint_versions', 'system.data_modeling_endpoints', 'system.data_warehouse_sources', 'system.data_warehouse_tables', 'system.error_tracking_assignment_rules', 'system.error_tracking_issue_assignments', 'system.error_tracking_issue_fingerprints', 'system.error_tracking_issues', 'system.error_tracking_releases', 'system.error_tracking_symbol_sets', 'system.error_tracking_suppression_rules', 'system.early_access_features', 'system.experiments', 'system.exports', 'system.feature_flags', 'system.groups', 'system.group_type_mappings', 'system.hog_flows', 'system.hog_functions', 'system.ingestion_warnings', 'system.integrations', 'system.integration_repository_cache', 'system.insight_variables', 'system.logs_alerts', 'system.logs_views', 'system.insights', 'system.notebooks', 'system.sandbox_environments', 'system.review_queue_items', 'system.review_queues', 'system.session_recording_playlists', 'system.session_recordings', 'system.source_schemas', 'system.source_sync_jobs', 'system.support_tickets', 'system.surveys', 'system.task_runs', 'system.tasks', 'system.teams', 'system.trace_review_scores', 'system.trace_reviews', 'system.usage_metrics']
```
`person` or `event` metadata unspecified above (emails, names, etc.) is stored in `properties` fields, accessed like: `properties.foo.bar`.
diff --git a/products/error_tracking/backend/api/symbol_sets.py b/products/error_tracking/backend/api/symbol_sets.py
index f057bbcffbaa..e7bb778936dc 100644
--- a/products/error_tracking/backend/api/symbol_sets.py
+++ b/products/error_tracking/backend/api/symbol_sets.py
@@ -8,9 +8,10 @@ from django.utils import timezone
import structlog
import posthoganalytics
from drf_spectacular.utils import extend_schema, extend_schema_field
-from rest_framework import serializers, status, viewsets
+from rest_framework import pagination, serializers, status, viewsets
from rest_framework.exceptions import ValidationError
from rest_framework.parsers import FileUploadParser, JSONParser, MultiPartParser
+from rest_framework.request import Request
from rest_framework.response import Response
from posthog.schema import ProductKey
@@ -35,12 +36,56 @@ PRESIGNED_MULTIPLE_UPLOAD_TIMEOUT = 60 * 5
class ErrorTrackingSymbolSetSerializer(serializers.ModelSerializer):
- release = serializers.SerializerMethodField()
+ id = serializers.UUIDField(read_only=True, help_text="Unique symbol set ID.")
+ ref = serializers.CharField(read_only=True, help_text="Reference used to match stack frames to this symbol set.")
+ team_id = serializers.IntegerField(read_only=True, help_text="Project/team ID that owns this symbol set.")
+ created_at = serializers.DateTimeField(read_only=True, help_text="When this symbol set row was created.")
+ last_used = serializers.DateTimeField(
+ read_only=True,
+ allow_null=True,
+ help_text="When this symbol set was last used to resolve a stack frame.",
+ )
+ failure_reason = serializers.CharField(
+ read_only=True,
+ allow_blank=True,
+ allow_null=True,
+ help_text="Reason symbol lookup failed, if the source map is missing or invalid.",
+ )
+ has_uploaded_file = serializers.SerializerMethodField(
+ help_text="Whether this symbol set has an uploaded source map file available to download."
+ )
+ release = serializers.SerializerMethodField(help_text="Release associated with this symbol set, if any.")
class Meta:
model = ErrorTrackingSymbolSet
- fields = ["id", "ref", "team_id", "created_at", "last_used", "storage_ptr", "failure_reason", "release"]
- read_only_fields = ["team_id"]
+ fields = [
+ "id",
+ "ref",
+ "team_id",
+ "created_at",
+ "last_used",
+ "failure_reason",
+ "has_uploaded_file",
+ "release",
+ ]
+ read_only_fields = [
+ "id",
+ "ref",
+ "team_id",
+ "created_at",
+ "last_used",
+ "failure_reason",
+ "has_uploaded_file",
+ "release",
+ ]
+
+ @extend_schema_field(
+ serializers.BooleanField(
+ help_text="Whether this symbol set has an uploaded source map file available to download."
+ )
+ )
+ def get_has_uploaded_file(self, obj: ErrorTrackingSymbolSet) -> bool:
+ return bool(obj.storage_ptr)
@extend_schema_field(serializers.DictField(allow_null=True, help_text="Release associated with this symbol set"))
def get_release(self, obj):
@@ -59,13 +104,87 @@ class SymbolSetUpload:
class ErrorTrackingSymbolSetUploadSerializer(serializers.Serializer):
- chunk_id = serializers.CharField()
- release_id = serializers.CharField(allow_null=True, default=None)
- content_hash = serializers.CharField(allow_null=True, default=None)
+ chunk_id = serializers.CharField(help_text="Symbol set reference to upload.")
+ release_id = serializers.CharField(
+ allow_null=True,
+ default=None,
+ help_text="Optional error tracking release ID associated with this symbol set.",
+ )
+ content_hash = serializers.CharField(
+ allow_null=True,
+ default=None,
+ help_text="Optional hash of the symbol set content, used to skip unchanged uploads.",
+ )
+
+
+class ErrorTrackingSymbolSetFinishUploadSerializer(serializers.Serializer):
+ content_hash = serializers.CharField(help_text="Hash of the uploaded symbol set content.")
+
+
+class ErrorTrackingSymbolSetBulkDeleteSerializer(serializers.Serializer):
+ ids = serializers.ListField(
+ child=serializers.UUIDField(),
+ help_text="Symbol set IDs to delete.",
+ )
+
+
+class ErrorTrackingSymbolSetBulkStartUploadSerializer(serializers.Serializer):
+ chunk_ids = serializers.ListField(
+ child=serializers.CharField(),
+ required=False,
+ help_text="Legacy list of symbol set references to upload, all associated with `release_id`.",
+ )
+ release_id = serializers.CharField(
+ required=False,
+ allow_null=True,
+ default=None,
+ help_text="Optional error tracking release ID used with `chunk_ids`.",
+ )
+ symbol_sets = ErrorTrackingSymbolSetUploadSerializer(
+ many=True,
+ required=False,
+ help_text="Symbol sets to upload with per-symbol release IDs and content hashes.",
+ )
+ force = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text="Whether to overwrite uploaded symbol sets whose content hash changed.",
+ )
+
+
+class ErrorTrackingSymbolSetBulkFinishUploadSerializer(serializers.Serializer):
+ content_hashes = serializers.DictField(
+ child=serializers.CharField(),
+ help_text="Map of symbol set ID to uploaded content hash.",
+ )
+
+
+class ErrorTrackingSymbolSetListQuerySerializer(serializers.Serializer):
+ ref = serializers.CharField(
+ required=False,
+ help_text="Exact symbol set reference to filter by.",
+ )
+ status = serializers.ChoiceField(
+ required=False,
+ default="all",
+ choices=["all", "valid", "invalid"],
+ help_text="Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.",
+ )
+ order_by = serializers.ChoiceField(
+ required=False,
+ choices=["created_at", "-created_at", "ref", "-ref", "last_used", "-last_used"],
+ help_text="Sort order for symbol sets. Prefix with `-` for descending order.",
+ )
class _SymbolSetDownloadResponseSerializer(serializers.Serializer):
- url = serializers.URLField(help_text="Presigned URL to download the source map file")
+ url = serializers.URLField(
+ help_text="Presigned URL to download the source map file. Use immediately; expires after one hour."
+ )
+
+
+class ErrorTrackingSymbolSetPagination(pagination.LimitOffsetPagination):
+ max_limit = 100
@extend_schema(tags=[ProductKey.ERROR_TRACKING])
@@ -73,6 +192,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
scope_object = "error_tracking"
queryset = ErrorTrackingSymbolSet.objects.all()
serializer_class = ErrorTrackingSymbolSetSerializer
+ pagination_class = ErrorTrackingSymbolSetPagination
parser_classes = [MultiPartParser, FileUploadParser]
throttle_classes = [SymbolSetUploadBurstRateThrottle, SymbolSetUploadSustainedRateThrottle]
scope_object_read_actions = ["list", "retrieve", "download"]
@@ -86,25 +206,31 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
"create",
]
+ def _get_list_params(self, request: Request) -> dict[str, str]:
+ serializer = ErrorTrackingSymbolSetListQuerySerializer(data=request.query_params)
+ serializer.is_valid(raise_exception=True)
+ return dict(serializer.validated_data)
+
def safely_get_queryset(self, queryset):
queryset = queryset.filter(team_id=self.team.id).select_related("release")
- params = self.request.GET.dict()
+ if self.action != "list":
+ return queryset
+
+ params = self._get_list_params(self.request)
ref = params.get("ref")
- status = params.get("status")
+ symbol_set_status = params.get("status")
order_by = params.get("order_by")
if ref:
queryset = queryset.filter(ref=ref)
- if status == "valid":
+ if symbol_set_status == "valid":
queryset = queryset.filter(storage_ptr__isnull=False)
- elif status == "invalid":
+ elif symbol_set_status == "invalid":
queryset = queryset.filter(storage_ptr__isnull=True)
if order_by:
- allowed_fields = ["created_at", "-created_at", "ref", "-ref", "last_used", "-last_used"]
- if order_by in allowed_fields:
- queryset = queryset.order_by(order_by)
+ queryset = queryset.order_by(order_by)
return queryset
@@ -113,6 +239,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
symbol_set.delete()
return Response(status=status.HTTP_204_NO_CONTENT)
+ @extend_schema(request=ErrorTrackingSymbolSetBulkDeleteSerializer)
@action(methods=["POST"], detail=False, parser_classes=[JSONParser])
def bulk_delete(self, request, **kwargs):
ids = request.data.get("ids", [])
@@ -128,7 +255,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
responses={200: _SymbolSetDownloadResponseSerializer},
)
@action(methods=["GET"], detail=True, parser_classes=[JSONParser])
- def download(self, request, **kwargs) -> Response:
+ def download(self, request: Request, **kwargs) -> Response:
"""Return a presigned URL for downloading the symbol set's source map."""
return self._download_symbol_set(self.get_object())
@@ -152,7 +279,8 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
return Response({"url": presigned_url}, status=status.HTTP_200_OK)
- def list(self, request, *args, **kwargs) -> Response:
+ @extend_schema(parameters=[ErrorTrackingSymbolSetListQuerySerializer])
+ def list(self, request: Request, *args, **kwargs) -> Response:
queryset = self.filter_queryset(self.get_queryset())
page = self.paginate_queryset(queryset)
if page is not None:
@@ -226,6 +354,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
{"presigned_url": presigned_url, "symbol_set_id": str(symbol_set.pk)}, status=status.HTTP_201_CREATED
)
+ @extend_schema(request=ErrorTrackingSymbolSetFinishUploadSerializer)
@action(methods=["PUT"], detail=True, parser_classes=[JSONParser])
def finish_upload(self, request, **kwargs):
content_hash = request.data.get("content_hash")
@@ -268,6 +397,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
return Response({"success": True}, status=status.HTTP_200_OK)
+ @extend_schema(request=ErrorTrackingSymbolSetBulkStartUploadSerializer)
@action(methods=["POST"], detail=False, parser_classes=[JSONParser])
def bulk_start_upload(self, request, **kwargs):
if request.user.pk:
@@ -309,6 +439,7 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSe
)
return Response({"id_map": chunk_id_url_map}, status=status.HTTP_201_CREATED)
+ @extend_schema(request=ErrorTrackingSymbolSetBulkFinishUploadSerializer)
@action(methods=["POST"], detail=False, parser_classes=[JSONParser])
def bulk_finish_upload(self, request, **kwargs):
if request.user.pk:
diff --git a/products/error_tracking/backend/api/test/test_error_tracking_api.py b/products/error_tracking/backend/api/test/test_error_tracking_api.py
index 255c1ae0136f..6e8871e2eaa7 100644
--- a/products/error_tracking/backend/api/test/test_error_tracking_api.py
+++ b/products/error_tracking/backend/api/test/test_error_tracking_api.py
@@ -2,7 +2,7 @@ import os
from freezegun import freeze_time
from posthog.test.base import APIBaseTest, ClickhouseTestMixin
-from unittest.mock import ANY, patch
+from unittest.mock import ANY, Mock, patch
from boto3 import resource
from botocore.config import Config
@@ -331,6 +331,105 @@ class TestErrorTracking(APIBaseTest):
response = self.client.get(f"/api/environments/{self.team.id}/error_tracking/symbol_sets")
self.assertEqual(len(response.json()["results"]), 2)
+ def test_fetching_symbol_sets_filters_by_status_ref_and_order(self) -> None:
+ ErrorTrackingSymbolSet.objects.create(ref="source_b", team=self.team, storage_ptr="symbolsets/source_b")
+ ErrorTrackingSymbolSet.objects.create(
+ ref="source_a", team=self.team, storage_ptr=None, failure_reason="Source map not found"
+ )
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets",
+ data={"status": "valid", "order_by": "ref"},
+ )
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertEqual([symbol_set["ref"] for symbol_set in response.json()["results"]], ["source_b"])
+ self.assertEqual([symbol_set["has_uploaded_file"] for symbol_set in response.json()["results"]], [True])
+ self.assertNotIn("storage_ptr", response.json()["results"][0])
+ self.assertNotIn("content_hash", response.json()["results"][0])
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets",
+ data={"ref": "source_a"},
+ )
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertEqual([symbol_set["ref"] for symbol_set in response.json()["results"]], ["source_a"])
+
+ def test_fetching_symbol_set_by_id(self) -> None:
+ other_team = self.create_team_with_organization(organization=self.organization)
+ symbol_set = ErrorTrackingSymbolSet.objects.create(ref="source_1", team=self.team, storage_ptr=None)
+ other_symbol_set = ErrorTrackingSymbolSet.objects.create(ref="source_2", team=other_team, storage_ptr=None)
+
+ response = self.client.get(f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{symbol_set.id}")
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertEqual(response.json()["id"], str(symbol_set.id))
+ self.assertEqual(response.json()["ref"], "source_1")
+ self.assertEqual(response.json()["has_uploaded_file"], False)
+ self.assertNotIn("storage_ptr", response.json())
+ self.assertNotIn("content_hash", response.json())
+
+ response = self.client.get(f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{other_symbol_set.id}")
+ self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
+
+ def test_symbol_set_list_query_validation_does_not_apply_to_retrieve(self) -> None:
+ symbol_set = ErrorTrackingSymbolSet.objects.create(
+ ref="source_1", team=self.team, storage_ptr="symbolsets/source_1"
+ )
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets",
+ data={"order_by": "storage_ptr"},
+ )
+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{symbol_set.id}",
+ data={"order_by": "storage_ptr"},
+ )
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ def test_symbol_set_storage_ptr_is_read_only(self) -> None:
+ symbol_set = ErrorTrackingSymbolSet.objects.create(
+ ref="source_1", team=self.team, storage_ptr="symbolsets/source_1"
+ )
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{symbol_set.id}",
+ data={"storage_ptr": "symbolsets/other_team_file"},
+ format="multipart",
+ )
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ symbol_set.refresh_from_db()
+ self.assertEqual(symbol_set.storage_ptr, "symbolsets/source_1")
+
+ @patch("products.error_tracking.backend.api.symbol_sets.object_storage.get_presigned_url")
+ def test_download_symbol_set(self, patched_get_presigned_url: Mock) -> None:
+ patched_get_presigned_url.return_value = "https://example.com/source.map"
+ symbol_set = ErrorTrackingSymbolSet.objects.create(
+ ref="source_1", team=self.team, storage_ptr="symbolsets/source_1"
+ )
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{symbol_set.id}/download"
+ )
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertEqual(response.json(), {"url": "https://example.com/source.map"})
+ patched_get_presigned_url.assert_called_once_with(file_key="symbolsets/source_1", expiration=3600)
+
+ def test_download_symbol_set_without_file_returns_404(self) -> None:
+ symbol_set = ErrorTrackingSymbolSet.objects.create(ref="source_1", team=self.team, storage_ptr=None)
+
+ response = self.client.get(
+ f"/api/environments/{self.team.id}/error_tracking/symbol_sets/{symbol_set.id}/download"
+ )
+
+ self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
+ self.assertEqual(response.json(), {"detail": "Symbol set has no uploaded file."})
+
def test_fetching_stack_frames(self):
other_team = self.create_team_with_organization(organization=self.organization)
symbol_set = ErrorTrackingSymbolSet.objects.create(ref="source_1", team=self.team, storage_ptr=None)
diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.ts
index 93c1260e6a5b..c651cc1036a2 100644
--- a/products/error_tracking/frontend/generated/api.schemas.ts
+++ b/products/error_tracking/frontend/generated/api.schemas.ts
@@ -1017,24 +1017,34 @@ export interface PatchedErrorTrackingReleaseApi {
}
/**
- * Release associated with this symbol set
+ * Release associated with this symbol set, if any.
* @nullable
*/
export type ErrorTrackingSymbolSetApiRelease = { [key: string]: unknown } | null | null
export interface ErrorTrackingSymbolSetApi {
+ /** Unique symbol set ID. */
readonly id: string
- ref: string
+ /** Reference used to match stack frames to this symbol set. */
+ readonly ref: string
+ /** Project/team ID that owns this symbol set. */
readonly team_id: number
+ /** When this symbol set row was created. */
readonly created_at: string
- /** @nullable */
- last_used?: string | null
- /** @nullable */
- storage_ptr?: string | null
- /** @nullable */
- failure_reason?: string | null
/**
- * Release associated with this symbol set
+ * When this symbol set was last used to resolve a stack frame.
+ * @nullable
+ */
+ readonly last_used: string | null
+ /**
+ * Reason symbol lookup failed, if the source map is missing or invalid.
+ * @nullable
+ */
+ readonly failure_reason: string | null
+ /** Whether this symbol set has an uploaded source map file available to download. */
+ readonly has_uploaded_file: boolean
+ /**
+ * Release associated with this symbol set, if any.
* @nullable
*/
readonly release: ErrorTrackingSymbolSetApiRelease
@@ -1050,34 +1060,93 @@ export interface PaginatedErrorTrackingSymbolSetListApi {
}
/**
- * Release associated with this symbol set
+ * Release associated with this symbol set, if any.
* @nullable
*/
export type PatchedErrorTrackingSymbolSetApiRelease = { [key: string]: unknown } | null | null
export interface PatchedErrorTrackingSymbolSetApi {
+ /** Unique symbol set ID. */
readonly id?: string
- ref?: string
+ /** Reference used to match stack frames to this symbol set. */
+ readonly ref?: string
+ /** Project/team ID that owns this symbol set. */
readonly team_id?: number
+ /** When this symbol set row was created. */
readonly created_at?: string
- /** @nullable */
- last_used?: string | null
- /** @nullable */
- storage_ptr?: string | null
- /** @nullable */
- failure_reason?: string | null
/**
- * Release associated with this symbol set
+ * When this symbol set was last used to resolve a stack frame.
+ * @nullable
+ */
+ readonly last_used?: string | null
+ /**
+ * Reason symbol lookup failed, if the source map is missing or invalid.
+ * @nullable
+ */
+ readonly failure_reason?: string | null
+ /** Whether this symbol set has an uploaded source map file available to download. */
+ readonly has_uploaded_file?: boolean
+ /**
+ * Release associated with this symbol set, if any.
* @nullable
*/
readonly release?: PatchedErrorTrackingSymbolSetApiRelease
}
export interface _SymbolSetDownloadResponseApi {
- /** Presigned URL to download the source map file */
+ /** Presigned URL to download the source map file. Use immediately; expires after one hour. */
url: string
}
+export interface ErrorTrackingSymbolSetFinishUploadApi {
+ /** Hash of the uploaded symbol set content. */
+ content_hash: string
+}
+
+export interface ErrorTrackingSymbolSetBulkDeleteApi {
+ /** Symbol set IDs to delete. */
+ ids: string[]
+}
+
+/**
+ * Map of symbol set ID to uploaded content hash.
+ */
+export type ErrorTrackingSymbolSetBulkFinishUploadApiContentHashes = { [key: string]: string }
+
+export interface ErrorTrackingSymbolSetBulkFinishUploadApi {
+ /** Map of symbol set ID to uploaded content hash. */
+ content_hashes: ErrorTrackingSymbolSetBulkFinishUploadApiContentHashes
+}
+
+export interface ErrorTrackingSymbolSetUploadApi {
+ /** Symbol set reference to upload. */
+ chunk_id: string
+ /**
+ * Optional error tracking release ID associated with this symbol set.
+ * @nullable
+ */
+ release_id?: string | null
+ /**
+ * Optional hash of the symbol set content, used to skip unchanged uploads.
+ * @nullable
+ */
+ content_hash?: string | null
+}
+
+export interface ErrorTrackingSymbolSetBulkStartUploadApi {
+ /** Legacy list of symbol set references to upload, all associated with `release_id`. */
+ chunk_ids?: string[]
+ /**
+ * Optional error tracking release ID used with `chunk_ids`.
+ * @nullable
+ */
+ release_id?: string | null
+ /** Symbol sets to upload with per-symbol release IDs and content hashes. */
+ symbol_sets?: ErrorTrackingSymbolSetUploadApi[]
+ /** Whether to overwrite uploaded symbol sets whose content hash changed. */
+ force?: boolean
+}
+
export type ErrorTrackingAssignmentRulesListParams = {
/**
* Number of results to return per page.
@@ -1232,4 +1301,39 @@ export type ErrorTrackingSymbolSetsListParams = {
* The initial index from which to return the results.
*/
offset?: number
+ /**
+ * Sort order for symbol sets. Prefix with `-` for descending order.
+
+* `created_at` - created_at
+* `-created_at` - -created_at
+* `ref` - ref
+* `-ref` - -ref
+* `last_used` - last_used
+* `-last_used` - -last_used
+ * @minLength 1
+ */
+ order_by?: string
+ /**
+ * Exact symbol set reference to filter by.
+ * @minLength 1
+ */
+ ref?: string
+ /**
+ * Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.
+
+* `all` - all
+* `valid` - valid
+* `invalid` - invalid
+ * @minLength 1
+ */
+ status?: ErrorTrackingSymbolSetsListStatus
}
+
+export type ErrorTrackingSymbolSetsListStatus =
+ (typeof ErrorTrackingSymbolSetsListStatus)[keyof typeof ErrorTrackingSymbolSetsListStatus]
+
+export const ErrorTrackingSymbolSetsListStatus = {
+ All: 'all',
+ Valid: 'valid',
+ Invalid: 'invalid',
+} as const
diff --git a/products/error_tracking/frontend/generated/api.ts b/products/error_tracking/frontend/generated/api.ts
index f6d3b4751195..900417e63e9f 100644
--- a/products/error_tracking/frontend/generated/api.ts
+++ b/products/error_tracking/frontend/generated/api.ts
@@ -41,6 +41,10 @@ import type {
ErrorTrackingSuppressionRuleCreateRequestApi,
ErrorTrackingSuppressionRulesListParams,
ErrorTrackingSymbolSetApi,
+ ErrorTrackingSymbolSetBulkDeleteApi,
+ ErrorTrackingSymbolSetBulkFinishUploadApi,
+ ErrorTrackingSymbolSetBulkStartUploadApi,
+ ErrorTrackingSymbolSetFinishUploadApi,
ErrorTrackingSymbolSetsListParams,
GitProviderFileLinkResolveResponseApi,
PaginatedErrorTrackingAssignmentRuleListApi,
@@ -1440,14 +1444,14 @@ export const getErrorTrackingSymbolSetsFinishUploadUpdateUrl = (projectId: strin
export const errorTrackingSymbolSetsFinishUploadUpdate = async (
projectId: string,
id: string,
- errorTrackingSymbolSetApi: NonReadonly<ErrorTrackingSymbolSetApi>,
+ errorTrackingSymbolSetFinishUploadApi: ErrorTrackingSymbolSetFinishUploadApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getErrorTrackingSymbolSetsFinishUploadUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(errorTrackingSymbolSetApi),
+ body: JSON.stringify(errorTrackingSymbolSetFinishUploadApi),
})
}
@@ -1457,14 +1461,14 @@ export const getErrorTrackingSymbolSetsBulkDeleteCreateUrl = (projectId: string)
export const errorTrackingSymbolSetsBulkDeleteCreate = async (
projectId: string,
- errorTrackingSymbolSetApi: NonReadonly<ErrorTrackingSymbolSetApi>,
+ errorTrackingSymbolSetBulkDeleteApi: ErrorTrackingSymbolSetBulkDeleteApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getErrorTrackingSymbolSetsBulkDeleteCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(errorTrackingSymbolSetApi),
+ body: JSON.stringify(errorTrackingSymbolSetBulkDeleteApi),
})
}
@@ -1474,14 +1478,14 @@ export const getErrorTrackingSymbolSetsBulkFinishUploadCreateUrl = (projectId: s
export const errorTrackingSymbolSetsBulkFinishUploadCreate = async (
projectId: string,
- errorTrackingSymbolSetApi: NonReadonly<ErrorTrackingSymbolSetApi>,
+ errorTrackingSymbolSetBulkFinishUploadApi: ErrorTrackingSymbolSetBulkFinishUploadApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getErrorTrackingSymbolSetsBulkFinishUploadCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(errorTrackingSymbolSetApi),
+ body: JSON.stringify(errorTrackingSymbolSetBulkFinishUploadApi),
})
}
@@ -1491,14 +1495,14 @@ export const getErrorTrackingSymbolSetsBulkStartUploadCreateUrl = (projectId: st
export const errorTrackingSymbolSetsBulkStartUploadCreate = async (
projectId: string,
- errorTrackingSymbolSetApi: NonReadonly<ErrorTrackingSymbolSetApi>,
+ errorTrackingSymbolSetBulkStartUploadApi: ErrorTrackingSymbolSetBulkStartUploadApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getErrorTrackingSymbolSetsBulkStartUploadCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(errorTrackingSymbolSetApi),
+ body: JSON.stringify(errorTrackingSymbolSetBulkStartUploadApi),
})
}
diff --git a/products/error_tracking/frontend/generated/api.zod.ts b/products/error_tracking/frontend/generated/api.zod.ts
index 585201befcea..45b831be2a43 100644
--- a/products/error_tracking/frontend/generated/api.zod.ts
+++ b/products/error_tracking/frontend/generated/api.zod.ts
@@ -402,58 +402,52 @@ export const ErrorTrackingReleasesPartialUpdateBody = /* @__PURE__ */ zod.object
project: zod.string().optional(),
})
-export const ErrorTrackingSymbolSetsCreateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
-})
+export const ErrorTrackingSymbolSetsCreateBody = /* @__PURE__ */ zod.object({})
-export const ErrorTrackingSymbolSetsUpdateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
-})
+export const ErrorTrackingSymbolSetsUpdateBody = /* @__PURE__ */ zod.object({})
-export const ErrorTrackingSymbolSetsPartialUpdateBody = /* @__PURE__ */ zod.object({
- ref: zod.string().optional(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
-})
+export const ErrorTrackingSymbolSetsPartialUpdateBody = /* @__PURE__ */ zod.object({})
export const ErrorTrackingSymbolSetsFinishUploadUpdateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
+ content_hash: zod.string().describe('Hash of the uploaded symbol set content.'),
})
export const ErrorTrackingSymbolSetsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
+ ids: zod.array(zod.uuid()).describe('Symbol set IDs to delete.'),
})
export const ErrorTrackingSymbolSetsBulkFinishUploadCreateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
+ content_hashes: zod.record(zod.string(), zod.string()).describe('Map of symbol set ID to uploaded content hash.'),
})
+export const errorTrackingSymbolSetsBulkStartUploadCreateBodyForceDefault = false
+
export const ErrorTrackingSymbolSetsBulkStartUploadCreateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
+ chunk_ids: zod
+ .array(zod.string())
+ .optional()
+ .describe('Legacy list of symbol set references to upload, all associated with `release_id`.'),
+ release_id: zod.string().nullish().describe('Optional error tracking release ID used with `chunk_ids`.'),
+ symbol_sets: zod
+ .array(
+ zod.object({
+ chunk_id: zod.string().describe('Symbol set reference to upload.'),
+ release_id: zod
+ .string()
+ .nullish()
+ .describe('Optional error tracking release ID associated with this symbol set.'),
+ content_hash: zod
+ .string()
+ .nullish()
+ .describe('Optional hash of the symbol set content, used to skip unchanged uploads.'),
+ })
+ )
+ .optional()
+ .describe('Symbol sets to upload with per-symbol release IDs and content hashes.'),
+ force: zod
+ .boolean()
+ .default(errorTrackingSymbolSetsBulkStartUploadCreateBodyForceDefault)
+ .describe('Whether to overwrite uploaded symbol sets whose content hash changed.'),
})
-export const ErrorTrackingSymbolSetsStartUploadCreateBody = /* @__PURE__ */ zod.object({
- ref: zod.string(),
- last_used: zod.iso.datetime({}).nullish(),
- storage_ptr: zod.string().nullish(),
- failure_reason: zod.string().nullish(),
-})
+export const ErrorTrackingSymbolSetsStartUploadCreateBody = /* @__PURE__ */ zod.object({})
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/symbol_sets/SymbolSets.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/symbol_sets/SymbolSets.tsx
index 2986dd4205f9..c57c14eb4d92 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/symbol_sets/SymbolSets.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/symbol_sets/SymbolSets.tsx
@@ -200,10 +200,13 @@ const SymbolSetTable = (): JSX.Element => {
},
{
title: 'Status',
- render: (_, { failure_reason }) => {
+ render: (_, { failure_reason, has_uploaded_file }) => {
+ const statusTooltip =
+ failure_reason || (!has_uploaded_file ? 'No source map file has been uploaded' : undefined)
+
return (
- <Tooltip title={failure_reason} placement="top">
- {failure_reason ? (
+ <Tooltip title={statusTooltip} placement="top">
+ {!has_uploaded_file ? (
<span className="text-danger cursor-pointer">
<IconWarning /> Missing
</span>
@@ -238,10 +241,10 @@ const SymbolSetTable = (): JSX.Element => {
dataIndex: 'id',
align: 'right',
- render: (_, { id, storage_ptr }) => {
+ render: (_, { id, has_uploaded_file }) => {
return (
<div className="flex justify-end items-center gap-1">
- {storage_ptr && (
+ {has_uploaded_file && (
<LemonButton
type="tertiary"
size="xsmall"
diff --git a/products/error_tracking/mcp/tools.yaml b/products/error_tracking/mcp/tools.yaml
index f1c6d06cff1b..3bea213e5611 100644
--- a/products/error_tracking/mcp/tools.yaml
+++ b/products/error_tracking/mcp/tools.yaml
@@ -357,19 +357,70 @@ tools:
enabled: false
error-tracking-symbol-sets-download-retrieve:
operation: error_tracking_symbol_sets_download_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - error_tracking:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Download error tracking symbol set
+ description: >
+ Get a presigned download URL for a source map symbol set by ID. The URL expires after one hour. Use it
+ immediately, and do not echo it back unless the user explicitly asks. If you only have a symbol set
+ reference, call `error-tracking-symbol-sets-list` with the exact `ref` first.
error-tracking-symbol-sets-finish-upload-update:
operation: error_tracking_symbol_sets_finish_upload_update
enabled: false
error-tracking-symbol-sets-list:
operation: error_tracking_symbol_sets_list
- enabled: false
+ enabled: true
+ scopes:
+ - error_tracking:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ list: true
+ title: List error tracking symbol sets
+ description: >
+ List source map symbol sets for the current project. Supports pagination plus filtering by exact `ref` or
+ upload `status` (`valid`, `invalid`, or `all`) and sorting with `order_by`. Each result includes
+ `has_uploaded_file` so you can tell whether the download tool will work.
+ response:
+ include:
+ - id
+ - ref
+ - created_at
+ - last_used
+ - failure_reason
+ - has_uploaded_file
+ - release
error-tracking-symbol-sets-partial-update:
operation: error_tracking_symbol_sets_partial_update
enabled: false
error-tracking-symbol-sets-retrieve:
operation: error_tracking_symbol_sets_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - error_tracking:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get error tracking symbol set
+ description: >
+ Get a source map symbol set by ID. If you only have a symbol set reference, call
+ `error-tracking-symbol-sets-list` with the exact `ref` first.
+ response:
+ include:
+ - id
+ - ref
+ - created_at
+ - last_used
+ - failure_reason
+ - has_uploaded_file
+ - release
error-tracking-symbol-sets-start-upload-create:
operation: error_tracking_symbol_sets_start_upload_create
enabled: false
diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
index 7e891cc78c95..51e056c32614 100644
--- a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
@@ -38,8 +38,51 @@ Status | Description
---
+## ErrorTrackingSymbolSet (`system.error_tracking_symbol_sets`)
+
+Symbol sets represent uploaded source maps used to unminify JavaScript stack frames.
+Rows can also track missing symbol sets so future uploads know which stack frames may need reprocessing.
+
+### Columns
+
+Column | Type | Nullable | Description
+`id` | uuid | NOT NULL | Primary key (UUID)
+`team_id` | integer | NOT NULL | FK to `system.teams.id`
+`ref` | text | NOT NULL | Symbol set reference matched from stack frames
+`release_id` | uuid | NULL | Associated error tracking release ID
+`created_at` | timestamp with tz | NOT NULL | Creation timestamp
+`last_used` | timestamp with tz | NULL | Last time this symbol set was used for frame resolution
+`failure_reason` | text | NULL | Reason lookup failed when the source map is missing or invalid
+
+### Important Notes
+
+- Internal storage pointers and content hashes are intentionally omitted from HogQL.
+- Use `posthog:error-tracking-symbol-sets-list` with `status = 'valid'` or `status = 'invalid'` to check upload availability.
+- Use `posthog:error-tracking-symbol-sets-list` with an exact `ref` to resolve a reference to an ID, then `posthog:error-tracking-symbol-sets-retrieve` or `posthog:error-tracking-symbol-sets-download-retrieve` by ID. Download URLs expire after one hour; use them immediately and do not echo them back unless the user explicitly asks.
+
+---
+
## Common Query Patterns
+**Find symbol set lookup failures:**
+
+```sql
+SELECT id, ref, failure_reason, created_at, last_used
+FROM system.error_tracking_symbol_sets
+WHERE failure_reason IS NOT NULL
+ORDER BY created_at DESC
+LIMIT 20
+```
+
+**Find symbol set metadata by reference:**
+
+```sql
+SELECT id, ref, release_id, created_at, last_used, failure_reason
+FROM system.error_tracking_symbol_sets
+WHERE ref = 'https://example.com/static/app.min.js'
+LIMIT 1
+```
+
**Find issues by status:**
```sql
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 5c8df159f447..37ba62047573 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -1244,6 +1244,51 @@
"readOnlyHint": true
}
},
+ "error-tracking-symbol-sets-download-retrieve": {
+ "description": "Get a presigned download URL for a source map symbol set by ID. The URL expires after one hour. Use it immediately, and do not echo it back unless the user explicitly asks. If you only have a symbol set reference, call `error-tracking-symbol-sets-list` with the exact `ref` first.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "Download error tracking symbol set",
+ "title": "Download error tracking symbol set",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "error-tracking-symbol-sets-list": {
+ "description": "List source map symbol sets for the current project. Supports pagination plus filtering by exact `ref` or upload `status` (`valid`, `invalid`, or `all`) and sorting with `order_by`. Each result includes `has_uploaded_file` so you can tell whether the download tool will work.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "List error tracking symbol sets",
+ "title": "List error tracking symbol sets",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "error-tracking-symbol-sets-retrieve": {
+ "description": "Get a source map symbol set by ID. If you only have a symbol set reference, call `error-tracking-symbol-sets-list` with the exact `ref` first.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "Get error tracking symbol set",
+ "title": "Get error tracking symbol set",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"experiment-archive": {
"description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nArchive a stopped experiment to hide it from the default list view. The experiment must be stopped (end_date set) — cannot archive draft or running experiments.\n\nReturns 400 if already archived (\"Experiment is already archived.\") or not yet stopped (\"Experiment must be ended before it can be archived.\").\n\nNo request body needed. Can be restored later via the unarchive tool.",
"category": "Experiments",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 48e243a81b9f..8456d6017020 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -1290,6 +1290,51 @@
"readOnlyHint": true
}
},
+ "error-tracking-symbol-sets-download-retrieve": {
+ "description": "Get a presigned download URL for a source map symbol set by ID. The URL expires after one hour. Use it immediately, and do not echo it back unless the user explicitly asks. If you only have a symbol set reference, call `error-tracking-symbol-sets-list` with the exact `ref` first.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "Download error tracking symbol set",
+ "title": "Download error tracking symbol set",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "error-tracking-symbol-sets-list": {
+ "description": "List source map symbol sets for the current project. Supports pagination plus filtering by exact `ref` or upload `status` (`valid`, `invalid`, or `all`) and sorting with `order_by`. Each result includes `has_uploaded_file` so you can tell whether the download tool will work.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "List error tracking symbol sets",
+ "title": "List error tracking symbol sets",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "error-tracking-symbol-sets-retrieve": {
+ "description": "Get a source map symbol set by ID. If you only have a symbol set reference, call `error-tracking-symbol-sets-list` with the exact `ref` first.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "Get error tracking symbol set",
+ "title": "Get error tracking symbol set",
+ "required_scopes": ["error_tracking:read"],
+ "new_mcp": true,
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"evaluation-create": {
"description": "Create a new LLM analytics evaluation. Two types are supported: 'llm_judge' uses an LLM to score generations against a prompt you define (for subjective checks like tone, helpfulness, hallucination detection), and 'hog' runs deterministic code against each generation (for rule-based checks like format validation, keyword detection, length limits). For llm_judge evaluations, provide a prompt in evaluation_config and a model_configuration. For hog evaluations, provide source code in evaluation_config.",
"category": "LLM analytics",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index b336816309cb..71f65be1a254 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -15720,29 +15720,88 @@ export namespace Schemas {
}
/**
- * Release associated with this symbol set
+ * Release associated with this symbol set, if any.
* @nullable
*/
export type ErrorTrackingSymbolSetRelease = { [key: string]: unknown } | null | null;
export interface ErrorTrackingSymbolSet {
+ /** Unique symbol set ID. */
readonly id: string;
- ref: string;
+ /** Reference used to match stack frames to this symbol set. */
+ readonly ref: string;
+ /** Project/team ID that owns this symbol set. */
readonly team_id: number;
+ /** When this symbol set row was created. */
readonly created_at: string;
- /** @nullable */
- last_used?: string | null;
- /** @nullable */
- storage_ptr?: string | null;
- /** @nullable */
- failure_reason?: string | null;
/**
- * Release associated with this symbol set
+ * When this symbol set was last used to resolve a stack frame.
+ * @nullable
+ */
+ readonly last_used: string | null;
+ /**
+ * Reason symbol lookup failed, if the source map is missing or invalid.
+ * @nullable
+ */
+ readonly failure_reason: string | null;
+ /** Whether this symbol set has an uploaded source map file available to download. */
+ readonly has_uploaded_file: boolean;
+ /**
+ * Release associated with this symbol set, if any.
* @nullable
*/
readonly release: ErrorTrackingSymbolSetRelease;
}
+ export interface ErrorTrackingSymbolSetBulkDelete {
+ /** Symbol set IDs to delete. */
+ ids: string[];
+ }
+
+ /**
+ * Map of symbol set ID to uploaded content hash.
+ */
+ export type ErrorTrackingSymbolSetBulkFinishUploadContentHashes = {[key: string]: string};
+
+ export interface ErrorTrackingSymbolSetBulkFinishUpload {
+ /** Map of symbol set ID to uploaded content hash. */
+ content_hashes: ErrorTrackingSymbolSetBulkFinishUploadContentHashes;
+ }
+
+ export interface ErrorTrackingSymbolSetUpload {
+ /** Symbol set reference to upload. */
+ chunk_id: string;
+ /**
+ * Optional error tracking release ID associated with this symbol set.
+ * @nullable
+ */
+ release_id?: string | null;
+ /**
+ * Optional hash of the symbol set content, used to skip unchanged uploads.
+ * @nullable
+ */
+ content_hash?: string | null;
+ }
+
+ export interface ErrorTrackingSymbolSetBulkStartUpload {
+ /** Legacy list of symbol set references to upload, all associated with `release_id`. */
+ chunk_ids?: string[];
+ /**
+ * Optional error tracking release ID used with `chunk_ids`.
+ * @nullable
+ */
+ release_id?: string | null;
+ /** Symbol sets to upload with per-symbol release IDs and content hashes. */
+ symbol_sets?: ErrorTrackingSymbolSetUpload[];
+ /** Whether to overwrite uploaded symbol sets whose content hash changed. */
+ force?: boolean;
+ }
+
+ export interface ErrorTrackingSymbolSetFinishUpload {
+ /** Hash of the uploaded symbol set content. */
+ content_hash: string;
+ }
+
/**
* Configuration dict. For 'llm_judge': {prompt}. For 'hog': {source}.
*/
@@ -27398,24 +27457,34 @@ export namespace Schemas {
}
/**
- * Release associated with this symbol set
+ * Release associated with this symbol set, if any.
* @nullable
*/
export type PatchedErrorTrackingSymbolSetRelease = { [key: string]: unknown } | null | null;
export interface PatchedErrorTrackingSymbolSet {
+ /** Unique symbol set ID. */
readonly id?: string;
- ref?: string;
+ /** Reference used to match stack frames to this symbol set. */
+ readonly ref?: string;
+ /** Project/team ID that owns this symbol set. */
readonly team_id?: number;
+ /** When this symbol set row was created. */
readonly created_at?: string;
- /** @nullable */
- last_used?: string | null;
- /** @nullable */
- storage_ptr?: string | null;
- /** @nullable */
- failure_reason?: string | null;
/**
- * Release associated with this symbol set
+ * When this symbol set was last used to resolve a stack frame.
+ * @nullable
+ */
+ readonly last_used?: string | null;
+ /**
+ * Reason symbol lookup failed, if the source map is missing or invalid.
+ * @nullable
+ */
+ readonly failure_reason?: string | null;
+ /** Whether this symbol set has an uploaded source map file available to download. */
+ readonly has_uploaded_file?: boolean;
+ /**
+ * Release associated with this symbol set, if any.
* @nullable
*/
readonly release?: PatchedErrorTrackingSymbolSetRelease;
@@ -38055,7 +38124,7 @@ export namespace Schemas {
}
export interface _SymbolSetDownloadResponse {
- /** Presigned URL to download the source map file */
+ /** Presigned URL to download the source map file. Use immediately; expires after one hour. */
url: string;
}
@@ -38589,8 +38658,43 @@ export namespace Schemas {
* The initial index from which to return the results.
*/
offset?: number;
+ /**
+ * Sort order for symbol sets. Prefix with `-` for descending order.
+
+ * `created_at` - created_at
+ * `-created_at` - -created_at
+ * `ref` - ref
+ * `-ref` - -ref
+ * `last_used` - last_used
+ * `-last_used` - -last_used
+ * @minLength 1
+ */
+ order_by?: string;
+ /**
+ * Exact symbol set reference to filter by.
+ * @minLength 1
+ */
+ ref?: string;
+ /**
+ * Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.
+
+ * `all` - all
+ * `valid` - valid
+ * `invalid` - invalid
+ * @minLength 1
+ */
+ status?: EnvironmentsErrorTrackingSymbolSetsListStatus;
};
+ export type EnvironmentsErrorTrackingSymbolSetsListStatus = typeof EnvironmentsErrorTrackingSymbolSetsListStatus[keyof typeof EnvironmentsErrorTrackingSymbolSetsListStatus];
+
+
+ export const EnvironmentsErrorTrackingSymbolSetsListStatus = {
+ All: 'all',
+ Valid: 'valid',
+ Invalid: 'invalid',
+ } as const;
+
export type EnvironmentsEventsListParams = {
/**
* Only return events with a timestamp after this time. Default: now() - 24 hours.
@@ -42844,8 +42948,43 @@ export namespace Schemas {
* The initial index from which to return the results.
*/
offset?: number;
+ /**
+ * Sort order for symbol sets. Prefix with `-` for descending order.
+
+ * `created_at` - created_at
+ * `-created_at` - -created_at
+ * `ref` - ref
+ * `-ref` - -ref
+ * `last_used` - last_used
+ * `-last_used` - -last_used
+ * @minLength 1
+ */
+ order_by?: string;
+ /**
+ * Exact symbol set reference to filter by.
+ * @minLength 1
+ */
+ ref?: string;
+ /**
+ * Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.
+
+ * `all` - all
+ * `valid` - valid
+ * `invalid` - invalid
+ * @minLength 1
+ */
+ status?: ErrorTrackingSymbolSetsListStatus;
};
+ export type ErrorTrackingSymbolSetsListStatus = typeof ErrorTrackingSymbolSetsListStatus[keyof typeof ErrorTrackingSymbolSetsListStatus];
+
+
+ export const ErrorTrackingSymbolSetsListStatus = {
+ All: 'all',
+ Valid: 'valid',
+ Invalid: 'invalid',
+ } as const;
+
export type EventDefinitionsListParams = {
/**
* Number of results to return per page.
diff --git a/services/mcp/src/generated/error_tracking/api.ts b/services/mcp/src/generated/error_tracking/api.ts
index 9d81df980e3d..53316959aef2 100644
--- a/services/mcp/src/generated/error_tracking/api.ts
+++ b/services/mcp/src/generated/error_tracking/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 11 enabled ops
+ * PostHog API - MCP 14 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -3033,3 +3033,53 @@ export const ErrorTrackingSuppressionRulesCreateBody = /* @__PURE__ */ zod.objec
.default(errorTrackingSuppressionRulesCreateBodySamplingRateDefault)
.describe('Fraction of matching events to suppress. Use `1.0` to suppress all matching events.'),
})
+
+export const ErrorTrackingSymbolSetsListParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const errorTrackingSymbolSetsListQueryStatusDefault = `all`
+
+export const ErrorTrackingSymbolSetsListQueryParams = /* @__PURE__ */ zod.object({
+ limit: zod.number().optional().describe('Number of results to return per page.'),
+ offset: zod.number().optional().describe('The initial index from which to return the results.'),
+ order_by: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe(
+ 'Sort order for symbol sets. Prefix with `-` for descending order.\n\n* `created_at` - created_at\n* `-created_at` - -created_at\n* `ref` - ref\n* `-ref` - -ref\n* `last_used` - last_used\n* `-last_used` - -last_used'
+ ),
+ ref: zod.string().min(1).optional().describe('Exact symbol set reference to filter by.'),
+ status: zod
+ .enum(['all', 'valid', 'invalid'])
+ .default(errorTrackingSymbolSetsListQueryStatusDefault)
+ .describe(
+ 'Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.\n\n* `all` - all\n* `valid` - valid\n* `invalid` - invalid'
+ ),
+})
+
+export const ErrorTrackingSymbolSetsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.string().describe('A UUID string identifying this error tracking symbol set.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+/**
+ * Return a presigned URL for downloading the symbol set's source map.
+ */
+export const ErrorTrackingSymbolSetsDownloadRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.string().describe('A UUID string identifying this error tracking symbol set.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
diff --git a/services/mcp/src/tools/generated/error_tracking.ts b/services/mcp/src/tools/generated/error_tracking.ts
index 0ae9450907f9..f9a1cc726c4a 100644
--- a/services/mcp/src/tools/generated/error_tracking.ts
+++ b/services/mcp/src/tools/generated/error_tracking.ts
@@ -16,6 +16,9 @@ import {
ErrorTrackingIssuesSplitCreateParams,
ErrorTrackingSuppressionRulesCreateBody,
ErrorTrackingSuppressionRulesListQueryParams,
+ ErrorTrackingSymbolSetsDownloadRetrieveParams,
+ ErrorTrackingSymbolSetsListQueryParams,
+ ErrorTrackingSymbolSetsRetrieveParams,
} from '@/generated/error_tracking/api'
import { withUiApp } from '@/resources/ui-apps'
import { createQueryWrapper } from '@/tools/query-wrapper-factory'
@@ -316,6 +319,92 @@ const errorTrackingSuppressionRulesList = (): ToolBase<
},
})
+const ErrorTrackingSymbolSetsDownloadRetrieveSchema = ErrorTrackingSymbolSetsDownloadRetrieveParams.omit({
+ project_id: true,
+})
+
+const errorTrackingSymbolSetsDownloadRetrieve = (): ToolBase<
+ typeof ErrorTrackingSymbolSetsDownloadRetrieveSchema,
+ Schemas._SymbolSetDownloadResponse
+> => ({
+ name: 'error-tracking-symbol-sets-download-retrieve',
+ schema: ErrorTrackingSymbolSetsDownloadRetrieveSchema,
+ handler: async (context: Context, params: z.infer<typeof ErrorTrackingSymbolSetsDownloadRetrieveSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas._SymbolSetDownloadResponse>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/symbol_sets/${encodeURIComponent(String(params.id))}/download/`,
+ })
+ return result
+ },
+})
+
+const ErrorTrackingSymbolSetsListSchema = ErrorTrackingSymbolSetsListQueryParams
+
+const errorTrackingSymbolSetsList = (): ToolBase<
+ typeof ErrorTrackingSymbolSetsListSchema,
+ WithPostHogUrl<Schemas.PaginatedErrorTrackingSymbolSetList>
+> => ({
+ name: 'error-tracking-symbol-sets-list',
+ schema: ErrorTrackingSymbolSetsListSchema,
+ handler: async (context: Context, params: z.infer<typeof ErrorTrackingSymbolSetsListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.PaginatedErrorTrackingSymbolSetList>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/symbol_sets/`,
+ query: {
+ limit: params.limit,
+ offset: params.offset,
+ order_by: params.order_by,
+ ref: params.ref,
+ status: params.status,
+ },
+ })
+ const filtered = {
+ ...result,
+ results: (result.results ?? []).map((item: any) =>
+ pickResponseFields(item, [
+ 'id',
+ 'ref',
+ 'created_at',
+ 'last_used',
+ 'failure_reason',
+ 'has_uploaded_file',
+ 'release',
+ ])
+ ),
+ } as typeof result
+ return await withPostHogUrl(context, filtered, '/error_tracking')
+ },
+})
+
+const ErrorTrackingSymbolSetsRetrieveSchema = ErrorTrackingSymbolSetsRetrieveParams.omit({ project_id: true })
+
+const errorTrackingSymbolSetsRetrieve = (): ToolBase<
+ typeof ErrorTrackingSymbolSetsRetrieveSchema,
+ Schemas.ErrorTrackingSymbolSet
+> => ({
+ name: 'error-tracking-symbol-sets-retrieve',
+ schema: ErrorTrackingSymbolSetsRetrieveSchema,
+ handler: async (context: Context, params: z.infer<typeof ErrorTrackingSymbolSetsRetrieveSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ErrorTrackingSymbolSet>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/symbol_sets/${encodeURIComponent(String(params.id))}/`,
+ })
+ const filtered = pickResponseFields(result, [
+ 'id',
+ 'ref',
+ 'created_at',
+ 'last_used',
+ 'failure_reason',
+ 'has_uploaded_file',
+ 'release',
+ ]) as typeof result
+ return filtered
+ },
+})
+
// --- Query wrapper schemas from schema.json ---
const integer = z.coerce.number().int()
@@ -652,6 +741,9 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'error-tracking-issues-split-create': errorTrackingIssuesSplitCreate,
'error-tracking-suppression-rules-create': errorTrackingSuppressionRulesCreate,
'error-tracking-suppression-rules-list': errorTrackingSuppressionRulesList,
+ 'error-tracking-symbol-sets-download-retrieve': errorTrackingSymbolSetsDownloadRetrieve,
+ 'error-tracking-symbol-sets-list': errorTrackingSymbolSetsList,
+ 'error-tracking-symbol-sets-retrieve': errorTrackingSymbolSetsRetrieve,
'query-error-tracking-issues': createQueryWrapper({
name: 'query-error-tracking-issues',
schema: QueryErrorTrackingIssuesSchema,
diff --git a/services/mcp/tests/tools/errorTracking.integration.test.ts b/services/mcp/tests/tools/errorTracking.integration.test.ts
index b3b19153ba48..371a45d3db98 100644
--- a/services/mcp/tests/tools/errorTracking.integration.test.ts
+++ b/services/mcp/tests/tools/errorTracking.integration.test.ts
@@ -22,6 +22,11 @@ type ErrorTrackingFingerprintListResult = {
results?: Array<{ fingerprint?: string | null }>
}
+type ErrorTrackingSymbolSetListResult = {
+ count?: number
+ results?: Array<{ id?: string | null; ref?: string | null; has_uploaded_file?: boolean | null }>
+}
+
describe('Error Tracking', { concurrent: false }, () => {
let context: Context
let currentUserId: number
@@ -345,6 +350,73 @@ describe('Error Tracking', { concurrent: false }, () => {
})
})
+ describe('symbol-sets list tool', () => {
+ const symbolSetsListTool = GENERATED_TOOLS['error-tracking-symbol-sets-list']!()
+
+ it('should list symbol sets', async () => {
+ const result = (await symbolSetsListTool.handler(context, { limit: 5 })) as ErrorTrackingSymbolSetListResult
+
+ expect(result).toBeTruthy()
+ expect(typeof result.count).toBe('number')
+ expect(Array.isArray(result.results)).toBe(true)
+ })
+ })
+
+ describe('symbol-sets retrieve tool', () => {
+ const symbolSetsListTool = GENERATED_TOOLS['error-tracking-symbol-sets-list']!()
+ const symbolSetRetrieveTool = GENERATED_TOOLS['error-tracking-symbol-sets-retrieve']!()
+
+ it('should retrieve a symbol set by ID when one exists', async () => {
+ const listResult = (await symbolSetsListTool.handler(context, {
+ limit: 1,
+ })) as ErrorTrackingSymbolSetListResult
+ const symbolSet = listResult.results?.find(
+ (item): item is { id: string; ref?: string | null } => typeof item.id === 'string'
+ )
+ if (!symbolSet) {
+ return
+ }
+
+ if (symbolSet.ref) {
+ const filteredResult = (await symbolSetsListTool.handler(context, {
+ ref: symbolSet.ref,
+ limit: 1,
+ })) as ErrorTrackingSymbolSetListResult
+ expect(filteredResult.results?.some((item) => item.id === symbolSet.id)).toBe(true)
+ }
+
+ const result = (await symbolSetRetrieveTool.handler(context, { id: symbolSet.id })) as {
+ id?: string
+ ref?: string
+ }
+
+ expect(result).toBeTruthy()
+ expect(result.id).toBe(symbolSet.id)
+ })
+ })
+
+ describe('symbol-sets download tool', () => {
+ const symbolSetsListTool = GENERATED_TOOLS['error-tracking-symbol-sets-list']!()
+ const symbolSetDownloadTool = GENERATED_TOOLS['error-tracking-symbol-sets-download-retrieve']!()
+
+ it('should get a download URL by ID when an uploaded symbol set exists', async () => {
+ const listResult = (await symbolSetsListTool.handler(context, {
+ status: 'valid',
+ limit: 1,
+ })) as ErrorTrackingSymbolSetListResult
+ const symbolSet = listResult.results?.find((item): item is { id: string } => typeof item.id === 'string')
+ if (!symbolSet) {
+ return
+ }
+
+ const result = (await symbolSetDownloadTool.handler(context, { id: symbolSet.id })) as { url?: string }
+
+ expect(result).toBeTruthy()
+ expect(typeof result.url).toBe('string')
+ expect(result.url?.length).toBeGreaterThan(0)
+ })
+ })
+
describe('update-issue-status tool', () => {
const updateTool = GENERATED_TOOLS['error-tracking-issues-partial-update']!()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-download-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-download-retrieve.json
new file mode 100644
index 000000000000..2141e0070472
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-download-retrieve.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A UUID string identifying this error tracking symbol set.",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-list.json
new file mode 100644
index 000000000000..fe2ed9316c87
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-list.json
@@ -0,0 +1,30 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "limit": {
+ "description": "Number of results to return per page.",
+ "type": "number"
+ },
+ "offset": {
+ "description": "The initial index from which to return the results.",
+ "type": "number"
+ },
+ "order_by": {
+ "description": "Sort order for symbol sets. Prefix with `-` for descending order.\n\n* `created_at` - created_at\n* `-created_at` - -created_at\n* `ref` - ref\n* `-ref` - -ref\n* `last_used` - last_used\n* `-last_used` - -last_used",
+ "minLength": 1,
+ "type": "string"
+ },
+ "ref": {
+ "description": "Exact symbol set reference to filter by.",
+ "minLength": 1,
+ "type": "string"
+ },
+ "status": {
+ "default": "all",
+ "description": "Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.\n\n* `all` - all\n* `valid` - valid\n* `invalid` - invalid",
+ "enum": ["all", "valid", "invalid"],
+ "type": "string"
+ }
+ },
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-retrieve.json
new file mode 100644
index 000000000000..2141e0070472
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/error-tracking-symbol-sets-retrieve.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A UUID string identifying this error tracking symbol set.",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}