Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  client.py   Sprache: Python

 

"""Expose two filesystem roots and verify the server's tool can read them back."""

from pydantic import FileUrl

from mcp.client import Client, ClientRequestContext
from mcp.types import ListRootsResult, Root, TextContent
from stories._harness import Target, run_client


async def list_roots(context: ClientRequestContext) -> ListRootsResult:
    return ListRootsResult(
        roots=[
            Root(uri=FileUrl("file:///workspace/project"), name="project"),
            Root(uri=FileUrl("file:///workspace/scratch")),
        ]
    )


async def main(target: Target, *, mode: str = "auto") -> None:
    async with Client(target, mode=mode, list_roots_callback=list_roots) as client:
        result = await client.call_tool("show_roots", {})

        assert not result.is_error, result
        assert isinstance(result.content[0], TextContent)
        assert result.content[0].text == ("file:///workspace/project (project)\nfile:///workspace/scratch (unnamed)"), (
            result.content[0].text
        )


if __name__ == "__main__":
    run_client(main)

Messung
CHZG
879710094

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,305
#Domains=919,449