-
Notifications
You must be signed in to change notification settings - Fork 320
Description
list_resources() does not return all fields:
🧪 TEST 1: COMPARISON - FastAgent vs Raw MCP for utils-mcp
======================================================================
📋 TEST 1A: agent.list_resources(server_name='utils-mcp') [FastAgent processed]
------------------------------------------------------------
📊 COMPLETE RAW RESPONSE FROM FASTAGENT:
==================================================
{'utils-mcp': ['utils://date']}
==================================================
Response Type: <class 'dict'>
Response Length: 1
Dict Keys: ['utils-mcp']
Key 'utils-mcp': <class 'list'> = ['utils://date']
Item 0: <class 'str'> = utils://date
🔧 TEST 1B: agent._execute_on_server() [Raw MCP call]
------------------------------------------------------------
📊 COMPLETE RAW RESPONSE FROM MCP SERVER:
==================================================
ListResourcesResult(meta=None, nextCursor=None, resources=[Resource(name='get_current_date', title=None, uri=AnyUrl('utils://date'), description="Get the current day of week and date in the format of '%A, %Y-%m-%d'", mimeType='text/plain', size=None, annotations=None, meta=None)])
==================================================
Response Type: <class 'mcp.types.ListResourcesResult'>
Object Attributes: ['construct', 'copy', 'dict', 'from_orm', 'json', 'meta', 'model_computed_fields', 'model_config', 'model_construct', 'model_copy', 'model_dump', 'model_dump_json', 'model_extra', 'model_fields', 'model_fields_set', 'model_json_schema', 'model_parametrized_name', 'model_post_init', 'model_rebuild', 'model_validate', 'model_validate_json', 'model_validate_strings', 'nextCursor', 'parse_file', 'parse_obj', 'parse_raw', 'resources', 'schema', 'schema_json', 'update_forward_refs', 'validate']
meta: None
nextCursor: None
resources: (type: <class 'list'>, length: 1)
RESOURCE #1:
----------------------------------------
Full Resource Object:
Resource(name='get_current_date', title=None, uri=AnyUrl('utils://date'), description="Get the current day of week and date in the format of '%A, %Y-%m-%d'", mimeType='text/plain', size=None, annotations=None, meta=None)
----------------------------------------
Object Type: <class 'mcp.types.Resource'>
URI: utils://date (type: <class 'pydantic.networks.AnyUrl'>)
Description: "Get the current day of week and date in the format of '%A, %Y-%m-%d'" (type: <class 'str'>)
Name: 'get_current_date' (type: <class 'str'>)
MimeType: 'text/plain' (type: <class 'str'>)
I would like to do a PR that fixes this (the description is very important to have for prompt injection). Internally, only the uri is retained.
This would likely be a breaking change, as anything using list_resources() would need to handle a different return type
Options:
- implement breaking change that changes the return type of list_resources and return all fields (then we have the discussion on whether to cache the whole thing internally, or just the URI as it does currently)
- add another method, list_resources_full() or similar so that there are no breaking changes
- open to other ideas as well
related:
modelcontextprotocol/python-sdk#141
This outlines that there is an issue with the mcp python-sdk that does not expose resource templates properly. This ticket says that the feature was merged, but in my tests with fast-agent/fast-mcp even raw MCP calls do not show resource templates
EDIT: More information
modelcontextprotocol/python-sdk@0d3e02f
theMCP python SDK has a separate list_resource_templates. As part of this ticket, Fast Agent should get a matching list_resource_templates() method (raw mcp call to list_resource_templates works great)