GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [FEATURE]: Forward request-scoped MCP _meta from incoming opencode requests to downstream MCP tool calls · Issue #16828 · anomalyco/opencode

[FEATURE]: Forward request-scoped MCP _meta from incoming opencode requests to downstream MCP tool calls #16828

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[FEATURE]: Forward request-scoped MCP _meta from incoming opencode requests to downstream MCP tool calls#16828
Copy link
Assignees
thdxr
Labels
bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Description

@Rajmehta123
Rajmehta123
opened on Mar 10, 2026
Issue body actions

Issue Summary

When opencode invokes downstream MCP tools, it appears not to forward request-scoped _meta metadata received from upstream clients.

This breaks a common Model Context Protocol (MCP) pattern where hidden runtime context is passed through _meta and propagated unchanged across tool calls.

Typical flow:

UI → opencode → downstream MCP server

The UI may attach contextual metadata in _meta, such as:

  • documentId
  • containerId
  • workspaceId
  • session/auth context
  • tracing information

However, when opencode calls a downstream tool, this metadata is not preserved, causing the downstream MCP server to lose important request context.


MCP Design Pattern

MCP intentionally separates tool inputs from runtime metadata:

Field Purpose
arguments Inputs the model reasons about
_meta Hidden runtime/application context

This enables:

  • keeping sensitive IDs hidden from the LLM
  • preventing the model from inventing internal IDs
  • passing workspace/session context
  • propagating distributed tracing data
  • sending runtime hints to tools

Downstream MCP servers may use or ignore _meta safely.


Expected Behavior

If _meta is included in an incoming request to opencode:

  1. opencode captures _meta
  2. _meta is stored in request-scoped context
  3. all downstream tools/call requests forward the same _meta

Key properties:

  • _meta remains optional
  • existing behavior unchanged if _meta is absent
  • tool arguments remain separate from metadata

Example

Incoming request (UI → opencode)

{
  "method": "tools/call",
  "params": {
    "name": "docuai_agent_tool",
    "arguments": {
      "user_request": {
        "user_input": "Translate this document to French"
      }
    },
    "_meta": {
      "com.example/documentId": "doc_123",
      "com.example/containerId": "cont_456"
    }
  }
}

Expected downstream call (opencode → MCP server)

{
  "method": "tools/call",
  "params": {
    "name": "translate_document_preserving_structure",
    "arguments": {
      "destinationLanguageThreeLetterCode": "fra"
    },
    "_meta": {
      "com.example/documentId": "doc_123",
      "com.example/containerId": "cont_456"
    }
  }
}

FastMCP Compatibility

FastMCP servers already support accessing metadata through:

ctx.request_context.meta

So the missing piece appears to be client-side propagation in opencode, not server support.


Requested Change

Add request-scoped _meta propagation in opencode so that:

  • _meta from upstream requests is captured
  • it persists through the agent execution lifecycle
  • it is forwarded in all downstream tools/call requests

Why This Matters

Forwarding _meta enables reliable context propagation for:

  • document identifiers
  • workspace/container context
  • session/auth hints
  • distributed tracing

while keeping this data hidden from the LLM-visible tool schema.

Activity

  1. Rajmehta123
    added
    bugSomething isn't working
    on Mar 10, 2026
  2. github-actions
    assigned
    thdxr
    on Mar 10, 2026
  3. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 10, 2026
  4. github-actions commented on Mar 10, 2026

    @github-actions
    github-actionsBot
    on Mar 10, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue appears to be AI-generated. It contains an extremely long, over-structured description with multiple elaborate sections, JSON examples, tables, and even ends with an offer to produce a shorter version — a clear sign of AI-generated content. We do not accept AI-generated walls of text as issue reports.
    • This is filed as a bug but describes a feature/enhancement request. If this is a feature request, the title should start with [FEATURE]: and the feature request template should be used.
    • Steps to reproduce is empty. Bug reports must include reproduction steps or at minimum some context demonstrating the behavior exists.
    • The OS field lists "macOS 26.0.1" which does not exist, suggesting the content was not carefully reviewed before submission.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  5. github-actions
    added
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 10, 2026
  6. Rajmehta123
    changed the title [-]Forward request-scoped MCP _meta from incoming opencode requests to downstream MCP tool calls[/-] [+][FEATURE]: Forward request-scoped MCP _meta from incoming opencode requests to downstream MCP tool calls[/+] on Mar 10, 2026
  7. github-actions commented on Mar 10, 2026

    @github-actions
    github-actionsBot
    on Mar 10, 2026 – with GitHub Actions
    Contributor
    More actions

    Thank you for updating the title to use the [FEATURE]: prefix. However, this issue is still not compliant.

    What still needs to be fixed:

    • AI-generated wall of text: The description is an extremely long, over-structured document with elaborate section headers, multiple JSON examples, tables, repeated explanations of the same concept, and formal acceptance criteria. This is not acceptable. The note at the very end of the issue — offering to produce "a much shorter maintainer-friendly GitHub issue (~200 words)" — directly confirms this was AI-generated and not carefully reviewed before submission.

    Please rewrite the issue in your own words, briefly and clearly. A short description (2–5 sentences) explaining what the problem is, what you expected, and what you observed is all that is needed. The ~200-word version you mentioned would be far more appropriate.

  8. github-actions commented on Mar 10, 2026

    @github-actions
    github-actionsBot
    on Mar 10, 2026 – with GitHub Actions
    Contributor
    More actions

    Thank you for updating the title to use the [FEATURE]: prefix. However, this issue is still not compliant.

    What still needs to be fixed:

    • AI-generated wall of text: The description body has not been rewritten. It remains an extremely long, over-structured document with elaborate section headers, multiple JSON examples, tables, and repeated explanations of the same concept. The note at the very end offering to produce "a much shorter maintainer-friendly GitHub issue (~200 words)" is still present and directly confirms this was AI-generated content that was not reviewed or rewritten before submission.

    Please rewrite the issue body in your own words. A short description of 2–5 sentences explaining what the problem is, what you expected, and what you observed is all that is needed. The ~200-word version you mentioned would be far more appropriate.

  9. Rajmehta123 commented on Mar 10, 2026

    @Rajmehta123
    Rajmehta123
    on Mar 10, 2026
    Author
    More actions

    @thdxr @palmamartin @vvarp @ndarilek Thank you for this amazing repo. Recommendation appreciated. I believe the summary of the feature is important to understand why _meta which is a standard in MCP metadata injection and how it can help in opencode

  10. github-actions commented on Mar 10, 2026

    @github-actions
    github-actionsBot
    on Mar 10, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

  11. github-actions
    removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 10, 2026
  12. github-actions
    closed this as not plannedon Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.