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

# Creates tool

> Data needed to create a new tool



## OpenAPI

````yaml post /sdk/v1/tools
openapi: 3.0.0
info:
  title: Prompt Foundry API
  version: 1.0.0
  description: The API for managing prompts, tools, evaluations, and evaluation assertions.
servers:
  - url: https://api.promptfoundry.ai
    description: Prompt Foundry Production API
security: []
paths:
  /sdk/v1/tools:
    post:
      summary: Creates tool
      description: Data needed to create a new tool
      operationId: createTool
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolBody'
      responses:
        '201':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '400':
          description: Missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import PromptFoundry from '@prompt-foundry/typescript-sdk';

            const client = new PromptFoundry({
              apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
            });

            async function main() {
              const tool = await client.tools.create({
                description: 'description',
                name: 'name',
                parameters: { foo: 'bar' },
              });

              console.log(tool.id);
            }

            main();
        - lang: Python
          source: |-
            import os
            from prompt_foundry_python_sdk import PromptFoundry

            client = PromptFoundry(
                # This is the default and can be omitted
                api_key=os.environ.get("PROMPT_FOUNDRY_API_KEY"),
            )
            tool = client.tools.create(
                description="description",
                name="name",
                parameters={
                    "foo": "bar"
                },
            )
            print(tool.id)
components:
  schemas:
    ToolBody:
      type: object
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9_-]{1,64}$
          description: >-
            The name of the tool to be called. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.
        description:
          type: string
          description: >-
            A description of what the tool does, used by the model to choose
            when and how to call the tool.
        parameters:
          $ref: '#/components/schemas/ToolParameters'
      required:
        - name
        - description
        - parameters
    Tool:
      type: object
      properties:
        id:
          type: string
          description: The initial messages to be included with your call to the LLM API.
        name:
          type: string
          pattern: ^[a-zA-Z0-9_-]{1,64}$
          description: >-
            The name of the tool to be called. Must be a-z, A-Z, 0-9, or contain
            underscores and dashes, with a maximum length of 64.
        description:
          type: string
          description: >-
            A description of what the tool does, used by the model to choose
            when and how to call the tool.
        parameters:
          $ref: '#/components/schemas/ToolParameters'
      required:
        - id
        - name
        - description
        - parameters
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: 'Example: "Prompt ID is required."'
      required:
        - error
    ToolParameters:
      type: object
      additionalProperties:
        nullable: true
      description: >-
        The parameters the functions accepts, described as a JSON Schema object.
        This schema is designed to match the TypeScript Record<string, unknown>,
        allowing for any properties with values of any type.

````