Skip to main content

Tools: Building AI Capabilities

Tool Context

0:00
LearnStep 1/4

Introduction to Context

The Context Object

Context provides runtime access to logging, progress reporting, and other MCP features.

Accessing Context

python

Context Features

  • Logging: ctx.debug(), ctx.info(), ctx.warning(), ctx.error()
  • Progress: ctx.report_progress(current, total)
  • Resources: ctx.read_resource(uri)
  • Sampling: ctx.sample() for LLM calls

Logging Levels

python