Netra MCP Usage
Use this skill when you need to inspect traces through Netra MCP tools and want precise, schema-correct inputs.
Scope
- Query traces in a time range with filtering, sorting, and cursor pagination.
- Retrieve full span trees for a selected trace id.
- Guide incident/debug workflows from trace search to root-cause analysis.
Primary MCP Tools
netra_query_tracesnetra_get_trace_by_id
Workflow
- Start with a narrow time window and low limit.
- Add the minimum filters needed to isolate relevant traces.
- Sort for your objective (recent, slowest, most expensive, errors).
- Page through results using returned cursor values.
- Fetch full spans for one trace id.
- Inspect hierarchy, status, latency, and attributes.
query_traces Input Schema
Required:
startTime(string, ISO 8601)endTime(string, ISO 8601)
Optional:
limit(number, 1-100, default 20)cursor(string)direction(up|down, defaultdown)sortFieldsortOrder(asc|desc, defaultdesc)filters(array of filter objects)
sortField Values
latency_msnametotal_costhas_piihas_violationstart_timeenvironmentservicehas_errortotal_tokens
Filter Object Schema
Each filter object must include:
fieldvaluetypeoperator
Optional in filter object:
key(for nested/object-style filtering)
field Values
nametenant_iduser_idsession_idenvironmentservicemetadataprojectIdsproject_idparent_span_idhas_piihas_violationhas_errormodelstotal_costlatency
type Values
stringnumberbooleanarrayOptionsattributeKeyobject
operator Values
equalsgreater_thanless_thangreater_equal_toless_equal_tocontainsnot_equalsany_ofnone_ofnot_containsstarts_withends_withis_nullis_not_null
Filter Patterns
- Error traces only:
- field: has_error, type: boolean, operator: equals, value: true
- Specific session:
- field: session_id, type: string, operator: equals, value: <session-id>
- High latency:
- field: latency, type: number, operator: greater_than, value: 3000
- Service scoped:
- field: service, type: string, operator: equals, value: <service-name>
- Metadata key/value:
- field: metadata, type: object, key: <metadata-key>, operator: equals, value: <value>
Pagination Pattern
- Run
query_traceswithoutcursor. - Capture a
cursorfrom returned trace items. - Re-run
query_traceswith the cursor anddirection: down. - Continue while
pageInfo.hasNextPageis true.
get_trace_by_id Input Schema
Required:
traceId(string)
Behavior:
- Returns complete span array for the trace id.
- Use this after
query_tracesto inspect one trace deeply. - Invalid ids return a not-found style error.
Incident Triage Recipe
- Query for failing traces (
has_error=true) in the incident window. - Sort by
latency_msdesc to identify worst requests. - Pull one trace via
get_trace_by_id. - Validate root span presence and parent-child span flow.
- Check slow spans and tool/model metadata.
- Compare with a nearby successful trace if needed.
Practical Tips
- Keep initial windows short (5-30 minutes) for faster narrowing.
- Use one or two filters first, then add more only if needed.
- Prefer exact-match IDs (
session_id,user_id,tenant_id) when available. - Use
sortField=total_costto find expensive traces quickly. - If no results: widen time range first, then relax filters.