insert_log
Log requests that bypass the gateway by writing request, response, and trace metadata to Portkey immediately; include provider integration and span fields to preserve trace hierarchies.
Instructions
Insert log records for requests that bypassed the gateway. This writes request, response, and trace metadata into Portkey immediately, and the call will fail if request_provider does not match a configured integration. Use the span fields to stitch trace hierarchies together.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "insert_log"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request_url | No | The endpoint URL being called | |
| request_body | No | Request payload/body | |
| metadata_user | No | User identifier for the log | |
| response_body | No | Response payload/body | |
| response_time | No | Response latency in milliseconds | |
| request_method | No | HTTP method used (defaults to 'post') | post |
| streaming_mode | No | Whether the response was streamed | |
| metadata_custom | No | Additional custom metadata key-value pairs | |
| request_headers | No | Request headers as key-value pairs | |
| response_status | No | HTTP response status code (defaults to 200) | |
| metadata_span_id | No | Span ID for tracing | |
| request_provider | No | AI provider name (e.g., 'openai', 'anthropic') | |
| response_headers | No | Response headers as key-value pairs | |
| metadata_trace_id | No | Trace ID for distributed tracing | |
| metadata_span_name | No | Span name for tracing | |
| metadata_organization | No | Organization identifier for the log | |
| metadata_parent_span_id | No | Parent span ID for tracing |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Call succeeded | |
| data | No | Success payload | |
| error | No | Failure details |