This page applies to Apigee and Apigee hybrid.
View
Apigee Edge documentation.
The ParsePayload policy extracts logical operations from structured request payloads (such as JSON-RPC 2.0) into message flow variables. This functionality enables the proxy admin to implement conditional routing logic directly based on client request contents rather than basic resource paths or query parameters.
This policy is an Extensible policy and use of this policy might have cost or utilization implications, depending on your Apigee license. For information on policy types and usage implications, see Policy types.
<ParsePayload> element
Specifies validation parsing properties applied toward application logic evaluation cycles.
| Required? | Required |
| Parent Element | n/a |
| Child Elements |
<Source><PayloadType><Protocol>
|
Syntax
The ParsePayload element uses the following syntax:
<ParsePayload continueOnError="[false|true]" enabled="[true|false]" name="policy_name"> <Source>request</Source> <PayloadType>JSON-RPC-2.0</PayloadType> <Protocol>MCP</Protocol> </ParsePayload>
Example
The following example shows a standard configuration for the ParsePayload policy:
<ParsePayload continueOnError="false" enabled="true" name="parse-payload-mcp"> <Source>request</Source> <PayloadType>JSON-RPC-2.0</PayloadType> <Protocol>MCP</Protocol> </ParsePayload>
<Source>
Indicates the request/response container context processed immediately through runtime evaluations.
<Source>request</Source>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Must be request or response. |
request |
Optional |
<PayloadType>
Governs overall evaluation structures recognized regarding data processing requirements.
<PayloadType>JSON-RPC-2.0</PayloadType>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Supported values: JSON-RPC-2.0. |
N/A | Required |
<Protocol>
Determines formatting behaviors corresponding precisely with target interface declarations.
<Protocol>MCP</Protocol>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Supported value: MCP. |
N/A | Required |
Extracted Flow Variables
After the policy executes successfully, it populates flow variables prefixed
with the policy instance name. These variables follow the pattern
parsepayload.policyName.suffix,
where policyName is the value of the
name attribute in the policy XML configuration. This naming
convention is consistent with other Apigee policies such as VerifyAPIKey and
allows multiple ParsePayload policies in the same proxy to
maintain distinct variable namespaces.
For a policy named parse-payload-mcp, the following variables
are set:
| Variable Name | Description |
|---|---|
parsepayload.parse-payload-mcp.operation |
Constructed execution identifier.
|
parsepayload.parse-payload-mcp.json-rpc.request.method |
The method field from the JSON-RPC request (e.g., tools/call or tools/list). |
parsepayload.parse-payload-mcp.json-rpc.request.id |
The id field from the JSON-RPC request. |
parsepayload.parse-payload-mcp.json-rpc.request.params.name |
The name field inside params (populated for tools/call to identify the tool). |
parsepayload.parse-payload-mcp.json-rpc.request.params.arguments.{arg_name} |
Arguments passed in the arguments object. String values are stored directly; nested objects or arrays are stored as serialized JSON strings. |
Example
For the following JSON-RPC request payload with simple arguments:
{ "jsonrpc": "2.0", "id": "req_001", "method": "tools/call", "params": { "name": "get_weather", "arguments": { "location": "San Francisco, CA", "forecast_days": 3 } } }
The policy populates the following variables:
| Variable | Value |
|---|---|
parsepayload.parse-payload-mcp.operation |
tools/call/get_weather |
parsepayload.parse-payload-mcp.json-rpc.request.method |
tools/call |
parsepayload.parse-payload-mcp.json-rpc.request.id |
req_001 |
parsepayload.parse-payload-mcp.json-rpc.request.params.name |
get_weather |
parsepayload.parse-payload-mcp.json-rpc.request.params.arguments.location |
San Francisco, CA |
parsepayload.parse-payload-mcp.json-rpc.request.params.arguments.forecast_days |
3 |