Skip to content

feat(mcp): issue short-lived HTTP GET URLs for rendered timeline PNGs - #1198

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-qkzxpxuqsqpk
Oct 30, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-qkzxpxuqsqpk

Conversation

@kyasbal

@kyasbal kyasbal commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Part of #1193

Summary

The render_timelines MCP tool previously returned rendered timeline screenshots solely as inline image/png tool content. While MCP clients display inline images in the model's context window, they do not expose the binary payload to an agent's shell or file tools, preventing agents from embedding rendered timelines in Markdown reports (![](...)), saving PNG files alongside writeups, or uploading screenshots to external documents.

This change introduces an in-memory TTL store for MCP-generated assets (mcp.AssetStore, 30-minute TTL, analogous to request_file_upload) and exposes a short-lived HTTP GET/HEAD endpoint at /api/v1/mcp-assets/:fileName. Every render_timelines response now issues an image/png asset URL (/api/v1/mcp-assets/<token>.png) and includes the URL, its expiration timestamp, and ready-to-use Markdown embed and curl download snippets alongside the inline ImageContent.

UI / Output Changes

Sample render_timelines Markdown text output
# Rendered timeline view

Rendered 8 of 8 matched timelines (1600x460 px, 2026-09-24T01:00:00Z to 2026-09-24T02:00:00Z).

- Image URL: `http://127.0.0.1:8080/api/v1/mcp-assets/ABCDEF.png`
- Expires at: 2026-09-24T02:30:00Z

Embed the image in Markdown (`![Timeline](http://127.0.0.1:8080/api/v1/mcp-assets/ABCDEF.png)`) or download the PNG before it expires:

```sh
curl --fail-with-body -o timeline.png 'http://127.0.0.1:8080/api/v1/mcp-assets/ABCDEF.png'
```

## Applied filter
Enter these values in the KHI Web UI filter to see the same data.

```yaml
timelineQuery: |-
  timelineType == "Pod"
timelineExclusionQuery: ""
logQuery: |-
  severity >= WARNING
startTime: 2026-09-24T01:00:00Z
endTime: 2026-09-24T02:00:00Z
excludeTimelinesWithoutLogs: true
```
@kyasbal kyasbal added type:feature New feature or request area:backend-core Core backend frameworks, DAG task runner, and server API labels Oct 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an in-memory RenderedTimelineStore with TTL support to serve rendered timeline PNG images over HTTP GET and HEAD endpoints. It integrates this store into the MCP server initialization and updates the render_timelines tool to return a short-lived image URL and expiration metadata in its Markdown summary. All associated tests, templates, and handlers have been updated to support this new functionality. No review comments were provided, so there is no additional feedback to address.

@kyasbal
kyasbal added this pull request to the merge queue Oct 30, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 95b6498 Oct 30, 2026
17 checks passed
@kyasbal
kyasbal deleted the push-qkzxpxuqsqpk branch October 30, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend-core Core backend frameworks, DAG task runner, and server API type:feature New feature or request

1 participant