@frontmcp/skills 0.0.1 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +156 -0
- package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +5 -0
- package/catalog/frontmcp-config/references/configure-auth.md +243 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +183 -0
- package/catalog/frontmcp-config/references/configure-http.md +210 -0
- package/catalog/frontmcp-config/references/configure-session.md +210 -0
- package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +5 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +234 -0
- package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +5 -0
- package/catalog/frontmcp-config/references/configure-transport.md +200 -0
- package/catalog/frontmcp-config/references/setup-redis.md +9 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +9 -0
- package/catalog/frontmcp-deployment/SKILL.md +152 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +143 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +191 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +66 -20
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +218 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +77 -59
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +18 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +69 -36
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +65 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +229 -0
- package/catalog/frontmcp-development/SKILL.md +126 -0
- package/catalog/frontmcp-development/references/create-adapter.md +170 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +10 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +83 -40
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +62 -15
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +100 -7
- package/catalog/frontmcp-development/references/create-plugin.md +506 -0
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +65 -22
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +63 -23
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +148 -26
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +174 -20
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +114 -28
- package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +5 -0
- package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +5 -0
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +172 -23
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +61 -14
- package/catalog/frontmcp-development/references/decorators-guide.md +754 -0
- package/catalog/frontmcp-development/references/official-adapters.md +199 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +97 -27
- package/catalog/frontmcp-extensibility/SKILL.md +103 -0
- package/catalog/frontmcp-extensibility/references/vectoriadb.md +289 -0
- package/catalog/frontmcp-guides/SKILL.md +420 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +641 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +517 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +297 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +98 -0
- package/catalog/frontmcp-production-readiness/references/common-checklist.md +156 -0
- package/catalog/frontmcp-production-readiness/references/production-browser.md +46 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-binary.md +62 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +52 -0
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +53 -0
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +66 -0
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +52 -0
- package/catalog/frontmcp-setup/SKILL.md +132 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +280 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +66 -19
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +79 -17
- package/catalog/frontmcp-setup/references/project-structure-nx.md +251 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +217 -0
- package/catalog/frontmcp-setup/references/readme-guide.md +226 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +63 -58
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +60 -82
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +65 -72
- package/catalog/frontmcp-testing/SKILL.md +135 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +79 -63
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +6 -0
- package/catalog/skills-manifest.json +337 -382
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js.map +1 -1
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +15 -3
- package/src/manifest.js +3 -3
- package/src/manifest.js.map +1 -1
- package/catalog/adapters/create-adapter/SKILL.md +0 -127
- package/catalog/adapters/official-adapters/SKILL.md +0 -136
- package/catalog/auth/configure-auth/SKILL.md +0 -250
- package/catalog/auth/configure-session/SKILL.md +0 -201
- package/catalog/config/configure-elicitation/SKILL.md +0 -136
- package/catalog/config/configure-http/SKILL.md +0 -167
- package/catalog/config/configure-throttle/SKILL.md +0 -189
- package/catalog/config/configure-transport/SKILL.md +0 -151
- package/catalog/deployment/build-for-browser/SKILL.md +0 -95
- package/catalog/deployment/build-for-cli/SKILL.md +0 -100
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
- package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
- package/catalog/development/decorators-guide/SKILL.md +0 -598
- package/catalog/plugins/create-plugin/SKILL.md +0 -336
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
- package/catalog/setup/project-structure-nx/SKILL.md +0 -186
- package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-skill
|
|
3
|
-
description: Create instruction-only skills that
|
|
4
|
-
tags: [skill, instructions, knowledge, workflow, guide]
|
|
5
|
-
priority: 7
|
|
6
|
-
visibility: both
|
|
7
|
-
license: Apache-2.0
|
|
8
|
-
metadata:
|
|
9
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/skills
|
|
3
|
+
description: Create instruction-only skills that package knowledge and workflow guides for AI clients
|
|
10
4
|
---
|
|
11
5
|
|
|
12
6
|
# Creating Instruction-Only Skills
|
|
13
7
|
|
|
14
8
|
Skills are knowledge and workflow packages that teach AI clients how to accomplish tasks. Unlike tools (which execute actions) or agents (which run autonomous LLM loops), a skill provides structured instructions that the AI follows on its own. An instruction-only skill contains no tool references -- it is purely a guide.
|
|
15
9
|
|
|
16
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
### Must Use
|
|
19
13
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- Deployment runbooks without automated steps
|
|
24
|
-
- Review criteria and quality gates
|
|
14
|
+
- You need to package knowledge, conventions, or workflow steps as a reusable skill that AI clients can follow
|
|
15
|
+
- You are creating a SKILL.md catalog entry or a class/function-based skill with no tool dependencies
|
|
16
|
+
- You want to enforce coding standards, onboarding steps, or review criteria through structured AI guidance
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- You are building a deployment runbook, architecture decision record, or quality gate checklist
|
|
21
|
+
- You want to share workflow templates across teams via MCP or HTTP discovery endpoints
|
|
22
|
+
- You need parameterized instructions that callers can customize per invocation
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- The skill must invoke MCP tools during execution -- use `create-skill-with-tools` instead
|
|
27
|
+
- You need an autonomous agent loop rather than static instructions -- use an agent pattern instead
|
|
28
|
+
- The content is a one-off prompt with no reuse value -- a plain prompt template is simpler
|
|
29
|
+
|
|
30
|
+
> **Decision:** Pick this skill when you need a reusable, instruction-only knowledge package that guides AI through a workflow without requiring tool calls.
|
|
27
31
|
|
|
28
32
|
## Class-Based Pattern
|
|
29
33
|
|
|
@@ -31,16 +35,23 @@ Create a class extending `SkillContext` and decorate it with `@Skill`. The decor
|
|
|
31
35
|
|
|
32
36
|
### SkillMetadata Fields
|
|
33
37
|
|
|
34
|
-
| Field | Type | Required | Description
|
|
35
|
-
| ------------------- | ----------------------------------------------- | -------- |
|
|
36
|
-
| `name` | `string` | Yes | Unique skill name in kebab-case
|
|
37
|
-
| `description` | `string` | Yes | Short description
|
|
38
|
-
| `instructions` | `string \| { file: string } \| { url: string }` | Yes | The skill content -- see instruction sources below
|
|
39
|
-
| `parameters` | `SkillParameter[]` | No | Customization parameters for the skill
|
|
40
|
-
| `examples` | `SkillExample[]` | No | Usage scenarios and expected outcomes
|
|
41
|
-
| `tags` | `string[]` | No | Categorization tags for discovery
|
|
42
|
-
| `visibility` | `'mcp' \| 'http' \| 'both'` | No | Where the skill is discoverable (default: `'both'`)
|
|
43
|
-
| `hideFromDiscovery` | `boolean` | No | Register but hide from listing endpoints (default: `false`)
|
|
38
|
+
| Field | Type | Required | Description |
|
|
39
|
+
| ------------------- | ----------------------------------------------- | -------- | -------------------------------------------------------------- |
|
|
40
|
+
| `name` | `string` | Yes | Unique skill name in kebab-case (max 64 chars) |
|
|
41
|
+
| `description` | `string` | Yes | Short description (max 1024 chars, no HTML/XML) |
|
|
42
|
+
| `instructions` | `string \| { file: string } \| { url: string }` | Yes | The skill content -- see instruction sources below |
|
|
43
|
+
| `parameters` | `SkillParameter[]` | No | Customization parameters for the skill |
|
|
44
|
+
| `examples` | `SkillExample[]` | No | Usage scenarios and expected outcomes |
|
|
45
|
+
| `tags` | `string[]` | No | Categorization tags for discovery |
|
|
46
|
+
| `visibility` | `'mcp' \| 'http' \| 'both'` | No | Where the skill is discoverable (default: `'both'`) |
|
|
47
|
+
| `hideFromDiscovery` | `boolean` | No | Register but hide from listing endpoints (default: `false`) |
|
|
48
|
+
| `priority` | `number` | No | Search ranking weight; higher = earlier (default: `0`) |
|
|
49
|
+
| `toolValidation` | `'strict' \| 'warn' \| 'ignore'` | No | Behavior when referenced tools are missing (default: `'warn'`) |
|
|
50
|
+
| `license` | `string` | No | License identifier per Agent Skills spec (e.g., `'MIT'`) |
|
|
51
|
+
| `compatibility` | `string` | No | Environment requirements (max 500 chars) |
|
|
52
|
+
| `specMetadata` | `Record<string, string>` | No | Arbitrary key-value map (Agent Skills spec `metadata` field) |
|
|
53
|
+
| `allowedTools` | `string` | No | Space-delimited pre-approved tool names (Agent Skills spec) |
|
|
54
|
+
| `resources` | `SkillResources` | No | Bundled dirs: `{ scripts?, references?, assets? }` |
|
|
44
55
|
|
|
45
56
|
### Basic Example
|
|
46
57
|
|
|
@@ -111,17 +122,27 @@ class GitCommitGuideSkill extends SkillContext {}
|
|
|
111
122
|
|
|
112
123
|
### File Reference
|
|
113
124
|
|
|
114
|
-
Load instructions from a Markdown file. The path is relative to the skill
|
|
125
|
+
Load instructions from a Markdown file. The path is resolved relative to the file that defines the skill (for both `@Skill` class decorators and `skill()` function calls).
|
|
115
126
|
|
|
116
127
|
```typescript
|
|
128
|
+
// Class-based: path resolves relative to this file's directory
|
|
117
129
|
@Skill({
|
|
118
130
|
name: 'architecture-guide',
|
|
119
131
|
description: 'System architecture overview and patterns',
|
|
120
132
|
instructions: { file: './docs/architecture.md' },
|
|
121
133
|
})
|
|
122
134
|
class ArchitectureGuideSkill extends SkillContext {}
|
|
135
|
+
|
|
136
|
+
// Function-based: same behavior — path resolves relative to this file's directory
|
|
137
|
+
export default skill({
|
|
138
|
+
name: 'architecture-guide',
|
|
139
|
+
description: 'System architecture overview and patterns',
|
|
140
|
+
instructions: { file: './docs/architecture.md' },
|
|
141
|
+
});
|
|
123
142
|
```
|
|
124
143
|
|
|
144
|
+
> **Directory structure example:** If this file is at `src/skills/arch.skill.ts`, the instruction file should be at `src/skills/docs/architecture.md`.
|
|
145
|
+
|
|
125
146
|
### URL Reference
|
|
126
147
|
|
|
127
148
|
Load instructions from a remote URL. Fetched at build time when the skill is loaded.
|
|
@@ -211,13 +232,26 @@ const CodeReviewChecklist = skill({
|
|
|
211
232
|
|
|
212
233
|
Register it the same way as a class skill: `skills: [CodeReviewChecklist]`.
|
|
213
234
|
|
|
235
|
+
The function builder also supports file-based instructions. Relative paths resolve from the file that calls `skill()`:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// src/skills/deploy-guide.skill.ts
|
|
239
|
+
import { skill } from '@frontmcp/sdk';
|
|
240
|
+
|
|
241
|
+
export default skill({
|
|
242
|
+
name: 'deploy-guide',
|
|
243
|
+
description: 'Step-by-step deployment checklist',
|
|
244
|
+
instructions: { file: './docs/deploy-guide.md' }, // resolves to src/skills/docs/deploy-guide.md
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
214
248
|
## Directory-Based Skills with skillDir()
|
|
215
249
|
|
|
216
250
|
Use `skillDir()` to load a skill from a directory containing a `SKILL.md` file with YAML frontmatter, plus optional subdirectories for scripts, references, and assets.
|
|
217
251
|
|
|
218
252
|
### Directory Structure
|
|
219
253
|
|
|
220
|
-
```
|
|
254
|
+
```text
|
|
221
255
|
skills/
|
|
222
256
|
coding-standards/
|
|
223
257
|
SKILL.md # Instructions with YAML frontmatter
|
|
@@ -448,7 +482,7 @@ import { Skill, SkillContext, FrontMcp, App, skill, skillDir } from '@frontmcp/s
|
|
|
448
482
|
|
|
449
483
|
## Step 1: Environment Setup
|
|
450
484
|
1. Clone the repository
|
|
451
|
-
2. Install Node.js
|
|
485
|
+
2. Install Node.js 24+ and Yarn
|
|
452
486
|
3. Run \`yarn install\` to install dependencies
|
|
453
487
|
4. Copy \`.env.example\` to \`.env\` and fill in values
|
|
454
488
|
|
|
@@ -524,3 +558,55 @@ class OnboardingApp {}
|
|
|
524
558
|
})
|
|
525
559
|
class DevServer {}
|
|
526
560
|
```
|
|
561
|
+
|
|
562
|
+
## Common Patterns
|
|
563
|
+
|
|
564
|
+
| Pattern | Correct | Incorrect | Why |
|
|
565
|
+
| ----------------------------------- | ------------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
566
|
+
| Instruction source for short guides | `instructions: 'Use PascalCase for classes...'` | Loading a one-paragraph guide from a separate file | Inline strings keep short skills self-contained and easier to review |
|
|
567
|
+
| Instruction source for long content | `instructions: { file: './docs/guide.md' }` | Pasting 200+ lines as a template literal | File references keep the class readable and the content editable in Markdown tooling |
|
|
568
|
+
| Skill naming | `name: 'api-design-guide'` (kebab-case) | `name: 'ApiDesignGuide'` or `name: 'api design guide'` | The `name` field must be kebab-case to match registry lookup and URL conventions |
|
|
569
|
+
| Visibility for internal runbooks | `visibility: 'mcp'` | `visibility: 'both'` for sensitive content | Internal procedures should not be exposed on public HTTP endpoints like `/llm.txt` |
|
|
570
|
+
| Function builder for simple skills | `const s = skill({ name, description, instructions })` | Creating a class with an empty body just to use `@Skill` | The function builder avoids boilerplate when no custom `build()` override is needed |
|
|
571
|
+
|
|
572
|
+
## Verification Checklist
|
|
573
|
+
|
|
574
|
+
### Structure
|
|
575
|
+
|
|
576
|
+
- [ ] Skill has a unique kebab-case `name`
|
|
577
|
+
- [ ] `description` is a single sentence explaining what the skill teaches
|
|
578
|
+
- [ ] `instructions` field is set (inline string, file reference, or URL reference)
|
|
579
|
+
- [ ] No tool references appear in the instructions (instruction-only skill)
|
|
580
|
+
|
|
581
|
+
### Metadata
|
|
582
|
+
|
|
583
|
+
- [ ] `tags` array includes relevant categorization keywords
|
|
584
|
+
- [ ] `visibility` is set appropriately (`'mcp'`, `'http'`, or `'both'`)
|
|
585
|
+
- [ ] `parameters` have `name`, `description`, and `type` defined if present
|
|
586
|
+
- [ ] `examples` include `scenario` and `expectedOutcome` if present
|
|
587
|
+
|
|
588
|
+
### Registration
|
|
589
|
+
|
|
590
|
+
- [ ] Skill class or function is added to the `skills` array in `@App` or `@FrontMcp`
|
|
591
|
+
- [ ] Barrel export (`index.ts`) is updated if the skill is part of a publishable library
|
|
592
|
+
- [ ] Test file (`*.spec.ts`) exists and covers metadata and build output
|
|
593
|
+
|
|
594
|
+
### Discovery
|
|
595
|
+
|
|
596
|
+
- [ ] Skill appears in `GET /skills` or MCP tool listing based on visibility setting
|
|
597
|
+
- [ ] `hideFromDiscovery` is only set to `true` when the skill must be invoked by name only
|
|
598
|
+
|
|
599
|
+
## Troubleshooting
|
|
600
|
+
|
|
601
|
+
| Problem | Cause | Fix |
|
|
602
|
+
| ------------------------------------------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
603
|
+
| Skill does not appear in `/llm.txt` or `/skills` | `visibility` is set to `'mcp'` or `hideFromDiscovery` is `true` | Set `visibility: 'both'` and `hideFromDiscovery: false` |
|
|
604
|
+
| `loadInstructions()` returns empty string | File reference path is wrong or the file is empty | Verify the path is relative to the skill file location and the target file has content |
|
|
605
|
+
| `build()` throws "instructions required" | The `instructions` field is missing or `undefined` in `@Skill` metadata | Provide an inline string, `{ file: '...' }`, or `{ url: '...' }` |
|
|
606
|
+
| Skill parameters are ignored by the AI | Parameters are declared but not referenced in the instruction text | Mention each parameter by name in the instructions so the AI knows how to apply them |
|
|
607
|
+
| Directory-based skill missing bundled files | Subdirectories are not named `scripts/`, `references/`, or `assets/` | Use the exact conventional directory names; other names are not auto-bundled |
|
|
608
|
+
|
|
609
|
+
## Reference
|
|
610
|
+
|
|
611
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/servers/skills>
|
|
612
|
+
- **Related skills:** `create-skill-with-tools` (skills that reference MCP tools), `setup-project` (project scaffolding workflows)
|
package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md}
RENAMED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-tool
|
|
3
|
-
description:
|
|
4
|
-
tags: [tools, mcp, zod, schema, decorator]
|
|
5
|
-
tools:
|
|
6
|
-
- name: create_tool
|
|
7
|
-
purpose: Scaffold a new tool class
|
|
8
|
-
parameters:
|
|
9
|
-
- name: name
|
|
10
|
-
description: Tool name in snake_case
|
|
11
|
-
type: string
|
|
12
|
-
required: true
|
|
13
|
-
examples:
|
|
14
|
-
- scenario: Create a calculator tool with add operation
|
|
15
|
-
expected-outcome: Tool registered and callable via MCP
|
|
16
|
-
- scenario: Create a tool with DI and error handling
|
|
17
|
-
expected-outcome: Tool using providers and proper error classes
|
|
18
|
-
priority: 10
|
|
19
|
-
visibility: both
|
|
20
|
-
license: Apache-2.0
|
|
21
|
-
metadata:
|
|
22
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/tools
|
|
3
|
+
description: Build MCP tools with Zod input/output validation and dependency injection
|
|
23
4
|
---
|
|
24
5
|
|
|
25
6
|
# Creating an MCP Tool
|
|
26
7
|
|
|
27
8
|
Tools are the primary way to expose executable actions to AI clients in the MCP protocol. In FrontMCP, tools are TypeScript classes that extend `ToolContext`, decorated with `@Tool`, and registered on a `@FrontMcp` server or inside an `@App`.
|
|
28
9
|
|
|
29
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
30
11
|
|
|
31
|
-
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Building a new executable action that AI clients can invoke via MCP
|
|
15
|
+
- Defining typed input schemas with Zod validation for tool parameters
|
|
16
|
+
- Adding output schema validation to prevent data leaks from tool responses
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Adding rate limiting, concurrency control, or timeouts to existing tools
|
|
21
|
+
- Integrating dependency injection into tool execution
|
|
22
|
+
- Converting raw function handlers into class-based `ToolContext` patterns
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- Exposing read-only data that does not require execution logic (see `create-resource`)
|
|
27
|
+
- Building conversational templates or system prompts (see `create-prompt`)
|
|
28
|
+
- Orchestrating multi-tool workflows with conditional logic (see `create-agent`)
|
|
29
|
+
|
|
30
|
+
> **Decision:** Use this skill when you need an AI-callable action that accepts validated input, performs work, and returns structured output.
|
|
32
31
|
|
|
33
32
|
## Class-Based Pattern
|
|
34
33
|
|
|
@@ -73,7 +72,19 @@ class GreetUserTool extends ToolContext {
|
|
|
73
72
|
- `this.output` -- the output (available after execute)
|
|
74
73
|
- `this.metadata` -- tool metadata from the decorator
|
|
75
74
|
- `this.scope` -- the current scope instance
|
|
76
|
-
- `this.context` -- the execution context
|
|
75
|
+
- `this.context` -- the execution context (see below)
|
|
76
|
+
|
|
77
|
+
**`this.context` properties (FrontMcpContext):**
|
|
78
|
+
|
|
79
|
+
| Property | Type | Description |
|
|
80
|
+
| -------------- | ------------------- | ----------------------------------- |
|
|
81
|
+
| `requestId` | `string` | Unique ID for this request |
|
|
82
|
+
| `sessionId` | `string` | Session identifier |
|
|
83
|
+
| `scopeId` | `string` | Scope identifier |
|
|
84
|
+
| `authInfo` | `Partial<AuthInfo>` | Authentication info for the request |
|
|
85
|
+
| `traceContext` | `TraceContext` | Distributed tracing context |
|
|
86
|
+
| `timestamp` | `number` | Request timestamp |
|
|
87
|
+
| `metadata` | `RequestMetadata` | Request headers, client IP, etc. |
|
|
77
88
|
|
|
78
89
|
## Input Schema: Zod Raw Shapes
|
|
79
90
|
|
|
@@ -416,3 +427,141 @@ class ExpensiveOperationTool extends ToolContext {
|
|
|
416
427
|
}
|
|
417
428
|
}
|
|
418
429
|
```
|
|
430
|
+
|
|
431
|
+
## Auth Providers
|
|
432
|
+
|
|
433
|
+
Declare which auth providers a tool requires. Credentials are loaded before tool execution.
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
// String shorthand — single provider
|
|
437
|
+
@Tool({
|
|
438
|
+
name: 'create_issue',
|
|
439
|
+
description: 'Create a GitHub issue',
|
|
440
|
+
inputSchema: { title: z.string(), body: z.string() },
|
|
441
|
+
authProviders: ['github'],
|
|
442
|
+
})
|
|
443
|
+
class CreateIssueTool extends ToolContext {
|
|
444
|
+
/* ... */
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Full mapping — with scopes and required flag
|
|
448
|
+
@Tool({
|
|
449
|
+
name: 'deploy_app',
|
|
450
|
+
description: 'Deploy to cloud',
|
|
451
|
+
inputSchema: { env: z.string() },
|
|
452
|
+
authProviders: [
|
|
453
|
+
{ name: 'github', required: true, scopes: ['repo', 'workflow'] },
|
|
454
|
+
{ name: 'aws', required: false, alias: 'cloud' },
|
|
455
|
+
],
|
|
456
|
+
})
|
|
457
|
+
class DeployAppTool extends ToolContext {
|
|
458
|
+
/* ... */
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Auth provider mapping fields:
|
|
463
|
+
|
|
464
|
+
- `name` — Provider name (must match a registered `@AuthProvider`)
|
|
465
|
+
- `required?` — Whether credential is required (default: `true`)
|
|
466
|
+
- `scopes?` — Required OAuth scopes
|
|
467
|
+
- `alias?` — Alias for injection when using multiple providers
|
|
468
|
+
|
|
469
|
+
## Elicitation (Interactive Input)
|
|
470
|
+
|
|
471
|
+
Tools can request interactive input from users mid-execution using `this.elicit()`. Requires `elicitation` to be enabled at server level.
|
|
472
|
+
|
|
473
|
+
```typescript
|
|
474
|
+
@Tool({
|
|
475
|
+
name: 'confirm_delete',
|
|
476
|
+
description: 'Delete a resource after user confirmation',
|
|
477
|
+
inputSchema: { resourceId: z.string() },
|
|
478
|
+
})
|
|
479
|
+
class ConfirmDeleteTool extends ToolContext {
|
|
480
|
+
async execute(input: { resourceId: string }) {
|
|
481
|
+
const result = await this.elicit('Are you sure you want to delete this resource?', {
|
|
482
|
+
confirm: z.boolean().describe('Confirm deletion'),
|
|
483
|
+
reason: z.string().optional().describe('Reason for deletion'),
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
if (result.action === 'accept' && result.data.confirm) {
|
|
487
|
+
await this.get(ResourceService).delete(input.resourceId);
|
|
488
|
+
return 'Resource deleted';
|
|
489
|
+
}
|
|
490
|
+
return 'Deletion cancelled';
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
> **Note:** Elicitation must be enabled at server level: `@FrontMcp({ elicitation: { enabled: true } })`. See `configure-elicitation` for full configuration options.
|
|
496
|
+
|
|
497
|
+
## Tool Examples
|
|
498
|
+
|
|
499
|
+
Provide usage examples for documentation and discovery:
|
|
500
|
+
|
|
501
|
+
```typescript
|
|
502
|
+
@Tool({
|
|
503
|
+
name: 'convert_currency',
|
|
504
|
+
description: 'Convert between currencies',
|
|
505
|
+
inputSchema: {
|
|
506
|
+
amount: z.number(),
|
|
507
|
+
from: z.string(),
|
|
508
|
+
to: z.string(),
|
|
509
|
+
},
|
|
510
|
+
examples: [
|
|
511
|
+
{
|
|
512
|
+
description: 'Convert USD to EUR',
|
|
513
|
+
input: { amount: 100, from: 'USD', to: 'EUR' },
|
|
514
|
+
output: { converted: 85.5, rate: 0.855 },
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
description: 'Convert with large amount',
|
|
518
|
+
input: { amount: 1_000_000, from: 'GBP', to: 'JPY' },
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
})
|
|
522
|
+
class ConvertCurrencyTool extends ToolContext {
|
|
523
|
+
/* ... */
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
## Common Patterns
|
|
528
|
+
|
|
529
|
+
| Pattern | Correct | Incorrect | Why |
|
|
530
|
+
| -------------- | ----------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
|
|
531
|
+
| Input schema | `inputSchema: { name: z.string() }` (raw shape) | `inputSchema: z.object({ name: z.string() })` | Framework wraps in `z.object()` internally |
|
|
532
|
+
| Output schema | Always define `outputSchema` | Omit `outputSchema` | Prevents data leaks and enables CodeCall chaining |
|
|
533
|
+
| DI resolution | `this.get(TOKEN)` with proper error handling | `this.tryGet(TOKEN)!` with non-null assertion | `get` throws a clear error; non-null assertions mask failures |
|
|
534
|
+
| Error handling | `this.fail(new ResourceNotFoundError(...))` | `throw new Error(...)` | `this.fail` triggers the error flow with MCP error codes |
|
|
535
|
+
| Tool naming | `snake_case` names: `get_weather` | `camelCase` or `PascalCase`: `getWeather` | MCP protocol convention for tool names |
|
|
536
|
+
|
|
537
|
+
## Verification Checklist
|
|
538
|
+
|
|
539
|
+
### Configuration
|
|
540
|
+
|
|
541
|
+
- [ ] Tool class extends `ToolContext` and implements `execute()`
|
|
542
|
+
- [ ] `@Tool` decorator has `name`, `description`, and `inputSchema`
|
|
543
|
+
- [ ] `outputSchema` is defined to validate and restrict output fields
|
|
544
|
+
- [ ] Tool is registered in `tools` array of `@App` or `@FrontMcp`
|
|
545
|
+
|
|
546
|
+
### Runtime
|
|
547
|
+
|
|
548
|
+
- [ ] Tool appears in `tools/list` MCP response
|
|
549
|
+
- [ ] Valid input returns expected output
|
|
550
|
+
- [ ] Invalid input returns Zod validation error (not a crash)
|
|
551
|
+
- [ ] `this.fail()` triggers proper MCP error response
|
|
552
|
+
- [ ] DI dependencies resolve correctly via `this.get()`
|
|
553
|
+
|
|
554
|
+
## Troubleshooting
|
|
555
|
+
|
|
556
|
+
| Problem | Cause | Solution |
|
|
557
|
+
| ------------------------------------------------ | ------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
558
|
+
| Tool not appearing in `tools/list` | Not registered in `tools` array | Add tool class to `@App` or `@FrontMcp` `tools` array |
|
|
559
|
+
| Zod validation error on valid input | Using `z.object()` wrapper in `inputSchema` | Use raw shape: `{ field: z.string() }` not `z.object({ field: z.string() })` |
|
|
560
|
+
| `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
|
|
561
|
+
| Output contains unexpected fields | No `outputSchema` defined | Add `outputSchema` to strip unvalidated fields from response |
|
|
562
|
+
| Tool times out | No timeout configured for long operation | Add `timeout: { executeMs: 30_000 }` to `@Tool` options |
|
|
563
|
+
|
|
564
|
+
## Reference
|
|
565
|
+
|
|
566
|
+
- [Tools Documentation](https://docs.agentfront.dev/frontmcp/servers/tools)
|
|
567
|
+
- Related skills: `create-resource`, `create-prompt`, `configure-throttle`, `create-agent`
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-workflow
|
|
3
|
-
description:
|
|
4
|
-
tags: [workflow, pipeline, orchestration, steps, jobs]
|
|
5
|
-
priority: 6
|
|
6
|
-
visibility: both
|
|
7
|
-
license: Apache-2.0
|
|
8
|
-
metadata:
|
|
9
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/workflows
|
|
3
|
+
description: Connect multiple jobs into managed DAG pipelines with dependencies, conditions, and triggers
|
|
10
4
|
---
|
|
11
5
|
|
|
12
6
|
# Creating Workflows
|
|
13
7
|
|
|
14
8
|
Workflows connect multiple jobs into managed execution pipelines with step dependencies, conditions, and triggers. A workflow defines a directed acyclic graph (DAG) of steps where each step runs a named job, and the framework handles ordering, parallelism, error propagation, and trigger management.
|
|
15
9
|
|
|
16
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
### Must Use
|
|
19
13
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- Multi-stage provisioning (create resources, configure, validate, notify)
|
|
14
|
+
- Orchestrating multiple jobs in a defined order with explicit step dependencies (e.g., build then test then deploy)
|
|
15
|
+
- Building execution pipelines that require conditional branching, parallel fan-out, or diamond dependency patterns
|
|
16
|
+
- Defining webhook- or event-triggered multi-step automation that the framework manages end to end
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- CI/CD pipelines, data-processing ETL flows, or approval chains that combine three or more jobs
|
|
21
|
+
- Multi-stage provisioning sequences where steps need `continueOnError` or per-step retry policies
|
|
22
|
+
- Replacing hand-rolled orchestration code with a declarative DAG of job steps
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- You only need a single background task with no inter-step dependencies (see `create-job`)
|
|
27
|
+
- You need real-time, AI-guided sequential tool calls rather than pre-declared steps (see `create-skill-with-tools`)
|
|
28
|
+
- You are building a conversational prompt template with no execution logic (see `create-prompt`)
|
|
29
|
+
|
|
30
|
+
> **Decision:** Use this skill when you need a declarative, multi-step pipeline of jobs with dependency ordering, conditions, and managed error propagation.
|
|
26
31
|
|
|
27
32
|
## Class-Based Pattern
|
|
28
33
|
|
|
@@ -707,3 +712,45 @@ class CiApp {}
|
|
|
707
712
|
})
|
|
708
713
|
class CiServer {}
|
|
709
714
|
```
|
|
715
|
+
|
|
716
|
+
## Common Patterns
|
|
717
|
+
|
|
718
|
+
| Pattern | Correct | Incorrect | Why |
|
|
719
|
+
| ----------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
|
|
720
|
+
| Step dependencies | `dependsOn: ['build', 'test']` (array of step IDs) | `dependsOn: 'build'` (plain string) | `dependsOn` expects a `string[]`, not a single string |
|
|
721
|
+
| Dynamic input | `input: (steps) => ({ artifact: steps.get('build').outputs.url })` | `input: { artifact: buildResult.url }` (captured closure variable) | Static objects cannot reference previous step outputs; use the callback form |
|
|
722
|
+
| Conditional steps | `condition: (steps) => steps.get('test').state === 'completed'` | `condition: (steps) => steps.get('test').outputs` (truthy check) | Always check `.state` explicitly; outputs can be truthy even on partial failure |
|
|
723
|
+
| Job registration | Register all referenced jobs in the `jobs` array of `@App` | Declare `jobName` in steps without registering the job class | Steps reference jobs by name; unregistered jobs cause runtime lookup failures |
|
|
724
|
+
| Workflow trigger | Set `trigger: 'webhook'` and provide `webhook: { path, secret }` | Set `trigger: 'webhook'` without a `webhook` config object | Webhook trigger requires the `webhook` configuration block for path and secret |
|
|
725
|
+
|
|
726
|
+
## Verification Checklist
|
|
727
|
+
|
|
728
|
+
### Configuration
|
|
729
|
+
|
|
730
|
+
- [ ] `@Workflow` decorator has `name` and at least one step in `steps`
|
|
731
|
+
- [ ] Every `jobName` in steps matches a registered `@Job` name
|
|
732
|
+
- [ ] `dependsOn` arrays reference valid step `id` values within the same workflow
|
|
733
|
+
- [ ] No circular dependencies exist in the step DAG
|
|
734
|
+
|
|
735
|
+
### Runtime
|
|
736
|
+
|
|
737
|
+
- [ ] Workflow appears in the server's workflow registry after startup
|
|
738
|
+
- [ ] Steps with no dependencies execute in parallel (up to `maxConcurrency`)
|
|
739
|
+
- [ ] Conditional steps are correctly skipped or executed based on prior step results
|
|
740
|
+
- [ ] `continueOnError: true` steps allow downstream steps to proceed on failure
|
|
741
|
+
- [ ] Webhook-triggered workflows respond to incoming HTTP requests
|
|
742
|
+
|
|
743
|
+
## Troubleshooting
|
|
744
|
+
|
|
745
|
+
| Problem | Cause | Solution |
|
|
746
|
+
| --------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
747
|
+
| Step never executes | `dependsOn` references a step ID that does not exist | Verify all `dependsOn` entries match actual step `id` values in the workflow |
|
|
748
|
+
| Workflow fails at startup with "job not found" | `jobName` references an unregistered job | Add the job class to the `jobs` array in `@App` before registering the workflow |
|
|
749
|
+
| Dynamic `input` callback receives undefined outputs | Dependent step was skipped or failed without `continueOnError` | Add a `condition` guard that checks `steps.get(id).state === 'completed'` before accessing outputs |
|
|
750
|
+
| Webhook trigger does not fire | Missing or mismatched `webhook.secret` | Ensure `webhook.secret` matches the sender's HMAC secret and `webhook.path` is correct |
|
|
751
|
+
| Workflow exceeds timeout | Total step execution time exceeds the default 600000 ms | Increase `timeout` at the workflow level or add per-step `timeout` overrides |
|
|
752
|
+
|
|
753
|
+
## Reference
|
|
754
|
+
|
|
755
|
+
- [Workflows Documentation](https://docs.agentfront.dev/frontmcp/servers/workflows)
|
|
756
|
+
- Related skills: `create-job`, `create-skill-with-tools`, `create-tool`, `multi-app-composition`
|