Letta Tools API

Register and execute custom tools (sandboxed Python, client-side, MCP).

Operations 21

DELETE /v1/tools/{tool_id} Delete Tool #
GET /v1/tools/{tool_id} Retrieve Tool #
PATCH /v1/tools/{tool_id} Modify Tool #
GET /v1/tools/count Count Tools #
GET /v1/tools/ List Tools #
POST /v1/tools/ Create Tool #
PUT /v1/tools/ Upsert Tool #
POST /v1/tools/search Search Tools #
POST /v1/tools/add-base-tools Upsert Base Tools #
POST /v1/tools/run Run Tool from Source #
GET /v1/tools/mcp/servers List MCP Servers #
PUT /v1/tools/mcp/servers Add MCP Server to Config #
GET /v1/tools/mcp/servers/{mcp_server_name}/tools List MCP Tools by Server #
POST /v1/tools/mcp/servers/{mcp_server_name}/resync Resync MCP Server Tools #
POST /v1/tools/mcp/servers/{mcp_server_name}/{mcp_tool_name} Add MCP Tool #
PATCH /v1/tools/mcp/servers/{mcp_server_name} Update MCP Server #
DELETE /v1/tools/mcp/servers/{mcp_server_name} Delete MCP Server from Config #
POST /v1/tools/mcp/servers/test Test MCP Server #
POST /v1/tools/mcp/servers/connect Connect MCP Server #
POST /v1/tools/mcp/servers/{mcp_server_name}/tools/{tool_name}/execute Execute MCP Tool #
GET /v1/tools/mcp/oauth/callback MCP Oauth Callback #

Documentation

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-agent-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-block-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-tool-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-source-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-run-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-group-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-identity-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-message-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-passage-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-archive-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-job-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-llm-config-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-embedding-config-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-provider-schema.json

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/letta-tools-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

letta-tools-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Letta Admin Tools API
  version: 1.0.0
  description: REST API for Letta, the stateful agents platform. Manage agents, memory blocks, archival passages, sources, custom tools, MCP servers, multi-agent groups, runs, and streaming responses. Available as Letta Cloud (managed) at https://api.letta.com/v1 and as the self-hosted open-source server (Apache-2.0) typically run at http://localhost:8283.
  contact:
    name: Letta
    url: https://www.letta.com/
    email: support@letta.com
  license:
    name: Apache-2.0
    url: https://github.com/letta-ai/letta/blob/main/LICENSE
  x-logo:
    url: https://www.letta.com/favicon.ico
servers:
- url: https://api.letta.com
  description: Letta Cloud (managed)
- url: https://app.letta.com
  description: Letta Cloud (app)
- url: http://localhost:8283
  description: Self-hosted Letta server
security:
- bearerAuth: []
tags:
- name: Tools
  description: Register and execute custom tools (sandboxed Python, client-side, MCP).
paths:
  /v1/tools/{tool_id}:
    delete:
      tags:
      - Tools
      summary: Delete Tool
      description: Delete a tool by name
      operationId: delete_tool
      parameters:
      - name: tool_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^tool-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the tool in the format 'tool-<uuid4>'
          examples:
          - tool-123e4567-e89b-42d3-8456-426614174000
          title: Tool Id
        description: The ID of the tool in the format 'tool-<uuid4>'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Tools
      summary: Retrieve Tool
      description: Get a tool by ID
      operationId: retrieve_tool
      parameters:
      - name: tool_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^tool-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the tool in the format 'tool-<uuid4>'
          examples:
          - tool-123e4567-e89b-42d3-8456-426614174000
          title: Tool Id
        description: The ID of the tool in the format 'tool-<uuid4>'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Tools
      summary: Modify Tool
      description: Update an existing tool
      operationId: modify_tool
      parameters:
      - name: tool_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^tool-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the tool in the format 'tool-<uuid4>'
          examples:
          - tool-123e4567-e89b-42d3-8456-426614174000
          title: Tool Id
        description: The ID of the tool in the format 'tool-<uuid4>'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/count:
    get:
      tags:
      - Tools
      summary: Count Tools
      description: Get a count of all tools available to agents belonging to the org of the user.
      operationId: count_tools
      parameters:
      - name: name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
      - name: names
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by specific tool names
          title: Names
        description: Filter by specific tool names
      - name: tool_ids
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by specific tool IDs - accepts repeated params or comma-separated values
          title: Tool Ids
        description: Filter by specific tool IDs - accepts repeated params or comma-separated values
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search tool names (case-insensitive partial match)
          title: Search
        description: Search tool names (case-insensitive partial match)
      - name: tool_types
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by tool type(s) - accepts repeated params or comma-separated values
          title: Tool Types
        description: Filter by tool type(s) - accepts repeated params or comma-separated values
      - name: exclude_tool_types
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Tool type(s) to exclude - accepts repeated params or comma-separated values
          title: Exclude Tool Types
        description: Tool type(s) to exclude - accepts repeated params or comma-separated values
      - name: return_only_letta_tools
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Count only tools with tool_type starting with 'letta_'
          default: false
          title: Return Only Letta Tools
        description: Count only tools with tool_type starting with 'letta_'
      - name: exclude_letta_tools
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Exclude built-in Letta tools from the count
          default: false
          title: Exclude Letta Tools
        description: Exclude built-in Letta tools from the count
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: integer
                title: Response Count Tools
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/:
    get:
      tags:
      - Tools
      summary: List Tools
      description: Get a list of all tools available to agents.
      operationId: list_tools
      parameters:
      - name: before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Tool ID cursor for pagination. Returns tools that come before this tool ID in the specified sort order
          title: Before
        description: Tool ID cursor for pagination. Returns tools that come before this tool ID in the specified sort order
      - name: after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Tool ID cursor for pagination. Returns tools that come after this tool ID in the specified sort order
          title: After
        description: Tool ID cursor for pagination. Returns tools that come after this tool ID in the specified sort order
      - name: limit
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
          - type: 'null'
          description: Maximum number of tools to return
          default: 50
          title: Limit
        description: Maximum number of tools to return
      - name: order
        in: query
        required: false
        schema:
          enum:
          - asc
          - desc
          type: string
          description: Sort order for tools by creation time. 'asc' for oldest first, 'desc' for newest first
          default: desc
          title: Order
        description: Sort order for tools by creation time. 'asc' for oldest first, 'desc' for newest first
      - name: order_by
        in: query
        required: false
        schema:
          const: created_at
          type: string
          description: Field to sort by
          default: created_at
          title: Order By
        description: Field to sort by
      - name: name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by single tool name
          title: Name
        description: Filter by single tool name
      - name: names
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by specific tool names
          title: Names
        description: Filter by specific tool names
      - name: tool_ids
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by specific tool IDs - accepts repeated params or comma-separated values
          title: Tool Ids
        description: Filter by specific tool IDs - accepts repeated params or comma-separated values
      - name: search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search tool names (case-insensitive partial match)
          title: Search
        description: Search tool names (case-insensitive partial match)
      - name: tool_types
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Filter by tool type(s) - accepts repeated params or comma-separated values
          title: Tool Types
        description: Filter by tool type(s) - accepts repeated params or comma-separated values
      - name: exclude_tool_types
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          description: Tool type(s) to exclude - accepts repeated params or comma-separated values
          title: Exclude Tool Types
        description: Tool type(s) to exclude - accepts repeated params or comma-separated values
      - name: return_only_letta_tools
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Return only tools with tool_type starting with 'letta_'
          default: false
          title: Return Only Letta Tools
        description: Return only tools with tool_type starting with 'letta_'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Tool'
                title: Response List Tools
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Tools
      summary: Create Tool
      description: Create a new tool
      operationId: create_tool
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Tools
      summary: Upsert Tool
      description: Create or update a tool
      operationId: upsert_tool
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/search:
    post:
      tags:
      - Tools
      summary: Search Tools
      description: 'Search tools using semantic search.


        Requires tool embedding to be enabled (embed_tools=True). Uses vector search,

        full-text search, or hybrid mode to find tools matching the query.


        Returns tools ranked by relevance with their search scores.'
      operationId: search_tools
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolSearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ToolSearchResult'
                title: Response Search Tools
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/add-base-tools:
    post:
      tags:
      - Tools
      summary: Upsert Base Tools
      description: Upsert base tools
      operationId: add_base_tools
      parameters: []
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Tool'
                title: Response Add Base Tools
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/run:
    post:
      tags:
      - Tools
      summary: Run Tool from Source
      description: Attempt to build a tool from source, then run it on the provided arguments
      operationId: run_tool_from_source
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolRunFromSource'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolReturnMessage'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers:
    get:
      tags:
      - Tools
      summary: List MCP Servers
      description: Get a list of all configured MCP servers
      operationId: list_mcp_servers
      parameters: []
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  anyOf:
                  - $ref: '#/components/schemas/SSEServerConfig'
                  - $ref: '#/components/schemas/StdioServerConfig'
                  - $ref: '#/components/schemas/StreamableHTTPServerConfig'
                title: Response List Mcp Servers
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Tools
      summary: Add MCP Server to Config
      description: Add a new MCP server to the Letta MCP server config
      operationId: add_mcp_server
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/StdioServerConfig'
              - $ref: '#/components/schemas/SSEServerConfig'
              - $ref: '#/components/schemas/StreamableHTTPServerConfig'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  anyOf:
                  - $ref: '#/components/schemas/StdioServerConfig'
                  - $ref: '#/components/schemas/SSEServerConfig'
                  - $ref: '#/components/schemas/StreamableHTTPServerConfig'
                title: Response Add Mcp Server
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/{mcp_server_name}/tools:
    get:
      tags:
      - Tools
      summary: List MCP Tools by Server
      description: Get a list of all tools for a specific MCP server
      operationId: list_mcp_tools_by_server
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MCPTool'
                title: Response List Mcp Tools By Server
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/{mcp_server_name}/resync:
    post:
      tags:
      - Tools
      summary: Resync MCP Server Tools
      description: 'Resync tools for an MCP server by:

        1. Fetching current tools from the MCP server

        2. Deleting tools that no longer exist on the server

        3. Updating schemas for existing tools

        4. Adding new tools from the server


        Returns a summary of changes made.'
      operationId: resync_mcp_server_tools
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      - name: agent_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Agent Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/{mcp_server_name}/{mcp_tool_name}:
    post:
      tags:
      - Tools
      summary: Add MCP Tool
      description: Register a new MCP tool as a Letta server by MCP server + tool name
      operationId: add_mcp_tool
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      - name: mcp_tool_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Tool Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/{mcp_server_name}:
    patch:
      tags:
      - Tools
      summary: Update MCP Server
      description: Update an existing MCP server configuration
      operationId: update_mcp_server
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/letta__schemas__mcp__UpdateStdioMCPServer'
              - $ref: '#/components/schemas/letta__schemas__mcp__UpdateSSEMCPServer'
              - $ref: '#/components/schemas/letta__schemas__mcp__UpdateStreamableHTTPMCPServer'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/StdioServerConfig'
                - $ref: '#/components/schemas/SSEServerConfig'
                - $ref: '#/components/schemas/StreamableHTTPServerConfig'
                title: Response Update Mcp Server
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Tools
      summary: Delete MCP Server from Config
      description: Delete a MCP server configuration
      operationId: delete_mcp_server
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  anyOf:
                  - $ref: '#/components/schemas/StdioServerConfig'
                  - $ref: '#/components/schemas/SSEServerConfig'
                  - $ref: '#/components/schemas/StreamableHTTPServerConfig'
                title: Response Delete Mcp Server
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/test:
    post:
      tags:
      - Tools
      summary: Test MCP Server
      description: 'Test connection to an MCP server without adding it.

        Returns the list of available tools if successful.'
      operationId: test_mcp_server
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/StdioServerConfig'
              - $ref: '#/components/schemas/SSEServerConfig'
              - $ref: '#/components/schemas/StreamableHTTPServerConfig'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/connect:
    post:
      tags:
      - Tools
      summary: Connect MCP Server
      description: 'Connect to an MCP server with support for OAuth via SSE.

        Returns a stream of events handling authorization state and exchange if OAuth is required.'
      operationId: connect_mcp_server
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/StdioServerConfig'
              - $ref: '#/components/schemas/SSEServerConfig'
              - $ref: '#/components/schemas/StreamableHTTPServerConfig'
              title: Request
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema: {}
            text/event-stream:
              description: Server-Sent Events stream
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/servers/{mcp_server_name}/tools/{tool_name}/execute:
    post:
      tags:
      - Tools
      summary: Execute MCP Tool
      description: 'Execute a specific MCP tool from a configured server.

        Returns the tool execution result.'
      operationId: execute_mcp_tool
      parameters:
      - name: mcp_server_name
        in: path
        required: true
        schema:
          type: string
          title: Mcp Server Name
      - name: tool_name
        in: path
        required: true
        schema:
          type: string
          title: Tool Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/letta__server__rest_api__routers__v1__tools__ToolExecuteRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/tools/mcp/oauth/callback:
    get:
      tags:
      - Tools
      summary: MCP Oauth Callback
      description: 'Handle OAuth callback for MCP server authentication.

        Session is identified via the state parameter instead of URL path.'
      operationId: mcp_oauth_callback
      parameters:
      - name: code
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: OAuth authorization code
          title: Code
        description: OAuth authorization code
      - name: state
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: OAuth state parameter
          title: State
        description: OAuth state parameter
      - name: error
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: OAuth error
          title: Error
        description: OAuth error
      - name: error_description
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: OAuth error description
          title: Error Description
        description: OAuth error description
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ToolCreate:
      properties:
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: The description of the tool.
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Metadata tags.
        source_code:
          type: string
          title: Source Code
          description: The source code of the function.
        source_type:
          type: string
          title: Source Type
          description: The source type of the function.
          default: python
        json_schema:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Json Schema
          description: The JSON schema of the function (auto-generated from source_code if not provided)
        args_json_schema:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Args Json Schema
          description: The args JSON schema of the function.
        return_char_limit:
          type: integer
          maximum: 1000000
          minimum: 1
          title: Return Char Limit
          description: The maximum number of characters in the response.
          default: 50000
        pip_requirements:
          anyOf:
          - items:
              $ref: '#/components/schemas/PipRequirement'
            type: array
          - type: 'null'
          title: Pip Requirements
          description: Optional list of pip packages required by this tool.
        npm_requirements:
          anyOf:
          - items:
              $ref: '#/components/schemas/NpmRequirement'
            type: array
          - type: 'null'
          title: Npm Requirements
          description: Optional list of npm packages required by this tool.
        default_requires_approval:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Default Requires Approval
          description: Whether or not to require approval before executing this tool.
        enable_parallel_execution:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Enable Parallel Execution
          description: If set to True, then this tool will potentially be executed concurrently with other tools. Default False.
          default: false
      additionalProperties: false
      type: object
      required:
      - source_code
      title: ToolCreate
    ToolSearchRequest:
      properties:
        query:
          anyOf:
          - type: string
          - type: 'null'
          title: Query
          description: Text query for semantic search.
        search_mode:
          type: string
          enum:
          - vector
          - fts
          - hybrid
          title: Search Mode
          description: 'Search mode: vector, fts, or hybrid.'
          default: hybrid
        tool_types:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tool Types
          description: Filter by tool types (e.g., 'custom', 'letta_core').
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Filter by tags (match any).
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          description: Maximum number of results to r

# --- truncated at 32 KB (60 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/openapi/letta-tools-api-openapi.yml