insert_log

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.

Server Portkey Admin CodesWhat/portkey-admin-mcp
Category Write
Risk class Medium
Parameters 120 required

What insert_log does on Portkey Admin

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.

ParameterTypeRequiredDescription
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.

Why insert_log needs a policy

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)

Questions about insert_log

What does the insert_log tool do? +

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.

What parameters does insert_log accept? +

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.

How do I enforce a policy on insert_log? +

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.

What risk level is insert_log? +

insert_log is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.

Can I rate-limit insert_log? +

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.

How do I block insert_log completely? +

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.

What MCP server provides insert_log? +

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.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.