typespec-create-api-plugin

Generate TypeSpec API plugins for Microsoft 365 Copilot with REST operations, authentication, and Adaptive Cards. Scaffolds complete TypeSpec projects with agent definitions (main.tsp) and API operations (actions.tsp) following Microsoft 365 Copilot conventions Supports four authentication modes: public APIs, API key headers, OAuth2 with authorization code flow, and registered auth references Includes optional confirmation dialogs for destructive operations and Adaptive Card templates for rich response formatting Provides decorators for operation reasoning, response instructions, and model definitions aligned with RESTful best practices

INSTALLATION
npx skills add https://github.com/github/awesome-copilot --skill typespec-create-api-plugin
Run in your project or agent environment. Adjust flags if your CLI version differs.

SKILL.md

$2a

@agent({

name: "[Agent Name]",

description: "[Description]"

})

@instructions("""

[Instructions for using the API operations]

""")

namespace [AgentName] {

// Reference operations from actions.tsp

op operation1 is [APINamespace].operationName;

}

### actions.tsp - API Operations

import "@typespec/http";

import "@microsoft/typespec-m365-copilot";

using TypeSpec.Http;

using TypeSpec.M365.Copilot.Actions;

@service

@actions(#{

nameForHuman: "[API Display Name]",

descriptionForModel: "[Model description]",

descriptionForHuman: "[User description]"

})

@server("[API_BASE_URL]", "[API Name]")

@useAuth([AuthType]) // Optional

namespace [APINamespace] {

@route("[/path]")

@get

@action

op operationName(

@path param1: string,

@query param2?: string

): ResponseModel;

model ResponseModel {

// Response structure

}

}


## Authentication Options

Choose based on API requirements:

-

**No Authentication** (Public APIs)

// No @useAuth decorator needed


-

**API Key**

@useAuth(ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">)


-

**OAuth2**

@useAuth(OAuth2Auth<[{

type: OAuth2FlowType.authorizationCode;

authorizationUrl: "https://oauth.example.com/authorize";

tokenUrl: "https://oauth.example.com/token";

refreshUrl: "https://oauth.example.com/token";

scopes: ["read", "write"];

}]>)


-

**Registered Auth Reference**

@useAuth(Auth)

@authReferenceId("registration-id-here")

model Auth is ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">


## Function Capabilities

### Confirmation Dialog

@capabilities(#{

confirmation: #{

type: "AdaptiveCard",

title: "Confirm Action",

body: """

Are you sure you want to perform this action?

* Parameter: {{ function.parameters.paramName }}

"""

}

})


### Adaptive Card Response

@card(#{

dataPath: "$.items",

title: "$.title",

url: "$.link",

file: "cards/card.json"

})


### Reasoning &#x26; Response Instructions

@reasoning("""

Consider user's context when calling this operation.

Prioritize recent items over older ones.

""")

@responding("""

Present results in a clear table format with columns: ID, Title, Status.

Include a summary count at the end.

""")

BrowserAct

Let your agent run on any real-world website

Bypass CAPTCHA & anti-bot for free. Start local, scale to cloud.

Explore BrowserAct Skills →

Stop writing automation&scrapers

Install the CLI. Run your first Skill in 30 seconds. Scale when you're ready.

Start free
free · no credit card