mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 14:54:24 +01:00
docs: update read_resource examples to handle mime type
Update README examples to show proper handling of the new read_resource() return value that includes mime type information. Github-Issue:#152
This commit is contained in:
@@ -33,7 +33,7 @@ This document contains critical information about working with this codebase. Fo
|
||||
|
||||
- For commits related to a Github issue, add
|
||||
```bash
|
||||
git commit --trailer "Github-Issue:<number>"
|
||||
git commit --trailer "Github-Issue:#<number>"
|
||||
```
|
||||
- NEVER ever mention a `co-authored-by` or similar aspects. In particular, never
|
||||
mention the tool used to create the commit message or PR.
|
||||
|
||||
@@ -218,7 +218,7 @@ async def long_task(files: list[str], ctx: Context) -> str:
|
||||
for i, file in enumerate(files):
|
||||
ctx.info(f"Processing {file}")
|
||||
await ctx.report_progress(i, len(files))
|
||||
data = await ctx.read_resource(f"file://{file}")
|
||||
data, mime_type = await ctx.read_resource(f"file://{file}")
|
||||
return "Processing complete"
|
||||
```
|
||||
|
||||
@@ -436,7 +436,7 @@ async def run():
|
||||
tools = await session.list_tools()
|
||||
|
||||
# Read a resource
|
||||
resource = await session.read_resource("file://some/path")
|
||||
content, mime_type = await session.read_resource("file://some/path")
|
||||
|
||||
# Call a tool
|
||||
result = await session.call_tool("tool-name", arguments={"arg1": "value"})
|
||||
|
||||
Reference in New Issue
Block a user