Skip to content

Commit 8a6e93d

Browse files
committed
Add documentation for the access_mcp_resource tool and its functionality
1 parent cedfaa8 commit 8a6e93d

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# access_mcp_resource
2+
3+
The `access_mcp_resource` tool retrieves data from resources exposed by connected Model Context Protocol (MCP) servers. It allows Roo to access files, API responses, documentation, or system information that provides additional context for tasks.
4+
5+
## Parameters
6+
7+
The tool accepts these parameters:
8+
9+
- `server_name` (required): The name of the MCP server providing the resource
10+
- `uri` (required): The URI identifying the specific resource to access
11+
12+
## What It Does
13+
14+
This tool connects to MCP servers and fetches data from their exposed resources. Unlike `use_mcp_tool` which executes actions, this tool specifically retrieves information that serves as context for tasks.
15+
16+
## When is it used?
17+
18+
- When Roo needs additional context from external systems
19+
- When Roo needs to access domain-specific data from specialized MCP servers
20+
- When Roo needs to retrieve reference documentation hosted by MCP servers
21+
- When Roo needs to integrate real-time data from external APIs via MCP
22+
23+
## Key Features
24+
25+
- Retrieves both text and image data from MCP resources
26+
- Requires user approval before executing resource access
27+
- Uses URI-based addressing to precisely identify resources
28+
- Integrates with the Model Context Protocol SDK
29+
- Displays resource content appropriately based on content type
30+
- Supports timeouts for reliable network operations
31+
- Handles server connection states (connected, connecting, disconnected)
32+
- Discovers available resources from connected servers
33+
- Processes structured response data with metadata
34+
- Handles image content special rendering
35+
36+
## Limitations
37+
38+
- Depends on external MCP servers being available and connected
39+
- Limited to the resources provided by connected servers
40+
- Cannot access resources from disabled servers
41+
- Network issues can affect reliability and performance
42+
- Resource access subject to configured timeouts
43+
- URI formats are determined by the specific MCP server implementation
44+
- No offline or cached resource access capabilities
45+
46+
## How It Works
47+
48+
When the `access_mcp_resource` tool is invoked, it follows this process:
49+
50+
1. **Connection Validation**:
51+
- Verifies that an MCP hub is available and initialized
52+
- Confirms the specified server exists in the connection list
53+
- Checks if the server is disabled (returns an error if it is)
54+
55+
2. **User Approval**:
56+
- Presents the resource access request to the user for approval
57+
- Provides server name and resource URI for user verification
58+
- Proceeds only if the user approves the resource access
59+
60+
3. **Resource Request**:
61+
- Uses the Model Context Protocol SDK to communicate with servers
62+
- Makes a `resources/read` request to the server through the MCP hub
63+
- Applies configured timeouts to prevent hanging on unresponsive servers
64+
65+
4. **Response Processing**:
66+
- Receives a structured response with metadata and content arrays
67+
- Processes text content for display to the user
68+
- Handles image data specially for appropriate display
69+
- Returns the processed resource data to Roo for use in the current task
70+
71+
## Resource Types
72+
73+
MCP servers can provide two main types of resources:
74+
75+
1. **Standard Resources**:
76+
- Fixed resources with specific URIs
77+
- Defined name, description, and MIME type
78+
- Direct access without parameters
79+
- Typically represent static data or real-time information
80+
81+
2. **Resource Templates**:
82+
- Parameterized resources with placeholder values in URIs
83+
- Allow dynamic resource generation based on provided parameters
84+
- Can represent queries or filtered views of data
85+
- More flexible but require additional URI formatting
86+
87+
## Examples When Used
88+
89+
- When helping with API development, Roo retrieves endpoint specifications from MCP resources to ensure correct implementation.
90+
- When assisting with data visualization, Roo accesses current data samples from connected MCP servers.
91+
- When working in specialized domains, Roo retrieves technical documentation to provide accurate guidance.
92+
- When generating industry-specific code, Roo references compliance requirements from documentation resources.
93+
94+
## Usage Examples
95+
96+
Accessing current weather data:
97+
```
98+
<access_mcp_resource>
99+
<server_name>weather-server</server_name>
100+
<uri>weather://san-francisco/current</uri>
101+
</access_mcp_resource>
102+
```
103+
104+
Retrieving API documentation:
105+
```
106+
<access_mcp_resource>
107+
<server_name>api-docs</server_name>
108+
<uri>docs://payment-service/endpoints</uri>
109+
</access_mcp_resource>
110+
```
111+
112+
Accessing domain-specific knowledge:
113+
```
114+
<access_mcp_resource>
115+
<server_name>knowledge-base</server_name>
116+
<uri>kb://medical/terminology/common</uri>
117+
</access_mcp_resource>
118+
```
119+
120+
Fetching system configuration:
121+
```
122+
<access_mcp_resource>
123+
<server_name>infra-monitor</server_name>
124+
<uri>config://production/database</uri>
125+
</access_mcp_resource>
126+
```

0 commit comments

Comments
 (0)