Background
When an LLM calls sigrok-mcp-server tools, every token in the response consumes context window budget. Several tools return large unfiltered datasets that waste tokens.
Current State
list_supported_hardware (handlers.go:71-74) — returns ALL 160+ drivers, no filtering
list_supported_decoders (handlers.go:76-79) — returns ALL 110+ decoders, no filtering
list_input_formats / list_output_formats — returns complete lists (smaller, ~10-20 items)
show_decoder_details (handlers.go:104-124) — includes full multi-line documentation text
show_driver_details (handlers.go:126-146) — includes both parsed fields AND RawOutput
decode_protocol (handlers.go:310-382) — returns potentially megabytes of raw decoded text
- All list tools call
sigrok-cli -L and parse sections via runListSection (handlers.go:91-102)
Problem
- An LLM looking for "spi" decoder gets all 110+ decoders dumped into context
- Driver details include redundant
RawOutput field alongside parsed data
decode_protocol output can be extremely large with no truncation or summary
- No tool supports filtering by keyword, limiting results, or pagination
Proposed Changes
- Add optional
filter string parameter to list_supported_hardware and list_supported_decoders
- Filter by substring match on id and description
- Remove
RawOutput field from DriverDetails response (parsed data is sufficient)
- Add optional
include_documentation boolean to show_decoder_details (default: false)
- Add
max_lines or limit parameter to decode_protocol for truncating large outputs
- Include result count in all list responses so LLM knows the full dataset size
Acceptance Criteria
Affected Files
internal/tools/tools.go — add filter/limit params to tool definitions
internal/tools/handlers.go — implement filtering logic
internal/sigrok/parser.go — update DriverDetails struct (remove RawOutput)
internal/tools/handlers_test.go — update tests
Background
When an LLM calls sigrok-mcp-server tools, every token in the response consumes context window budget. Several tools return large unfiltered datasets that waste tokens.
Current State
list_supported_hardware(handlers.go:71-74) — returns ALL 160+ drivers, no filteringlist_supported_decoders(handlers.go:76-79) — returns ALL 110+ decoders, no filteringlist_input_formats/list_output_formats— returns complete lists (smaller, ~10-20 items)show_decoder_details(handlers.go:104-124) — includes full multi-line documentation textshow_driver_details(handlers.go:126-146) — includes both parsed fields ANDRawOutputdecode_protocol(handlers.go:310-382) — returns potentially megabytes of raw decoded textsigrok-cli -Land parse sections viarunListSection(handlers.go:91-102)Problem
RawOutputfield alongside parsed datadecode_protocoloutput can be extremely large with no truncation or summaryProposed Changes
filterstring parameter tolist_supported_hardwareandlist_supported_decodersRawOutputfield fromDriverDetailsresponse (parsed data is sufficient)include_documentationboolean toshow_decoder_details(default: false)max_linesorlimitparameter todecode_protocolfor truncating large outputsAcceptance Criteria
list_supported_hardwareandlist_supported_decodersaccept optionalfilterparamshow_driver_detailsno longer returnsRawOutputshow_decoder_detailsdocumentation is opt-indecode_protocolsupports output size limitingAffected Files
internal/tools/tools.go— add filter/limit params to tool definitionsinternal/tools/handlers.go— implement filtering logicinternal/sigrok/parser.go— updateDriverDetailsstruct (removeRawOutput)internal/tools/handlers_test.go— update tests