Skip to content

feat(m28): deterministic run queue overview (MCP tool) - #50

Merged
anschmieg merged 1 commit into
mainfrom
copilot/m28-queue-overview
Mar 18, 2026
Merged

anschmieg merged 1 commit into
mainfrom
copilot/m28-queue-overview

Conversation

@anschmieg

@anschmieg anschmieg commented Mar 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add the MCP tool for run queue overview to complete Milestone 28.

The daemon handler was already implemented in M24 (runs.overview), but the TypeScript MCP tool was missing. This PR adds:

  • GetQueueOverviewInput schema in schemas.ts
  • get_run_queue_overview tool registration in tools.ts

Verification

  • cargo build passes
  • cargo test passes
  • cargo clippy passes (deterministic packages)
  • TypeScript compiles

Related

Summary by Sourcery

Add a new MCP tool to expose a deterministic run queue overview backed by the existing daemon runs.overview handler.

New Features:

  • Introduce the GetQueueOverviewInput schema for configuring run queue overview queries.
  • Register the get_run_queue_overview MCP tool that proxies to the daemon runs.overview endpoint and returns a summarized queue overview.

Add get_run_queue_overview tool to the TypeScript MCP gateway.
The daemon handler was already implemented in M24.

- Add GetQueueOverviewInput schema
- Register get_run_queue_overview tool
- No backend autonomy added
Copilot AI review requested due to automatic review settings March 18, 2026 12:26
@sourcery-ai

sourcery-ai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implements the missing TypeScript MCP tool for the deterministic run queue overview by adding a zod-backed input schema and registering a new MCP tool that proxies to the existing daemon handler runs.overview.

Sequence diagram for the new get_run_queue_overview MCP tool

sequenceDiagram
    actor Agent
    participant McpServer
    participant Tool_get_run_queue_overview
    participant DaemonClient
    participant Daemon_runs_overview

    Agent->>McpServer: invoke get_run_queue_overview(params)
    McpServer->>Tool_get_run_queue_overview: dispatch with params
    Tool_get_run_queue_overview->>DaemonClient: call runs.overview
    DaemonClient->>Daemon_runs_overview: runs.overview(workspaceId, includeArchived, includeSnoozed, today)
    Daemon_runs_overview-->>DaemonClient: overviewSummary
    DaemonClient-->>Tool_get_run_queue_overview: overviewSummary
    Tool_get_run_queue_overview-->>McpServer: content[{type: text, text: JSON.stringify(overviewSummary)}]
    McpServer-->>Agent: tool result
Loading

Updated class diagram for MCP server, daemon client, and GetQueueOverviewInput

classDiagram
    class GetQueueOverviewInput {
        string workspaceId
        boolean includeArchived
        boolean includeSnoozed
        string today
    }

    class McpServer {
        +tool(name, description, inputSchema, handler)
    }

    class DaemonClient {
        +call(methodName, params) Promise
    }

    class ToolHandler_get_run_queue_overview {
        +handle(params) Promise
    }

    McpServer "1" o-- "many" ToolHandler_get_run_queue_overview : registers
    ToolHandler_get_run_queue_overview --> GetQueueOverviewInput : uses
    ToolHandler_get_run_queue_overview --> DaemonClient : calls
    DaemonClient --> Daemon_runs_overview : invokes

    class Daemon_runs_overview {
        +runs_overview(workspaceId, includeArchived, includeSnoozed, today) OverviewSummary
    }
Loading

File-Level Changes

Change Details Files
Define the TypeScript/Zod input schema for the run queue overview tool.
  • Introduce GetQueueOverviewInput with optional workspaceId, includeArchived, includeSnoozed, and today fields.
  • Apply validation and documentation: today must match YYYY-MM-DD and each field has a descriptive .describe() string.
apps/chatgpt-mcp/src/schemas.ts
Register the MCP tool that exposes the deterministic run queue overview and forwards calls to the daemon.
  • Import GetQueueOverviewInput into the tools module.
  • Register get_run_queue_overview on the MCP server with a detailed description and the new input schema.
  • Implement the handler to call the existing daemon method runs.overview with matching parameters and return the JSON-stringified result as text content.
apps/chatgpt-mcp/src/tools.ts

Possibly linked issues

  • #: PR wires the get_run_queue_overview MCP tool and schema, fulfilling the issue’s queue overview gateway requirements.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@anschmieg
anschmieg merged commit 68078a7 into main Mar 18, 2026
13 of 22 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the get_run_queue_overview tool handler you can pass params directly to client.call("runs.overview", ...) instead of re-listing each field, which will make it easier to keep the tool input and daemon call in sync if the schema changes.
  • The description string for get_run_queue_overview is quite long and enumerates many internal categories; consider shortening or referencing the daemon’s semantics instead of duplicating all categories to reduce future drift.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `get_run_queue_overview` tool handler you can pass `params` directly to `client.call("runs.overview", ...)` instead of re-listing each field, which will make it easier to keep the tool input and daemon call in sync if the schema changes.
- The description string for `get_run_queue_overview` is quite long and enumerates many internal categories; consider shortening or referencing the daemon’s semantics instead of duplicating all categories to reduce future drift.

## Individual Comments

### Comment 1
<location path="apps/chatgpt-mcp/src/schemas.ts" line_range="621-624" />
<code_context>
+
+/** Input schema for `get_run_queue_overview`. */
+export const GetQueueOverviewInput = {
+  workspaceId: z
+    .string()
+    .optional()
+    .describe("Filter by workspace path"),
+  includeArchived: z
+    .boolean()
</code_context>
<issue_to_address>
**suggestion:** Align `workspaceId` naming with its description of a workspace path.

If this value is actually a path (e.g. `/foo/bar`), consider renaming the field (for example to `workspacePath`). Otherwise, update the description so it clearly refers to an ID. This keeps the API contract unambiguous for callers.

Suggested implementation:

```typescript
/** Input schema for `get_run_queue_overview`. */
export const GetQueueOverviewInput = {
  workspacePath: z
    .string()
    .optional()
    .describe("Filter by workspace path"),

```

1. Update all usages of this schema where `GetQueueOverviewInput` is referenced so that they read `workspacePath` instead of `workspaceId` (e.g. request builders, handlers, and any TypeScript types inferred from this schema).
2. If this schema is serialized over the wire (e.g. JSON payloads), update the corresponding client/server contracts and tests to use `workspacePath` as the field name.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +621 to +624
workspaceId: z
.string()
.optional()
.describe("Filter by workspace path"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Align workspaceId naming with its description of a workspace path.

If this value is actually a path (e.g. /foo/bar), consider renaming the field (for example to workspacePath). Otherwise, update the description so it clearly refers to an ID. This keeps the API contract unambiguous for callers.

Suggested implementation:

/** Input schema for `get_run_queue_overview`. */
export const GetQueueOverviewInput = {
  workspacePath: z
    .string()
    .optional()
    .describe("Filter by workspace path"),
  1. Update all usages of this schema where GetQueueOverviewInput is referenced so that they read workspacePath instead of workspaceId (e.g. request builders, handlers, and any TypeScript types inferred from this schema).
  2. If this schema is serialized over the wire (e.g. JSON payloads), update the corresponding client/server contracts and tests to use workspacePath as the field name.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new MCP tool to expose the daemon’s runs.overview method through the TypeScript MCP gateway, including a new Zod input schema for filtering and overdue calculations.

Changes:

  • Register a new MCP tool get_run_queue_overview that calls the daemon method runs.overview.
  • Add GetQueueOverviewInput schema to validate tool parameters (workspace filter, includeArchived/includeSnoozed, optional today).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
apps/chatgpt-mcp/src/tools.ts Registers get_run_queue_overview MCP tool wired to daemon runs.overview.
apps/chatgpt-mcp/src/schemas.ts Introduces GetQueueOverviewInput Zod schema for the new tool’s parameters.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +636 to +639
// runs.overview (Milestone 24/28)
server.tool(
"get_run_queue_overview",
"Get a deterministic queue overview summary with compact counts: " +
Comment on lines +639 to +641
"Get a deterministic queue overview summary with compact counts: " +
"total visible runs, ready, blocked, deferred, done, attention, urgent, overdue, stale, pinned, assigned vs unassigned. " +
"This is a read-only inspection operation that derives summary counts from existing run state without mutating anything.",
Comment on lines +650 to +652
return {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
};
Comment on lines +633 to +637
today: z
.string()
.regex(/^\d{4}-\d{2}-\d{2}$/, "must be YYYY-MM-DD")
.optional()
.describe("ISO date for computing overdue counts"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants