The Model Context Protocol (MCP) relies on JSON-RPC 2.0 as its core wire format to enable seamless communication between LLM clients and servers. These methods are separated by direction and functionality, managing everything from lifecycle initialization to specific resource, tool, and prompt capabilities.
Client-to-Server Requests
These methods are invoked by the AI client to query capabilities, manage sessions, or execute actions on the server.
Lifecycle & Session
Method
Purpose
initialize
Establishes the connection and negotiates protocol capabilities.
ping
Performs a standard connectivity and health check.
Tools Feature
Method
Purpose
tools/list
Requests a comprehensive list of all executable tools available on the server.
tools/call
Instructs the server to execute a specific tool with designated parameters.
Resources Feature
Method
Purpose
resources/list
Discovers context data and files exposed by the server.
resources/read
Retrieves the raw content of a specific resource.
resources/templates/list
Lists modular URI templates available to dynamically fetch data.
resources/subscribe
Requests continuous real-time updates for a resource.
resources/unsubscribe
Cancels an active resource data subscription.
Prompts Feature
Method
Purpose
prompts/list
Discovers pre-built prompt templates available on the server.
prompts/get
Retrieves the specific structure and layout of a chosen prompt template.
Configuration & Utilities
Method
Purpose
logging/setLevel
Adjusts the verbosity thresholds for the server's logging outputs.
roots/list
Requests a list of underlying file system roots accessible to the client.
Server-to-Client Requests
These methods allow the server to ask the client for additional user context, file visibility, or model completions.
Method
Purpose
ping
Server-initiated connectivity verification to check client status.
sampling/createMessage
Requests the LLM client to generate a message or text completion.
elicitation/create
Prompts the host client to safely gather explicit human input.
completion/complete
Requests auto-completion string matching from the client.
Notifications (Asynchronous Events)
Notifications do not include an id field and do not expect a returned response object. They primarily track real-time changes.
Notification
Purpose
notifications/initialized
Sent by the client to signal that initialization is finalized.
notifications/cancelled
Signals that a running asynchronous operation has been cancelled.
notifications/progress
Provides step-by-step progress tracking for long-running actions.
notifications/tools/list_changed
Notifies the client that the server's tool availability matrix has updated.
notifications/resources/list_changed
Broadcasts changes regarding underlying data resources.
notifications/prompts/list_changed
Alerts the client that server prompt templates have been modified.
notifications/message
Transmits live logging data records from the server to the client console.
Model Context Protocol (MCP) Primitives
Model Context Protocol (MCP) primitives are the core building blocks defined in the data layer that let AI clients and servers share context, structure interactions, and execute tasks. They split into server-side capabilities (tools, resources, prompts) and client-side control features (sampling, elicitation, roots).
Server-Side Primitives
Primitive
Description
Tools
Model-controlled executable functions that let the LLM perform actions like API calls, file updates, or database queries.
Resources
Application-controlled data sources providing ambient reference data and context like file contents or database records.
Prompts
User-controlled reusable templates and slash commands that standardize workflows and interactions.
Client-Side Primitives
Primitive
Description
Sampling
Server-initiated requests allowing an MCP server to safely query the host's LLM for agentic or recursive behaviors.
Elicitation
Mid-task requests where a server asks the user for missing details or confirmation instead of guessing.
Roots
Security boundaries defining which specific directories or files a server can access.
Elicitation Requests
An elicitation request is a runtime mechanism in the Model Context Protocol that allows a server to dynamically prompt a user for missing details or confirmation during tool execution rather than failing. It supports form collection for structured data and secure URL redirects for sensitive tasks.
Key Modes & Actions
Mode / Action
Description
Form Mode
Collects in-band structured inputs and primitives using optional validation schemas.
URL Mode
Sends users out-of-band to a browser for secure flows like OAuth or payments.
Response Actions
User interactions follow an accept, decline, or cancel framework.
Important Note
Elicitation enables MCP servers to request additional information from users safely and explicitly, avoiding assumptions during task execution while supporting structured forms and secure external workflows.
Application-layer protocols (HTTP, gRPC, MQTT, SMTP, etc.) define how applications communicate, while transport-layer protocols (TCP, UDP, QUIC) determine how data is delivered across the network. IP (IPv4/IPv6) operates at the network layer and is responsible for addressing and routing packets between hosts.
An odds ratio (OR) measures the association between an exposure and an outcome. It represents the odds that an outcome will occur given a specific exposure, compared to the odds of the outcome occurring in the absence of that exposure.
Here is a breakdown of odds ratios, interpretive logistic regression, and ordinal logistic regression.
1. Odds Ratio (OR)
An odds ratio compares the likelihood of an event happening between two different groups. It is not the same as risk (probability).
Odds vs. Probability
If a horse wins 2 out of 10 races:
Probability of winning = 2 / 10 = 20%
Odds of winning = 2 to 8 = 2 / 8 = 0.25
Probability and odds are related but are not the same quantity.
Calculation
OR
=
(Odds of Event in Group A)
/
(Odds of Event in Group B)
Interpretation
Odds Ratio
Interpretation
OR = 1
The exposure does not affect the odds of the outcome.
OR > 1
The exposure is associated with higher odds of the outcome.
OR < 1
The exposure is associated with lower odds of the outcome.
2. Logistic Regression for Interpretation vs. Prediction
Logistic regression models the probability of a binary outcome (e.g., Yes/No, Success/Failure) using independent variables.
You can use this tool for two completely different goals:
Logistic regression can be used either for interpretation or prediction.
Interpretation Focus
Goal: Understand the relationship between variables.
Key Metrics: Coefficients (β), p-values, and confidence intervals.
Action: Convert log-odds coefficients into Odds Ratios by exponentiating them (eβ).
Odds Ratio = eβ
Example
"Holding all other variables constant, every one-year increase in age increases the odds of developing heart disease by 1.15 times (OR = 1.15)."
Prediction Focus
Goal: Accurately classify new, unseen data into a category.
Key Metrics: Accuracy, Precision, Recall, ROC-AUC, and F1-score.
Action: Use the model output to generate a probability score between 0 and 1, then apply a threshold (such as 0.5) to label the data.
Example
"Based on this patient's medical data, there is an 87% chance they have heart disease, so we classify them as High Risk."
Logistic regression prediction workflow.
3. Ordinal Logistic Regression
Standard logistic regression only works for two categories.
Ordinal logistic regression is used when the dependent variable is categorical and has a natural, ordered ranking, but the distance between the ranks is unknown.
Instead of predicting a single probability, ordinal logistic regression evaluates cumulative probabilities. It looks at the odds of being in a category or lower versus being in a higher category.
Ordinal logistic regression models cumulative probabilities across ordered categories.
The Assumption
It assumes that the effect of an independent variable is the same across all category cutoffs.
For example, if smoking increases the odds of moving from "Mild" to "Moderate" disease by 2.0, it must also increase the odds of moving from "Moderate" to "Severe" disease by 2.0.
Important Note
This assumption is known as the parallel lines assumption or the proportional odds assumption.
Summary
An Odds Ratio (OR) compares the odds of an event occurring between two groups.
Logistic regression can be used either for interpretation (understanding relationships) or prediction (classifying new observations).
Ordinal logistic regression extends binary logistic regression to ordered categorical outcomes by modeling cumulative probabilities under the proportional odds assumption.
Note that the term "backpropagation" is technically not used for standard linear or logistic regression. Instead, we simply call the optimization process Gradient Descent.
Backpropagation is also related to vanishing gradient. Vanishing gradient can occur only across multiple layers. Thus both backpropagation and vanishing gradient are related to multiple layers only, then are never used for single layer models.
Important Note
The word propagation implies a sequence of layers. Because linear regression and logistic regression contain only a single layer of weights, there is no sequence of layers through which errors can propagate backward.
What is Backpropagation?
Backpropagation is short for "backward propagation of errors." It is an algorithm specifically designed for multi-layer neural networks.
The Sequence
It uses the mathematical Chain Rule to calculate gradients. It starts at the final output layer, computes the error, and then passes (propagates) that error backward, layer by layer, to update the weights at the very beginning of the network.
During backpropagation, the error is propagated backward through multiple layers using the Chain Rule.
Why the Confusion in Linear and Logistic Regression?
You might hear people use the term loosely in linear or logistic regression for two main reasons:
1. Neural Network Equivalent
A logistic regression model is mathematically identical to a single-neuron neural network with a sigmoid activation function.
2. The "One-Step" Chain Rule
Even in logistic regression, you use a small version of the Chain Rule. To find how the loss changes with respect to the weights,
Because this calculation proceeds backward from the Loss to the Weights, some instructors casually refer to it as "backpropagation", even though it only spans a single layer.
Logistic regression applies the Chain Rule over a single layer rather than propagating errors through multiple layers.
Summary of Terms
Term
Definition
Used In
Gradient Descent
The overall optimization algorithm used to update weights to minimize error.
Linear regression, logistic regression, and neural networks.
Backpropagation
The specific method used inside gradient descent to calculate gradients across multiple sequential layers.
Multi-layer neural networks.
Key Takeaway
Gradient Descent is the optimization algorithm that updates model parameters to minimize the loss function. Backpropagation is the gradient-computation algorithm used within gradient descent for multi-layer neural networks. In standard linear regression and logistic regression, we typically refer only to Gradient Descent, since there are no multiple layers through which errors must propagate.
A mathematical transformation is a function T that maps elements from an initial set (domain) to another set (codomain), modifying inputs into outputs according to a strict mathematical rule.
In geometry and linear algebra, it maps vectors or points from one vector space to another, written as:
T : V → W
Here V is the domain, W is the Codomain and T is the function that maps V to W.
2. Linear vs. Non-Linear Transformations
The fundamental division between transformations relies on two algebraic rules:
Additivity
T(u + v) =
T(u) +
T(v)
Homogeneity
T(cu) =
cT(u)
Linear Transformations
Linear transformations satisfy both conditions.
They always map the origin to itself.
T(0) = 0
They map straight lines to straight lines.
They keep grid lines straight and parallel.
They can always be expressed as a matrix multiplication:
T(x) = Ax
Non-Linear Transformations
Non-linear transformations fail at least one condition.
They curve the underlying space.
They warp grid lines.
They move the origin.
Examples include squaring coordinates:
T(x, y) = (x2, y)
Or adding constants:
T(x) = x + b
(which is an affine transformation, not strictly linear).
Property
Linear Transformation
Non-Linear Transformation
Additivity
✔ Satisfied
✘ Violated
Homogeneity
✔ Satisfied
✘ Violated
Origin
Preserved
May Move
Grid Lines
Remain Straight
May Warp
Matrix Representation
Always Possible
Generally Not Possible
3. Standard 2D Linear Geometric Transformations
In a two-dimensional Cartesian plane, standard linear transformations alter the spatial properties of shapes and can be written using a 2 × 2 matrix:
[ x′ ] =
[ a b ] [ x ]
[ y′ ]
[ c d ] [ y ]
Note
Use arrow keys to adjust value.
0:00 / 1:01
Audio made with Google AI. Image licensed by Google.
Scaling
Stretches or shrinks coordinates along axes.
sx
0
0
sy
Rotation
Rotates points counterclockwise around the origin by an angle θ.
cos θ
− sin θ
sin θ
cos θ
Shearing
Slants one coordinate axis parallel to another based on a factor k.
Horizontal Shear
1
k
0
1
Vertical Shear
1
0
k
1
Reflection
Flips the space across a line passing through the origin.
Across the x-axis:
1
0
0
−1
Note
Translation—sliding an object—is geometric but requires a 3 × 3 matrix with homogeneous coordinates to be handled linearly because it moves the origin.
Figure 3.1 — Examples of scaling, rotation, shearing, and reflection in two-dimensional space.
4. Non-Geometric Transformations
Non-geometric transformations modify the properties or data structures of elements rather than their spatial positions, shapes, or orientations.
Transformation Type
Description
Examples
Data Transformations
Converting variable distributions in statistics.
Logarithmic transformation (log(x)) or Z-score normalization.
Color Space Transformations
Converting digital imagery pixels from one color representation to another.
RGB → CMYK or YCbCr color spaces.
Domain Transformations
Changing the functional domain of an equation.
Fourier Transform or Laplace Transform for mapping time-domain signals to the frequency domain.
Cryptographic Transformations
Permuting and substituting data bytes to encrypt plain text into ciphertext.
Algorithms such as AES.
Important Note
Unlike geometric transformations, non-geometric transformations change the underlying data, representation, or mathematical domain without necessarily altering the physical position or shape of objects.
Production-grade AI features (matches with constraints, commands, resources, rules and performance evaluation)
Technical, Analytical, & Deep Research
CLEAR
Context, Limits, Emphasis, Alignment, Review
Strategic research and highly regulated topics
4. Advanced "Reasoning" Frameworks
Advanced "Reasoning" Frameworks
Chain-of-Thought (CoT)
Architectural behavioral method
Forces the AI to show its step-by-step reasoning before outputting a final answer.
Advanced "Reasoning" Frameworks
Tree-of-Thought (ToT)
Architectural behavioral method
Guides the AI to evaluate multiple different solution paths simultaneously, self-correcting as it goes.
Advanced "Reasoning" Frameworks
ReAct
Reasoning + Acting
Prompts the AI to alternate between "thinking" about a problem and "acting" (e.g., searching the web, running code).
Prompt Components: Constraints, Commands, Resources, Rules, and Performance Evaluation
A prompt can consist of constraints, commands, resources, rules, and performance evaluation. While a basic prompt might only be a simple question, advanced prompt engineering frameworks frequently use these exact five components to obtain high-quality, predictable outputs from AI models.
Key Idea
Advanced prompt engineering frameworks extend beyond a simple instruction by defining what the AI should do, what limitations it must follow, what information it can use, what rules it must obey, and how the final output will be evaluated.
Component Breakdown
Component
Description
Example
Commands
The core instruction telling the AI what to do.
"Write," "Analyze," "Summarize"
Constraints
The boundaries or limits placed on the output.
"Under 500 words," "Do not use jargon," "Format as markdown"
Resources
The background data, context, or examples provided to help the AI understand the task.
"Based on the attached CSV file," "Use the following style guide"
Rules
The logical guidelines or conditional policies the AI must follow while processing the request.
"If the sentiment is negative, escalate to human tone," "Always verify facts before listing them"
Performance Evaluation
The criteria or rubric used to tell the AI how its output will be judged, often used in iterative prompts.
"Your output will be scored on clarity, accuracy, and conciseness from 1 to 5"
Commands:What to do
Constraints: Limits
Resources: Context
Rules: Policies
Performance Evaluation: Quality Criteria
Important Note
Although a simple prompt may contain only a question or instruction, advanced prompt engineering frameworks typically combine these five components to produce more accurate, consistent, and predictable AI responses.
1. The Sigmoid Function: Definition, Properties, and Universality
Mathematical Definition
The standard logistic sigmoid function maps any real-valued number
into a strict probability-like range between
0 and 1.
σ(x) =
1
1 + e-x
The Derivative
Using the quotient rule and the chain rule, the derivative simplifies
into a remarkably elegant, self-referential expression where the slope
is computed directly from the value of the sigmoid itself.
σ′(x) = σ(x) (1 − σ(x))
Why Euler's Number (e) is Used
While any exponential base (such as
2-x or 10-x)
could theoretically be used,
Euler's number
(e ≈ 2.71828)
is universally chosen for deep mathematical reasons.
The Natural Derivative
The derivative of
ex
is exactly
ex.
This unique property eliminates unwanted scaling constants such as
ln(2) or ln(10), making the derivative beautifully simple and
computationally efficient during backpropagation.
Information Theory & Physics
The base
e
naturally appears in the
Boltzmann distribution
in statistical physics and in
log-odds (logits)
in statistics. It represents the natural rate of continuous growth
and maximum entropy, making it the mathematically preferred choice
for probabilistic modeling.
Universal Significance of the Sigmoid Function
Why the Sigmoid Function Is So Widely Used
The sigmoid function is much more than just another mathematical equation.
It possesses several unique properties that make it one of the most important
functions in statistics, probability, machine learning, and deep learning.
Smooth Thresholding
It acts as a continuous, differentiable alternative to a hard
step function. Instead of abruptly switching from
0 to 1,
it transitions smoothly, making gradient-based optimization possible.
Probability Mapping
It transforms unconstrained real numbers ranging from
−∞ to +∞
into valid probabilities between
0 and 1
making it ideal for probabilistic prediction.
2. Why the Derivative Is Not a True Parabola
The derivative of the sigmoid function is written as
σ′(x) = σ(x) (1 − σ(x))
At first glance, this expression resembles the quadratic form
σ − σ2
Since this resembles the familiar equation
x − x2,
many beginners assume the derivative must be a parabola.
Although the algebraic form appears similar, the geometric behavior is completely different.
The Input Variable Matters
A true parabola is defined directly as a polynomial in the horizontal
variable.
f(x) = x − x2
Here, the independent variable
x
appears directly as a polynomial.
Consequently, the graph follows the familiar parabolic shape.
In contrast, the sigmoid derivative is ultimately a function of
x through the exponential term
e−x.
Therefore, the horizontal axis is not related polynomially to the output.
The Exponential Constraint
Inside the sigmoid function,
the input variable appears inside an exponential:
σ(x) =
1
1 + e−x
Because of this exponential dependence,
the rate of change grows and decays exponentially rather than polynomially.
As a result,
the derivative cannot produce the infinitely expanding shape associated
with a geometric parabola.
The Geometric Result
Instead of expanding outward forever,
the exponential terms continuously bend the curve inward.
The curve gradually flattens on both sides,
producing a smooth,
symmetric,
bell-shaped distribution.
Mathematically,
this curve is a
hyperbolic secant squared
function rather than a parabola.
Visual Comparison: Parabola vs. Sigmoid Derivative
Key Observation
Although the derivative contains an algebraic expression that resembles
a quadratic function, its dependence on the exponential term
e−x
causes the graph to become a bounded bell-shaped curve rather than
an unbounded parabola.
3. Core Applications: Logistic Regression and Neural Networks
Why the Sigmoid Function Became So Important
The sigmoid function became one of the most influential mathematical
functions in Machine Learning because it naturally converts unrestricted
real-valued numbers into probabilities.
This single property makes it extremely useful in both
statistical machine learning and
artificial neural networks.
In binary classification problems, an algorithm must predict a probability
between 0 and 1.
Examples include determining whether:
Email → Spam or Not Spam
Patient → Disease Present or Healthy
Transaction → Fraudulent or Genuine
Student → Pass or Fail
Step 1 — Linear Model Produces a Raw Score
A linear model first computes a raw numerical score known as the
logit.
z = β0 + β1x1 + β2x2 + ··· + βnxn
This value may lie anywhere between
−∞ and +∞.
Step 2 — Apply the Sigmoid Function
The raw score is then passed through the sigmoid function.
P =
1
1 + e−z
The output is now guaranteed to lie between
0 and 1,
allowing it to be interpreted as a probability.
Step 3 — Make the Final Prediction
A threshold is then applied.
If the probability is ≥ 0.5, predict Class 1.
If the probability is < 0.5, predict Class 0.
Logistic Regression Pipeline
Activation Functions in Neural Networks
Early neural networks adopted the sigmoid function because it provides
a simple mathematical approximation of how biological neurons behave.
Biological Analogy
A biological neuron receives electrical signals from many other neurons.
It accumulates these incoming signals.
When the accumulated signal exceeds a threshold, the neuron fires.
Mathematical Interpretation
The sigmoid function acts as a smooth mathematical gate that determines
how much information should pass from one layer of neurons to the next,
depending on the strength of the incoming signal.
Sigmoid as an Activation Function
4. The Vanishing Gradient Problem and the Evolution of Activation Functions
The Vanishing Gradient Problem
Although the sigmoid function is mathematically elegant, it introduces a
major difficulty when training deep neural networks.
The maximum value of the sigmoid derivative occurs at
x = 0, where
σ′(0) = 0.25
As the input moves away from zero in either direction, the sigmoid curve
gradually flattens and its derivative rapidly approaches zero.
During backpropagation, gradients from deeper layers are multiplied
together while moving toward earlier layers.
Since each sigmoid derivative is at most
0.25, repeatedly multiplying these small values causes
the gradient to shrink exponentially.
Result
By the time the gradient reaches the earliest layers of a deep
network, it has effectively become zero. Consequently, those layers
stop learning because their weights receive almost no updates.
Mathematical Intuition
Suppose a network contains several hidden layers.
During backpropagation, the gradient reaching an early layer is roughly
the product of all the derivatives encountered along the path.
Gradient =
σ′1
×
σ′2
×
σ′3
×
···
×
σ′n
If every derivative is smaller than
0.25,
the product decreases exponentially as the number of layers increases.
Example of Gradient Shrinkage
Consider a simplified network in which each layer contributes a gradient
of approximately
0.2.
Layer
Approximate Gradient
Layer 4
0.20
Layer 3
0.04
Layer 2
0.008
Layer 1
Almost 0 (Vanished)
Gradient Flow Through a Deep Neural Network
Why Learning Stops
Neural networks learn by updating their weights using gradients
computed during backpropagation.
If the gradient reaching a layer becomes extremely small, the weight
updates become almost zero.
As a result, the earliest layers stop learning useful features even
though the later layers continue to update.
Key Consequence
This inability to update the early layers severely limits the
training of very deep neural networks and was one of the primary
motivations for developing newer activation functions.
How Other Activation Functions Solve the Vanishing Gradient Problem
To overcome the vanishing gradient problem, modern deep learning relies on
activation functions that preserve stronger gradients during
backpropagation.
Instead of rapidly flattening like the sigmoid function, these
activations maintain a larger derivative over a wider range of inputs,
allowing information to propagate efficiently through very deep neural
networks.
ReLU (Rectified Linear Unit)
The Rectified Linear Unit (ReLU) is defined as:
f(x) = max(0, x)
For any positive input, the derivative of ReLU is a constant
1.
Because a gradient of 1 does not shrink during
multiplication, it can travel through hundreds of layers without
vanishing, making ReLU the default activation function in many deep
neural networks.
Tanh (Hyperbolic Tangent)
The hyperbolic tangent function scales inputs into the range:
−1 to +1
Its maximum derivative is 1.0 (at
x = 0), allowing gradients to flow more effectively
than with the sigmoid function.
However, tanh still saturates for very large positive and negative
inputs, so its gradients also become extremely small in those regions.
Activation
Output Range
Maximum Derivative
Main Characteristic
Sigmoid
0 to 1
0.25
Good for probabilities but suffers from vanishing gradients.
Tanh
−1 to 1
1.0
Improves gradient flow but still saturates.
ReLU
0 to ∞
1.0
Fast training and excellent gradient propagation.
The Dying ReLU Problem
Although ReLU effectively prevents vanishing gradients for positive
inputs, it introduces another limitation.
Whenever the input is negative, the output becomes
0 and the derivative is also exactly
0.
If a neuron continually receives negative inputs, it always produces
zero output. Consequently, its gradient remains zero, its weights stop
updating, and the neuron permanently stops contributing to the network.
Result
The neuron becomes permanently inactive, a phenomenon commonly known
as the Dying ReLU Problem.
Solutions to the Dying ReLU Problem
Leaky ReLU
Instead of forcing every negative input to zero, Leaky ReLU assigns a
small non-zero slope.
f(x) = 0.01x for x < 0
This ensures that a small gradient (approximately
0.01) always flows backward, allowing inactive neurons
to recover during training.
GELU (Gaussian Error Linear Unit)
GELU combines the behavior of ReLU with a probabilistic weighting based
on a Gaussian distribution.
Instead of introducing a sharp transition at zero, GELU provides a
smoother activation function that has become the dominant choice in
modern Transformer architectures and Large Language Models (LLMs).
Summary
The mathematical elegance of the sigmoid function relies on Euler's
number (e) to create clean probabilistic outputs.
Although its derivative has an algebraic expression that resembles a
parabola, the exponential nature of the sigmoid function causes the
derivative to form a bell-shaped curve rather than a true parabola.
As neural networks became deeper, the sigmoid function's rapidly
shrinking derivative led to the vanishing gradient problem, motivating
the development of improved activation functions such as ReLU, Leaky
ReLU, and GELU that maintain stronger gradients during training.