> ## Documentation Index
> Fetch the complete documentation index at: https://docs.insforge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Record MCP tool usage

> Records an MCP tool invocation in `system.mcp_usage`. The `success` flag defaults to `true` when omitted.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/usage.yaml post /api/usage/mcp
openapi: 3.0.3
info:
  title: Insforge Usage API
  version: 1.0.0
  description: MCP usage tracking and usage statistics for the backend usage module.
servers: []
security: []
tags:
  - name: Usage
    description: Record MCP tool usage and fetch usage summaries.
paths:
  /api/usage/mcp:
    post:
      tags:
        - Usage
      summary: Record MCP tool usage
      description: >-
        Records an MCP tool invocation in `system.mcp_usage`. The `success` flag
        defaults to `true` when omitted.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordMcpUsageRequest'
            example:
              tool_name: generate_report
              success: true
      responses:
        '200':
          description: MCP usage recorded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordMcpUsageResponse'
              example:
                success: true
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_INPUT
                message: tool_name is required
                statusCode: 400
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: AUTH_INVALID_API_KEY
                message: Invalid API key
                statusCode: 401
        '500':
          description: Failed to record MCP usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INTERNAL_ERROR
                message: Failed to record MCP usage
                statusCode: 500
      security:
        - apiKey: []
components:
  schemas:
    RecordMcpUsageRequest:
      type: object
      required:
        - tool_name
      properties:
        tool_name:
          type: string
          description: MCP tool name to record.
        success:
          type: boolean
          default: true
          description: Whether the tool invocation succeeded.
    RecordMcpUsageResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          example: true
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
        message:
          type: string
        statusCode:
          type: integer
        nextActions:
          type: string
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````