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.
AI agents use insert_log to create or update resources in Portkey Admin — usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Portkey Admin environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
request_url | string | — | The endpoint URL being called |
request_body | object | — | Request payload/body |
metadata_user | string | — | User identifier for the log |
response_body | object | — | Response payload/body |
response_time | number | — | Response latency in milliseconds |
request_method | string | — | HTTP method used (defaults to 'post') |
streaming_mode | boolean | — | Whether the response was streamed |
metadata_custom | object | — | Additional custom metadata key-value pairs |
request_headers | object | — | Request headers as key-value pairs |
response_status | number | — | HTTP response status code (defaults to 200) |
metadata_span_id | string | — | Span ID for tracing |
request_provider | string | — | AI provider name (e.g., 'openai', 'anthropic') |
Parameters from the server's own tool schema.
An AI agent can call insert_log faster than any human can review — one bad instruction and it creates or modifies resources in Portkey Admin by the hundred, each call as confident as the last.
Risk signalsHigh parameter count (17 properties)
Attacks that exploit this kind of access
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. It is categorised as a Write tool in the Portkey Admin MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
insert_log accepts 12 parameters: request_url, request_body, metadata_user, response_body, response_time, request_method, streaming_mode, metadata_custom, request_headers, response_status, metadata_span_id, request_provider. The full parameter table on this page comes from the server's own tool schema.
Register the Portkey Admin MCP server in PolicyLayer and add a rule for insert_log: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Portkey Admin. Nothing to install.
insert_log is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the insert_log rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for insert_log. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
insert_log is provided by the Portkey Admin MCP server (CodesWhat/portkey-admin-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.