typespec-create-api-plugin
github/awesome-copilot
Generate TypeSpec API plugins for Microsoft 365 Copilot with REST operations, auth, and Adaptive Cards
What is typespec-create-api-plugin?
Creates complete TypeSpec API plugin scaffolding for Microsoft 365 Copilot that integrates external REST APIs. Use this when you need to build a Copilot plugin with defined operations, authentication, and rich response formatting.
- Generates main.tsp agent definition with operation references
- Creates actions.tsp with REST operations and TypeSpec models
- Supports multiple authentication methods (API Key, OAuth2, public APIs)
- Adds confirmation dialogs for destructive operations
- Generates Adaptive Card templates for rich response formatting
- Includes reasoning and response instruction decorators
How to install typespec-create-api-plugin
npx skills add https://github.com/github/awesome-copilot --skill typespec-create-api-plugin- Understanding of REST API structure and HTTP methods
- Familiarity with TypeSpec syntax and decorators
- Knowledge of the target API's base URL, operations, and authentication method
- Microsoft 365 Copilot development environment
How to use typespec-create-api-plugin
- 1.Gather API details: base URL, purpose, and available operations
- 2.Determine authentication method (none, API Key, OAuth2, or registered auth)
- 3.Identify which CRUD operations to expose and their parameters
- 4.Decide if confirmations are needed for any operations
- 5.Specify if responses should use Adaptive Cards
- 6.Run the skill and provide answers to the workflow questions
- 7.Review generated main.tsp and actions.tsp files
- 8.Customize models, paths, and descriptions as needed
Use cases
- Building a Copilot plugin to integrate with a third-party REST API
- Creating CRUD operations for an external service within Microsoft 365
- Adding authentication and confirmation dialogs to sensitive API operations
- Generating rich card-based responses for multi-item API results
- Scaffolding a complete plugin structure from API requirements
- Microsoft 365 Copilot plugin developers
- Backend developers integrating external APIs
- Teams building enterprise Copilot extensions
- Developers familiar with TypeSpec syntax
typespec-create-api-plugin FAQ
API Key (header-based), OAuth2 with authorization code flow, registered auth references, and public APIs with no authentication.
Use the @card decorator with dataPath, title, url, and file properties pointing to a cards/card.json template file.
Add confirmations for destructive operations (delete, update) or any action that modifies critical data using the @capabilities decorator.
Operations use @route, @get/@post/@patch/@delete decorators, with parameters marked as @path, @query, @header, or @body, and return typed response models.
Yes, the generated files are standard TypeSpec. You can modify models, add operations, adjust descriptions, and customize authentication and card templates.
Full instructions (SKILL.md)
Source of truth, from github/awesome-copilot.
name: typespec-create-api-plugin description: 'Generate a TypeSpec API plugin with REST operations, authentication, and Adaptive Cards for Microsoft 365 Copilot'
Create TypeSpec API Plugin
Create a complete TypeSpec API plugin for Microsoft 365 Copilot that integrates with external REST APIs.
Requirements
Generate TypeSpec files with:
main.tsp - Agent Definition
import "@typespec/http";
import "@typespec/openapi3";
import "@microsoft/typespec-m365-copilot";
import "./actions.tsp";
using TypeSpec.Http;
using TypeSpec.M365.Copilot.Agents;
using TypeSpec.M365.Copilot.Actions;
@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 & 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.
""")
Best Practices
- Operation Names: Use clear, action-oriented names (listProjects, createTicket)
- Models: Define TypeScript-like models for requests and responses
- HTTP Methods: Use appropriate verbs (@get, @post, @patch, @delete)
- Paths: Use RESTful path conventions with @route
- Parameters: Use @path, @query, @header, @body appropriately
- Descriptions: Provide clear descriptions for model understanding
- Confirmations: Add for destructive operations (delete, update critical data)
- Cards: Use for rich visual responses with multiple data items
Workflow
Ask the user:
- What is the API base URL and purpose?
- What operations are needed (CRUD operations)?
- What authentication method does the API use?
- Should confirmations be required for any operations?
- Do responses need Adaptive Cards?
Then generate:
- Complete
main.tspwith agent definition - Complete
actions.tspwith API operations and models - Optional
cards/card.jsonif Adaptive Cards are needed
Related skills
More from github/awesome-copilot and the wider catalog.

unit-test-vue-pinia
Write and review unit tests for Vue 3 + TypeScript + Vitest + Pinia codebases with behavior-first patterns.

update-avm-modules-in-bicep
Update Azure Verified Modules to latest versions in Bicep files with breaking change detection.

update-implementation-plan
Update implementation plan files with new requirements for features, refactoring, upgrades, and infrastructure changes.

update-llms
Keeps your repo's llms.txt navigation file accurate and spec-compliant as docs evolve.

update-markdown-file-index
Auto-generate and maintain file indexes in markdown documents from folder contents.

update-oo-component-documentation
Update OO component documentation to match current implementation using industry standards.