Create tool

createTool(projectReference: String!, input: CreateToolInput!): ToolSource!

Requires project.agents.write.

Arguments

ArgumentTypeRequired
projectReferenceString!Yes
inputCreateToolInput!Yes

Input fields

input

CreateToolInput

FieldTypeRequiredDescription
idString!YesBecomes the file name and the tool id.
descriptionStringNo
sourceTargetKindWriteTargetKindNoThe source to write; default project.
targetBranchIdIDNoRequired with the kind preview_branch.

Response

Returns ToolSource!. Open the type for its fields and nested types.

FieldTypeDescription
idID!
nameString!
descriptionString
sourcePathString!
sourceString!The source text of the tool file.
editModeSourceEditMode!
sourceOnlyReasons[String!]!Why the tool can only be edited as source; empty for a structured tool.

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
mutation CreateTool($projectReference: String!, $input: CreateToolInput!) {
  createTool(projectReference: $projectReference, input: $input) {
    id
    name
    description
    editMode
    source
  }
}
json
{
  "projectReference": "00000000-0000-4000-8000-000000000001",
  "input": {
    "id": "example"
  }
}