Skip to content

MCP: Add success-path handler tests for timeline log and resource history tools #1126

Open

Description

@kyasbal

Part of #1049 / Follows up #1044

Summary

Add tests that call the 5 MCP tools from #1044 on a loaded workbench and check the successful responses. Today the handlers are tested only on error paths, and the success output is tested by calling the build*TemplateData helpers directly. This came from the #1044 code review and was moved here because it needs a new test fixture.

Tools

  • get_timeline_logs
  • get_log
  • get_resource_revisions
  • get_resource_manifest
  • get_resource_diff

What is missing

  • setupTestInspectionServer in pkg/server/mcp/workbench_handler_test.go runs an inspection with a dummy task, so the workbench has no timelines or logs. Handler tests can only reach argument checks and *_NOT_FOUND errors.
  • The following paths are not tested end to end:
    • Paging with pageToken through handleGetTimelineLogs and handleGetResourceRevisions.
    • Reading a truncated body in several calls with byteOffset through get_log, get_resource_manifest, and get_resource_diff.
    • byteOffset past the end of the body returning INVALID_ARGUMENT from the handlers. The check itself is unit tested in TestByteOffsetBeyondBodyResult.
    • REVISION_NOT_FOUND for an out-of-range revision index on an existing timeline.

Proposed approach

  • Add a test helper that builds an inspection with a few timelines, logs, and resource revisions. For example, run a task that writes a small fixed history, or load a small .khi file from testdata.
  • Add table-driven handler tests that compare the full Markdown response.

Acceptance criteria

  • A shared fixture gives the MCP handler tests a workbench with timelines, logs, and revisions.
  • Each of the 5 tools has at least one success-path test that compares the full response.
  • Paging and byteOffset continuation are tested through the handlers.

Related code

  • pkg/server/mcp/workbench_detail.go: the 5 handlers.
  • pkg/server/mcp/workbench_detail_test.go: TestWorkbenchHandler_DetailToolErrors.
  • pkg/server/mcp/workbench_handler_test.go: setupTestInspectionServer.

Activity

  1. added
    area:backend-core
    type:test
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backend-coretype:test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions