Skip to content

It seems I'm unable to access the file sample.txt #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ceeyangwen opened this issue Apr 24, 2025 · 3 comments
Closed

It seems I'm unable to access the file sample.txt #584

ceeyangwen opened this issue Apr 24, 2025 · 3 comments
Labels
question Question about using the SDK

Comments

@ceeyangwen
Copy link

Hi,
I used FileSystem MCP to connect my local file. But when I try to answer file content about the file, then the result will report
"It seems I'm unable to access the file sample.txt. Could you specify a path within the allowed directories, or provide the contents of the file here?"

And I could list all files by MCP server. So If i want to access the file content, how should I do .
Thanks

Image Image
@ceeyangwen ceeyangwen added the question Question about using the SDK label Apr 24, 2025
@rm-openai
Copy link
Collaborator

Could you share some code? What model are you using?

@ceeyangwen
Copy link
Author

Could you share some code? What model are you using?
Thanks for reply. I used MCP File system in Agent on my code. Then I used another way to solution this problem. The way is using absolute path to indicate which file I want to visit, that works in my code
Here is old code
async with MCPServerStdio( name="File system MCP Service", params={ "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", /users/user/tmp ] }, ) as file_server: agent = Agent( name="Assistant", model="gpt-4o", instructions=''' I want to ask some question about sample.txt ''', mcp_servers=[file_server], )
it will failed first. then I changed the path to absolute path: /users/user/tmp/sample.txt in instructions, then it works

@rm-openai
Copy link
Collaborator

Got it. Yeah absolute path makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about using the SDK
Projects
None yet
Development

No branches or pull requests

2 participants