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

# Rebuild an org's custom tools, MCP providers, and dependent agents

> Invalidates the org's tool caches, reloads custom tools (from `tools` table) and DB-backed MCP tools (from `tool_providers` where type='mcp'), then rebuilds every agent in the org whose agentTools reference at least one of those tools (active version per agent).



## OpenAPI

````yaml /api-reference/openapi.json post /rebuild-org-tools
openapi: 3.1.0
info:
  title: Sidenet API
  version: 1.0.0
  description: >-
    Custom HTTP endpoints exposed by the Sidenet Mastra server. All routes
    require a bearer token and resolve org context from the API key (or the
    `X-Organization-Id` header). This reference is generated from the live route
    definitions in `src/mastra/routes`.
servers:
  - url: ''
security:
  - bearerAuth: []
paths:
  /rebuild-org-tools:
    servers:
      - url: /
    post:
      tags:
        - Custom
      summary: Rebuild an org's custom tools, MCP providers, and dependent agents
      description: >-
        Invalidates the org's tool caches, reloads custom tools (from `tools`
        table) and DB-backed MCP tools (from `tool_providers` where type='mcp'),
        then rebuilds every agent in the org whose agentTools reference at least
        one of those tools (active version per agent).
      parameters:
        - name: X-Organization-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Organization to scope the request to. Optional when authenticating
            with an org API key (the org is taken from the key; if sent, it must
            match). Required when authenticating with the trusted key.
        - name: X-User-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            End-user identity for the request; user-scoped data (threads,
            memory) resolves to `{orgId}_{userId}`. Required by endpoints that
            read or write user-scoped resources. A `userId` query param (or body
            field, where documented) is accepted as a fallback.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                orgId:
                  type: string
                  description: >-
                    Organization ID (required only for JWT auth, resolved from
                    API key auth)
              additionalProperties: false
      responses:
        '200':
          description: Org tools refreshed and dependent agents rebuilt
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Org API key (scopes the request to its organization) or the shared
        trusted key (requires `X-Organization-Id` on every request).

````