Einen Tool-Aufruf von Anfang bis Ende verfolgen
Verfolgen Sie eine Anfrage durch den gesamten Stack.
Einen Tool-Aufruf von Anfang bis Ende verfolgen ist eine kostenlose MCP Academy-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des MCP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Following One Call
A single tool call may touch your server, a database, and an API. Tracing stitches those hops into one timeline so you see the whole journey. 🧵
Traces and Spans
A trace is the full request; a span is one step inside it. Each span records a name, a start, and a duration, and spans nest like a tree.
The Trace ID
Every span in one request shares a single trace ID. That shared id is what lets a tool reconstruct exactly which steps belonged together.
Parent and Child Spans
Spans link through a parent ID. The tool call is the parent; the database query and API call become its children, forming the timeline tree.
OpenTelemetry
The standard for this in Python is OpenTelemetry. It defines traces, spans, and context so your data works with many backends, not just one.
Start a Span
You wrap work in a span using a context manager. Everything inside it is timed and nested under the current trace automatically.
from opentelemetry import trace
tracer = trace.get_tracer("mcp")
with tracer.start_as_current_span("search_tool"):
run_search()Add Attributes
Decorate a span with attributes: small key-value facts like the tool name or result count. They make a trace far easier to read later.
span = trace.get_current_span()
span.set_attribute("tool.name", "search")
span.set_attribute("result.count", 3)Spans Catch Errors
When a step fails, mark its span with the error status. The trace then shows you exactly which hop broke the request, not just that it broke.
Context Propagation
To trace across a network call, you pass the trace context along in headers. This propagation keeps the remote step under the same trace.
Link Logs to Traces
Put the trace ID into your structured logs too. Now a log line and its full trace point at each other, and debugging gets dramatically faster.
Exporting Traces
Spans are sent to a backend through an exporter, often via the OTLP protocol. The backend then draws the timeline you click through.
Quick Check
Let us confirm the trace structure.
Recap
You can now trace a call end to end with spans under one trace ID, enriched with attributes, error status, and logs that link straight back. 🗺️
Häufig gestellte Fragen
Ist die Lektion „Einen Tool-Aufruf von Anfang bis Ende verfolgen“ kostenlos?
Ja — der vollständige Text von „Einen Tool-Aufruf von Anfang bis Ende verfolgen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des MCP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Einen Tool-Aufruf von Anfang bis Ende verfolgen“?
Verfolgen Sie eine Anfrage durch den gesamten Stack. Du übst MCP Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um MCP Academy zu starten?
Keine Vorkenntnisse erforderlich. MCP Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.
Wie lange dauert die Lektion „Einen Tool-Aufruf von Anfang bis Ende verfolgen“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser MCP Academy-Lektion Code schreiben und ausführen?
Ja. Jede MCP Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Was Sie bei einem Server messen sollten
- Durchsuchbare strukturierte Logs
- Einen Tool-Aufruf von Anfang bis Ende verfolgen
- Bei Fehlern und Missbrauch alarmieren