Skip to main content
Glama

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

NameRequiredDescriptionDefault
request_urlNoThe endpoint URL being called
request_bodyNoRequest payload/body
metadata_userNoUser identifier for the log
response_bodyNoResponse payload/body
response_timeNoResponse latency in milliseconds
request_methodNoHTTP method used (defaults to 'post')post
streaming_modeNoWhether the response was streamed
metadata_customNoAdditional custom metadata key-value pairs
request_headersNoRequest headers as key-value pairs
response_statusNoHTTP response status code (defaults to 200)
metadata_span_idNoSpan ID for tracing
request_providerNoAI provider name (e.g., 'openai', 'anthropic')
response_headersNoResponse headers as key-value pairs
metadata_trace_idNoTrace ID for distributed tracing
metadata_span_nameNoSpan name for tracing
metadata_organizationNoOrganization identifier for the log
metadata_parent_span_idNoParent span ID for tracing

Output Schema

NameRequiredDescriptionDefault
okYesCall succeeded
dataNoSuccess payload
errorNoFailure details

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.16.5
    • changedOutput schema / properties / data / description
      Previous value: -"Structured success payload when ok is true"New value: +"Success payload"
    • changedOutput schema / properties / error / description
      Previous value: -"Structured error payload when ok is false"New value: +"Failure details"
    • changedOutput schema / properties / error / properties / details / description
      Previous value: -"Optional structured error details"New value: +"Extra error details"
    • changedOutput schema / properties / error / properties / message / description
      Previous value: -"Human-readable error message"New value: +"Error message"
    • changedOutput schema / properties / ok / description
      Previous value: -"Whether the tool call succeeded and returned structured data"New value: +"Call succeeded"
  2. Changed2 schema fields changedv1.0.9
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  3. Addedv1.0.1
  4. Removed
  5. First observed

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations cover the safety profile (non-read-only, non-destructive, non-idempotent, open-world), so the description's job is supplementary and it delivers: it discloses that the write is immediate and that the call hard-fails when request_provider does not match a configured integration. It does not mention duplicate-record risk from the non-idempotent hint, which would have been a useful addition.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, no filler, with the identity and the immediate-write semantics front-loaded before the failure condition and the tracing hint. Nothing reads as redundant padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 17 optional parameters, an output schema, and full annotation coverage, the description supplies the two things structured fields cannot easily express: the integration-mismatch failure mode and the tracing intent of the span fields. It leaves open what a minimal valid call looks like, since zero parameters are required, which is a modest remaining gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% across 17 parameters, so the baseline is 3. The description goes beyond it by explaining the purpose of the span fields (stitching trace hierarchies) and by tying request_provider to a failure condition, which is meaning the flat schema description does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb and resource ('Insert log records') and scopes it to 'requests that bypassed the gateway', which separates it from the log export and get_log siblings. It stops short of naming an alternative tool, but the resource scope is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The bypassed-gateway condition is a clear trigger for use, and the span-field sentence hints at how to use it for tracing. There is no guidance on when NOT to use it (e.g., when the request already went through the gateway) or what it duplicates, so usage is implied rather than delimited.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools