Skip to content

[FEATURE]:model-invoked MCP resources #8928

@dan-kwiat

Description

@dan-kwiat

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

It's great to see MCP resources added (#6542). This means users can now pull resources from connected servers into context by tagging them with @ (human-invoked).

However, to get the most out of MCP resources, the model needs the ability to read resources itself (model-invoked). It's like the difference between a user attaching a couple of handpicked files to their prompt vs them connecting the model to a Skill directory and giving the model free rein to list and read files in that directory. Other agents including claude code already have model-invoked resources.

The implementation is simple, the LLM just needs two global tools: readMcpResource and listMcpResources. These trigger the corresponding methods already defined in https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/mcp/index.ts

In my experience this implementation alone leads to very good performance without additional system instruction. Ideally it should be user configurable whether or not the results of listMcpResources goes into the system instruction upfront or not.

The next stage would be to think about list changed notifications, subscriptions and resource templates, but the first steps above would go a long way to improving the developer experience without much investment.

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions