aws / aws/amazon-q-developer-cli

Add support for MCP resources

Open
#1,462 3 comments 15 reactions 0 assignees View on GitHub
MCP Roadmap
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

MacOS

### Expected behaviour

Request
```
Use awslabsbedrock_kb_retrieval_mcp_server, fetch the `resource://knowledgebases` resource to get valid knowledge base IDs
```

Response
```
{"STXXXX88X": {"name": "some-kb-name", "data_sources": [{"id": "FBYXXXXJ5", "name": "some-kb-name-source"}, {"id": "TYXXXXXJK", "name": "some-kb-name-metadata-source"}]}
```

### Actual behaviour

Request
```
Use awslabsbedrock_kb_retrieval_mcp_server, fetch the `resource://knowledgebases` resource to get valid knowledge base IDs
```

Response

```
🛠️ Using tool: QueryKnowledgeBases (trusted) from mcp server awslabsbedrock_kb_retrieval_mcp_server

● Running QueryKnowledgeBases with the param:
⋮ {
⋮ "arguments": {
⋮ "knowledge_base_id": "resource://knowledgebases",
⋮ "query": "list all available knowledge bases"
⋮ },
⋮ "name": "QueryKnowledgeBases"
⋮ }

● Completed in 0.41s
```

### Steps to reproduce

- Install [Amazon Bedrock Knowledge Base Retrieval MCP Server](https://awslabs.github.io/mcp/servers/bedrock-kb-retrieval-mcp-server/)
- Configure mcp.json with the correct AWS account profile
- Start `q chat`
- Ensure MCP Servers loaded successfully
- Execute the prompts

### Environment

```yaml

```

### Possible Root Cause

I've identified the implementation gap in MCP resource handling. While the codebase has the data structures and types defined for resources in facilitator_types.rs:
```
pub struct Resource {
pub uri: String,
pub title: String,
pub description: Option,
pub contents: ResourceContents,
}
```
And support for resource listing operations:
```
pub struct ResourcesListResult {
pub resources: Vec,
pub next_cursor: Option
}
```
There appears to be a missing implementation for actually reading/accessing resources. Specifically:

Missing Implementation:
- No handler for resources/read operation
- No implementation for resource URI resolution
- No client-side method to request resource contents
- No equivalent to the CustomTool implementation that exists for tool calls

Required Implementation:
- Add a resources/read handler in the server implementation
- Implement resource request handling in the client
- Add resource access methods similar to tool invocation
- Create a resource request structure following the MCP specification

Current State:
- Tool calls work because they have a complete implementation path through CustomTool and the tool manager
- Resources have the data structures defined but lack the actual request/response handling implementation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.