About netra-mcp-usage
Netra MCP Usage is a skill for querying Netra traces and sessions with schema-correct inputs. It guides trace investigation from filtered, paginated searches to span inspection and incident triage.
Key features
- 01Time-range trace queries with filters
- 02Sorting and cursor-based pagination
- 03Full span-tree retrieval by trace ID
- 04Session details and aggregate totals
- 05Incident investigation workflow
Use cases
- 01Finding error traces during an incident
- 02Investigating a slow or costly trace
- 03Reviewing all traces in a session
MCP support
The skill guides use of Netra MCP tools for querying traces, retrieving trace spans, and looking up session details.
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ keyvaluesoftwaresystems/ netra-skills --skill netra-mcp-usageAfter installing, type/netra-mcp-usagein Claude Code to confirm it loaded.
Details
From the project READMENetra 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.
- Retrieve session-level details and all traces belonging to a session.
- Guide incident/debug workflows from trace search to root-cause analysis.
Primary MCP Tools
netra_query_tracesnetra_get_trace_by_idnetra_get_session_details
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.
- Use
get_session_detailswhen you need all traces for a session or want session-level cost/token totals.
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.
get_session_details Input Schema
Provide exactly one of:
session_id(string, optional): The session ID to retrieve.trace_id(string, optional): A trace ID belonging to the target session. The parent session will be resolved automatically.
Providing neither or both is an error.
Optional:
startTime(string, ISO 8601): Start of the time range. Defaults to the organization's data retention window.endTime(string, ISO 8601): End of the time range. Defaults to now.include_raw_inputs(boolean, default false): If true, include full span details for each trace. Can produce large responses.limit(number, 1-100, default 50): Max traces to return per page.cursor(string): Pagination cursor from a previous response.
Behavior Notes
- Traces within the session are sorted by
start_timeascending. statusiserroredif any trace in the session hashas_error=true, otherwisecompleted.totalsaggregate cost, input tokens, and output tokens across all returned traces.- Pagination works identically to
query_traces: pass the returnedcursorto fetch the next page.
Session Lookup Patterns
- By session ID:
session_id: <session-id>
- By trace ID (auto-resolves to its parent session):
trace_id: <trace-id>
- With full span trees:
session_id: <session-id>,include_raw_inputs: true
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.
- If the failing trace belongs to a multi-turn session, call
get_session_detailswith thetrace_idto see all related traces, aggregate cost, and whether other turns also errored.
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.
- When you have a
trace_idbut need the full session context, useget_session_detailswithtrace_idinstead of manually filteringquery_tracesbysession_id. - Use
include_raw_inputs: truesparingly — it fetches full span trees for every trace in the session, which can be very large. - Check
session.statusto quickly determine whether any trace in the session errored without scanning each trace individually.
Comments
Markdown supported