access_mcp_resource
The access_mcp_resource tool is used to retrieve data from resources exposed by connected Model Context Protocol (MCP) servers. It enables VJSP to access files, API responses, documents, or system information, providing supplementary context for task execution.
Parameter Description
This tool accepts the following parameters:
server_name(required): The name of the MCP server providing the target resourceuri(required): The Uniform Resource Identifier identifying the specific resource to access
Functional Positioning
This tool establishes connections with MCP servers to fetch data from their exposed resources. Unlike the operational use_MCP_tool tool, this tool is specifically designed to retrieve informational data that provides contextual support for tasks.
Applicable Scenarios
- When VJSP needs to obtain supplementary context from external systems
- When VJSP needs to retrieve domain-specific data from specialized MCP servers
- When VJSP needs to search reference documents hosted by MCP servers
- When VJSP needs to integrate real-time data from external APIs through MCP
Core Features
- Supports retrieving both text and image data from MCP resources
- Requires user authorization before performing resource access operations
- Achieves precise resource positioning based on URI addressing mechanism
- Deeply integrates with Model Context Protocol Software Development Kit (MCP SDK)
- Adapts resource content display based on content type
- Supports timeout configuration to ensure network operation reliability
- Compatible with multi-connection state handling (connected, connecting, disconnected)
- Supports discovering available resources from connected servers
- Can process structured response data with metadata
- Provides dedicated rendering logic for image content
Limitations
- Depends on the online status and connection validity of external MCP servers
- Can only access resources provided by connected servers
- Cannot access resources from disabled servers
- Network failures affect tool reliability and performance
- Resource access is limited by configured timeout duration
- URI format is defined by the specific MCP server's implementation logic
- Does not support offline access or cache reading capabilities for resources
Execution Flow
When calling the access_mcp_resource tool, the following process will be executed:
Connection Validity Verification
- Verify if the MCP hub node has been deployed and initialized
- Confirm if the specified server exists in the connection list
- Check if the server is disabled (if disabled, return an error directly)
User Operation Authorization
- Push a resource access request to the user and wait for authorization confirmation
- Display the server name and resource URI to be accessed for user verification
- Only proceed with subsequent operations after obtaining user authorization
Resource Request Initiation
- Communicate with the target server based on MCP SDK
- Initiate a
resources/readresource read request to the target server through the MCP hub node - Enable the configured timeout mechanism to avoid process blocking due to server unresponsiveness
Response Result Processing
- Receive structured response data containing metadata and content array
- Parse and process text content to adapt to user display scenarios
- Execute dedicated processing logic for image data to ensure display effect
- Return processed resource data to VJSP to support current task execution
Resource Types
MCP servers can provide two types of core resources:
Standard Resources
- Static resources with fixed URIs
- Contain predefined names, descriptions, and Multipurpose Internet Mail Extensions (MIME Type)
- Support direct access without parameters
- Usually used to host static data or real-time updated basic information
Resource Templates
- Parameterized resources containing placeholders in URIs
- Support dynamically generating resource content based on incoming parameters
- Can be used to implement data query or filter views
- More flexible but requires following additional URI formatting rules
Practical Application Scenarios
- When assisting with API development, VJSP retrieves interface specifications from MCP resources to ensure implementation logic accuracy
- When assisting with data visualization, VJSP obtains the latest data samples from connected MCP servers
- When handling professional domain tasks, VJSP searches technical documents to provide precise guidance for operations
- When generating industry-specific code, VJSP references compliance requirements in document resources to ensure code meets industry specifications
Usage Examples
Access real-time weather data
<access_mcp_resource>
<server_name>weather-server</server_name>
<uri>weather://san-francisco/current</uri>
</access_mcp_resource>Retrieve API documentation
<access_mcp_resource>
<server_name>api-docs</server_name>
<uri>docs://payment-service/endpoints</uri>
</access_mcp_resource>Access domain-specific knowledge base
<access_mcp_resource>
<server_name>knowledge-base</server_name>
<uri>kb://medical/terminology/common</uri>
</access_mcp_resource>Obtain system configuration information
<access_mcp_resource>
<server_name>infra-monitor</server_name>
<uri>config://production/database</uri>
</access_mcp_resource>