typespec-create-api-plugin▌
github/awesome-copilot · updated Apr 8, 2026
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 template
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
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★70 reviews- ★★★★★Anika Chen· Dec 8, 2024
Useful defaults in typespec-create-api-plugin — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Advait Jackson· Dec 8, 2024
I recommend typespec-create-api-plugin for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Harper Thomas· Dec 4, 2024
Solid pick for teams standardizing on skills: typespec-create-api-plugin is focused, and the summary matches what you get after install.
- ★★★★★Noah Kim· Dec 4, 2024
typespec-create-api-plugin fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Liam Choi· Nov 27, 2024
typespec-create-api-plugin is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Anaya Khanna· Nov 27, 2024
typespec-create-api-plugin fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Anika Malhotra· Nov 23, 2024
typespec-create-api-plugin has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Noah Rao· Nov 23, 2024
I recommend typespec-create-api-plugin for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Liam Robinson· Oct 18, 2024
typespec-create-api-plugin reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Anaya Tandon· Oct 18, 2024
typespec-create-api-plugin has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 70