Back to Smithery

Create or update a skill

docs-api-reference-skills-create-or-update-a-skill.md

latest7.2 KB
Original Source

PUT

/

skills

/

{namespace}

/

{slug}

Try it

JavaScript

JavaScript

import Smithery from '@smithery/api';

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

const response = await client.skills.set('slug', {
  namespace: 'namespace',
  body: {},
});

console.log(response.id);
curl --request PUT \
  --url https://api.smithery.ai/skills/{namespace}/{slug} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json'
import requests

url = "https://api.smithery.ai/skills/{namespace}/{slug}"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.smithery.ai/skills/{namespace}/{slug}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smithery.ai/skills/{namespace}/{slug}"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.smithery.ai/skills/{namespace}/{slug}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.smithery.ai/skills/{namespace}/{slug}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body

200

201

400

403

404

409

422

{
  "id": "<string>",
  "namespace": "<string>",
  "slug": "<string>",
  "displayName": "<string>",
  "description": "<string>",
  "gitUrl": "<string>",
  "externalStars": 123,
  "listed": true,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
{
  "id": "<string>",
  "namespace": "<string>",
  "slug": "<string>",
  "displayName": "<string>",
  "description": "<string>",
  "gitUrl": "<string>",
  "externalStars": 123,
  "listed": true,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}

Authorizations

[​

](#authorization-authorization)

Authorization

string

header

required

Smithery API key as Bearer token

Path Parameters

[​

](#parameter-namespace)

namespace

string

required

[​

](#parameter-slug)

slug

string

required

Body

application/json

The body is of type any.

Response

200

application/json

Skill updated successfully

[​

](#response-id)

id

string

required

[​

](#response-namespace)

namespace

string

required

[​

](#response-slug)

slug

string

required

[​

](#response-display-name)

displayName

string

required

[​

](#response-description)

description

string

required

[​

](#response-git-url-one-of-0)

gitUrl

string | null

required

[​

](#response-external-stars)

externalStars

number

required

[​

](#response-listed)

listed

boolean

required

[​

](#response-created-at)

createdAt

string

required

[​

](#response-updated-at)

updatedAt

string

required

Was this page helpful?

YesNo

⌘I

JavaScript

JavaScript

import Smithery from '@smithery/api';

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

const response = await client.skills.set('slug', {
  namespace: 'namespace',
  body: {},
});

console.log(response.id);
curl --request PUT \
  --url https://api.smithery.ai/skills/{namespace}/{slug} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json'
import requests

url = "https://api.smithery.ai/skills/{namespace}/{slug}"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.smithery.ai/skills/{namespace}/{slug}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smithery.ai/skills/{namespace}/{slug}"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.smithery.ai/skills/{namespace}/{slug}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.smithery.ai/skills/{namespace}/{slug}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body

200

201

400

403

404

409

422

{
  "id": "<string>",
  "namespace": "<string>",
  "slug": "<string>",
  "displayName": "<string>",
  "description": "<string>",
  "gitUrl": "<string>",
  "externalStars": 123,
  "listed": true,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
{
  "id": "<string>",
  "namespace": "<string>",
  "slug": "<string>",
  "displayName": "<string>",
  "description": "<string>",
  "gitUrl": "<string>",
  "externalStars": 123,
  "listed": true,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}
{
  "error": "<string>",
  "code": "<string>"
}