Skip to content

Expose static reference data as MCP Resources instead of Tools #30

Description

@key

Background

MCP Resources are designed for static/reference data that clients can cache and browse, while Tools are for actions with side effects or dynamic computation. Currently, several tools return large static datasets on every call.

Current State

  • Device profiles are already registered as Resources (tools.go:125-156, URI device://<id>)
  • Resource capabilities: (false, false) — no templates, no subscriptions (main.go:28)
  • The following tools return static reference data but are registered as Tools:
    • show_decoder_details (tools.go:30-36, handlers.go:104-124) — full decoder documentation
    • show_driver_details (tools.go:38-44, handlers.go:126-146) — full driver details + raw output

Problem

  • LLMs calling these tools consume tokens for data that is essentially static documentation
  • MCP clients cannot cache Tool results, but can cache Resource contents
  • Decoder/driver details are reference data, not actions — semantically they belong as Resources

Proposed Changes

  1. Register decoder details as Resources with URI decoder://<id> (e.g. decoder://uart)
  2. Register driver details as Resources with URI driver://<id> (e.g. driver://demo)
  3. Keep the existing Tools as convenience wrappers (backward compatibility) or deprecate them
  4. Enable resource list capabilities: change WithResourceCapabilities(false, false) to (true, false) if resource templates are used

Acceptance Criteria

  • Decoder details available as decoder://<id> MCP Resources
  • Driver details available as driver://<id> MCP Resources
  • Existing device profile resources still work
  • Tests cover new resource registration and read handlers

Affected Files

  • internal/tools/tools.go — add resource registration
  • cmd/sigrok-mcp-server/main.go — update resource capabilities
  • internal/tools/tools_test.go — add tests

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