@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,36 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-provider
|
|
3
|
-
description: Create
|
|
4
|
-
tags: [provider, di, dependency-injection, singleton, database, service]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: name
|
|
7
|
-
description: Provider name
|
|
8
|
-
type: string
|
|
9
|
-
required: true
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Create a database connection pool provider
|
|
12
|
-
expected-outcome: Singleton DB pool injectable into all tools via this.get()
|
|
13
|
-
- scenario: Create a config provider from environment variables
|
|
14
|
-
expected-outcome: Type-safe config object available in any context
|
|
15
|
-
priority: 8
|
|
16
|
-
visibility: both
|
|
17
|
-
license: Apache-2.0
|
|
18
|
-
metadata:
|
|
19
|
-
docs: https://docs.agentfront.dev/frontmcp/extensibility/providers
|
|
3
|
+
description: Create singleton DI providers for database pools, API clients, and shared services
|
|
20
4
|
---
|
|
21
5
|
|
|
22
6
|
# Creating Providers (Dependency Injection)
|
|
23
7
|
|
|
24
8
|
Providers are singleton services — database pools, API clients, config objects — that tools, resources, prompts, and agents can access via `this.get(token)`.
|
|
25
9
|
|
|
26
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
27
11
|
|
|
28
|
-
|
|
12
|
+
### Must Use
|
|
29
13
|
|
|
30
|
-
- Multiple tools need
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
14
|
+
- Multiple tools, resources, or agents need a shared database connection pool
|
|
15
|
+
- API clients or external service connections must be singleton (not recreated per request)
|
|
16
|
+
- You need lifecycle management with `onInit()` at startup and `onDestroy()` at shutdown
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Centralizing configuration values as a type-safe injectable object
|
|
21
|
+
- Sharing a cache layer (Map, Redis) across all execution contexts
|
|
22
|
+
- Providing environment-specific settings (API URLs, feature flags) via DI
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- The service is only used by a single tool and has no lifecycle (inline it in the tool)
|
|
27
|
+
- You need to build an executable action for AI clients (see `create-tool`)
|
|
28
|
+
- You need autonomous LLM-driven orchestration (see `create-agent`)
|
|
29
|
+
|
|
30
|
+
> **Decision:** Use this skill when you need a shared, singleton service with lifecycle management that tools, resources, and agents access via `this.get(token)`.
|
|
34
31
|
|
|
35
32
|
## Step 1: Define a Token
|
|
36
33
|
|
|
@@ -231,3 +228,46 @@ frontmcp dev
|
|
|
231
228
|
# Call a tool that uses the provider
|
|
232
229
|
# If provider fails to init, you'll see an error at startup
|
|
233
230
|
```
|
|
231
|
+
|
|
232
|
+
## Common Patterns
|
|
233
|
+
|
|
234
|
+
| Pattern | Correct | Incorrect | Why |
|
|
235
|
+
| ------------------ | ---------------------------------------------------------------------- | --------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
236
|
+
| Token definition | `const DB: Token<DbService> = Symbol('DbService')` (typed Symbol) | `const DB = 'database'` (string literal) | Typed `Token<T>` enables compile-time type checking on `this.get()` |
|
|
237
|
+
| DI resolution | `this.get(TOKEN)` with error handling | `this.tryGet(TOKEN)!` with non-null assertion | `get` throws a clear `DependencyNotFoundError`; non-null assertions hide failures |
|
|
238
|
+
| Lifecycle | Use `onInit()` for async setup, `onDestroy()` for cleanup | Initializing connections in the constructor | Constructor runs synchronously; `onInit()` supports async operations |
|
|
239
|
+
| Registration scope | Register at `@App` level for app-scoped, `@FrontMcp` for server-scoped | Registering same provider in multiple apps | Server-scoped providers are shared; duplicating causes multiple instances |
|
|
240
|
+
| Config provider | `readonly` properties from `process.env` | Mutable properties that change at runtime | Providers are singletons; mutable state can cause race conditions |
|
|
241
|
+
|
|
242
|
+
## Verification Checklist
|
|
243
|
+
|
|
244
|
+
### Configuration
|
|
245
|
+
|
|
246
|
+
- [ ] Provider class has `@Provider` decorator with `name`
|
|
247
|
+
- [ ] Token is defined with `Token<T>` using a `Symbol` and typed interface
|
|
248
|
+
- [ ] Provider is registered in `providers` array of `@App` or `@FrontMcp`
|
|
249
|
+
- [ ] `onInit()` handles async setup (DB connections, API clients)
|
|
250
|
+
- [ ] `onDestroy()` cleans up resources (close connections, flush buffers)
|
|
251
|
+
|
|
252
|
+
### Runtime
|
|
253
|
+
|
|
254
|
+
- [ ] Server starts without provider initialization errors
|
|
255
|
+
- [ ] `this.get(TOKEN)` resolves the provider in tools, resources, and agents
|
|
256
|
+
- [ ] Provider is a singleton (same instance across all contexts)
|
|
257
|
+
- [ ] Server shutdown calls `onDestroy()` and cleans up resources
|
|
258
|
+
- [ ] Missing provider throws `DependencyNotFoundError` with a clear message
|
|
259
|
+
|
|
260
|
+
## Troubleshooting
|
|
261
|
+
|
|
262
|
+
| Problem | Cause | Solution |
|
|
263
|
+
| ------------------------------------ | --------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
264
|
+
| `DependencyNotFoundError` at runtime | Provider not registered in scope | Add provider to `providers` array in `@App` or `@FrontMcp` |
|
|
265
|
+
| Provider `onInit()` fails at startup | Missing environment variable or unreachable service | Check environment variables and service connectivity before starting |
|
|
266
|
+
| Multiple instances of same provider | Registered in multiple apps instead of server level | Move to `@FrontMcp` `providers` for shared, server-scoped access |
|
|
267
|
+
| Type mismatch on `this.get(TOKEN)` | Token typed with wrong interface | Ensure `Token<T>` generic matches the provider's implemented interface |
|
|
268
|
+
| Provider not destroyed on shutdown | Missing `onDestroy()` method | Implement `onDestroy()` to close connections and release resources |
|
|
269
|
+
|
|
270
|
+
## Reference
|
|
271
|
+
|
|
272
|
+
- [Providers Documentation](https://docs.agentfront.dev/frontmcp/extensibility/providers)
|
|
273
|
+
- Related skills: `create-tool`, `create-resource`, `create-agent`, `create-prompt`
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-resource
|
|
3
|
-
description:
|
|
4
|
-
tags: [resources, mcp, uri, templates, decorator]
|
|
5
|
-
tools:
|
|
6
|
-
- name: create_resource
|
|
7
|
-
purpose: Scaffold a new resource or resource template class
|
|
8
|
-
parameters:
|
|
9
|
-
- name: name
|
|
10
|
-
description: Resource name in kebab-case
|
|
11
|
-
type: string
|
|
12
|
-
required: true
|
|
13
|
-
- name: type
|
|
14
|
-
description: Whether to create a static resource or resource template
|
|
15
|
-
type: string
|
|
16
|
-
required: false
|
|
17
|
-
examples:
|
|
18
|
-
- scenario: Create a static configuration resource
|
|
19
|
-
expected-outcome: Resource registered and readable via MCP at a fixed URI
|
|
20
|
-
- scenario: Create a resource template for user profiles
|
|
21
|
-
expected-outcome: Resource template with parameterized URI pattern
|
|
22
|
-
priority: 10
|
|
23
|
-
visibility: both
|
|
24
|
-
license: Apache-2.0
|
|
25
|
-
metadata:
|
|
26
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/resources
|
|
3
|
+
description: Expose data to AI clients via URI-based static resources and parameterized templates
|
|
27
4
|
---
|
|
28
5
|
|
|
29
6
|
# Creating MCP Resources
|
|
30
7
|
|
|
31
8
|
Resources expose data to AI clients through URI-based access following the MCP protocol. FrontMCP supports two kinds: **static resources** with fixed URIs (`@Resource`) and **resource templates** with parameterized URI patterns (`@ResourceTemplate`).
|
|
32
9
|
|
|
33
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
34
11
|
|
|
35
|
-
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Exposing data to AI clients through URI-based access following the MCP protocol
|
|
15
|
+
- Serving dynamic or static content that clients read on demand (config, status, files)
|
|
16
|
+
- Creating parameterized URI patterns for families of related data (user profiles, repo files)
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Providing binary assets (images, PDFs) to AI clients via base64 blob encoding
|
|
21
|
+
- Centralizing read-only data sources that multiple tools or prompts reference
|
|
22
|
+
- Replacing ad-hoc tool responses with structured, cacheable resource URIs
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
25
|
+
|
|
26
|
+
- The client needs to perform an action, not read data (see `create-tool`)
|
|
27
|
+
- You are building a reusable conversation template (see `create-prompt`)
|
|
28
|
+
- The data requires autonomous multi-step reasoning to produce (see `create-agent`)
|
|
29
|
+
|
|
30
|
+
> **Decision:** Use this skill when you need to expose readable data at a URI -- choose `@Resource` for a fixed URI or `@ResourceTemplate` for parameterized URI patterns.
|
|
36
31
|
|
|
37
32
|
## Static Resources with @Resource
|
|
38
33
|
|
|
@@ -41,9 +36,11 @@ Use `@Resource` when the data lives at a single, known URI (e.g., `config://app/
|
|
|
41
36
|
The `@Resource` decorator accepts:
|
|
42
37
|
|
|
43
38
|
- `name` (required) -- unique resource name
|
|
39
|
+
- `title` (optional) -- human-readable display title for UIs (if omitted, `name` is used)
|
|
44
40
|
- `uri` (required) -- static URI with a valid scheme per RFC 3986
|
|
45
41
|
- `description` (optional) -- human-readable description
|
|
46
42
|
- `mimeType` (optional) -- MIME type of the resource content
|
|
43
|
+
- `icons` (optional) -- array of Icon objects for UI representation (per MCP spec)
|
|
47
44
|
|
|
48
45
|
### Class-Based Pattern
|
|
49
46
|
|
|
@@ -148,9 +145,11 @@ Supported return shapes:
|
|
|
148
145
|
The `@ResourceTemplate` decorator accepts:
|
|
149
146
|
|
|
150
147
|
- `name` (required) -- unique resource template name
|
|
148
|
+
- `title` (optional) -- human-readable display title for UIs (if omitted, `name` is used)
|
|
151
149
|
- `uriTemplate` (required) -- URI pattern with `{paramName}` placeholders (RFC 6570 style)
|
|
152
150
|
- `description` (optional) -- human-readable description
|
|
153
151
|
- `mimeType` (optional) -- MIME type of the resource content
|
|
152
|
+
- `icons` (optional) -- array of Icon objects for UI representation (per MCP spec)
|
|
154
153
|
|
|
155
154
|
### Class-Based Pattern
|
|
156
155
|
|
|
@@ -435,3 +434,126 @@ nx generate @frontmcp/nx:resource
|
|
|
435
434
|
```
|
|
436
435
|
|
|
437
436
|
This creates the resource file, spec file, and updates barrel exports.
|
|
437
|
+
|
|
438
|
+
## Resource Argument Autocompletion
|
|
439
|
+
|
|
440
|
+
Resource templates with parameterized URIs can provide autocompletion for their arguments. This is useful when template parameters represent dynamic values that can be searched or enumerated, such as user IDs, product names, or project slugs.
|
|
441
|
+
|
|
442
|
+
### When to Use
|
|
443
|
+
|
|
444
|
+
- Template parameters reference entities that exist in a database or external service (user IDs, product names, etc.)
|
|
445
|
+
- Clients benefit from discovering valid parameter values without prior knowledge
|
|
446
|
+
- The parameter space is searchable or enumerable given a partial input string
|
|
447
|
+
|
|
448
|
+
### Types
|
|
449
|
+
|
|
450
|
+
The autocompletion API uses two types from `@frontmcp/sdk`:
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
interface ResourceCompletionResult {
|
|
454
|
+
values: string[];
|
|
455
|
+
total?: number;
|
|
456
|
+
hasMore?: boolean;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
type ResourceArgumentCompleter = (partial: string) => Promise<ResourceCompletionResult> | ResourceCompletionResult;
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
- `values` -- the list of matching completions for the partial input
|
|
463
|
+
- `total` -- optional total number of matches (useful when `values` is a truncated subset)
|
|
464
|
+
- `hasMore` -- optional flag indicating additional matches exist beyond what was returned
|
|
465
|
+
|
|
466
|
+
### How to Implement
|
|
467
|
+
|
|
468
|
+
Override the `getArgumentCompleter(argName)` method in your `ResourceContext` subclass. Return a completer function for argument names you support, or `null` for unknown arguments.
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
|
|
472
|
+
if (argName === 'myParam') {
|
|
473
|
+
return async (partial) => {
|
|
474
|
+
// Search or filter based on partial input
|
|
475
|
+
const matches = await findMatches(partial);
|
|
476
|
+
return { values: matches, total: matches.length };
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Complete Example
|
|
484
|
+
|
|
485
|
+
A user profile template resource that autocompletes user IDs by searching a user service:
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
@ResourceTemplate({
|
|
489
|
+
name: 'user-profile',
|
|
490
|
+
description: 'User profile by ID',
|
|
491
|
+
uriTemplate: 'users://{userId}/profile',
|
|
492
|
+
mimeType: 'application/json',
|
|
493
|
+
})
|
|
494
|
+
class UserProfileResource extends ResourceContext<{ userId: string }> {
|
|
495
|
+
async execute(uri: string, params: { userId: string }) {
|
|
496
|
+
const user = await this.get(UserService).findById(params.userId);
|
|
497
|
+
return { id: user.id, name: user.name, email: user.email };
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
|
|
501
|
+
if (argName === 'userId') {
|
|
502
|
+
return async (partial) => {
|
|
503
|
+
const users = await this.get(UserService).search(partial);
|
|
504
|
+
return { values: users.map((u) => u.id), total: users.length };
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
When a client requests completions for the `userId` parameter with a partial string like `"al"`, the completer queries the user service and returns matching IDs.
|
|
513
|
+
|
|
514
|
+
## Common Patterns
|
|
515
|
+
|
|
516
|
+
| Pattern | Correct | Incorrect | Why |
|
|
517
|
+
| ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
518
|
+
| URI scheme | `uri: 'config://app/settings'` (valid scheme) | `uri: 'app-settings'` (no scheme) | URIs are validated per RFC 3986; scheme-less URIs are rejected at registration |
|
|
519
|
+
| Resource vs template | `@Resource` for fixed URIs, `@ResourceTemplate` for `{param}` URIs | Using `@Resource` with `{param}` placeholders | Framework selects matching strategy based on decorator type |
|
|
520
|
+
| Return shape | Return full `ReadResourceResult` or let FrontMCP normalize plain objects | Manually wrapping every return in `{ contents: [...] }` when not needed | FrontMCP auto-wraps strings, objects, and arrays into valid `ReadResourceResult` |
|
|
521
|
+
| Template params typing | `ResourceContext<{ userId: string }>` with typed `params` | `ResourceContext` with untyped `params: Record<string, string>` | Generic parameter enables compile-time checking of URI parameters |
|
|
522
|
+
| Binary content | Use `blob` field with base64 encoding for binary data | Returning raw `Buffer` in `text` field | MCP protocol expects base64 in `blob`; `text` is for string content only |
|
|
523
|
+
|
|
524
|
+
## Verification Checklist
|
|
525
|
+
|
|
526
|
+
### Configuration
|
|
527
|
+
|
|
528
|
+
- [ ] Resource class extends `ResourceContext` and implements `execute(uri, params)`
|
|
529
|
+
- [ ] `@Resource` has `name` and `uri` with a valid scheme, or `@ResourceTemplate` has `name` and `uriTemplate`
|
|
530
|
+
- [ ] Resource is registered in `resources` array of `@App` or `@FrontMcp`
|
|
531
|
+
- [ ] `mimeType` is set when the content type is not plain text
|
|
532
|
+
|
|
533
|
+
### Runtime
|
|
534
|
+
|
|
535
|
+
- [ ] Resource appears in `resources/list` MCP response
|
|
536
|
+
- [ ] Reading the resource URI returns the expected `ReadResourceResult`
|
|
537
|
+
- [ ] Template parameters are extracted correctly from the URI
|
|
538
|
+
- [ ] Binary resources return valid base64 in the `blob` field
|
|
539
|
+
- [ ] DI dependencies resolve correctly via `this.get()`
|
|
540
|
+
|
|
541
|
+
### Autocompletion
|
|
542
|
+
|
|
543
|
+
- [ ] Template resources with dynamic params implement `getArgumentCompleter()`
|
|
544
|
+
- [ ] Completer returns `{ values, total?, hasMore? }` matching the partial input
|
|
545
|
+
|
|
546
|
+
## Troubleshooting
|
|
547
|
+
|
|
548
|
+
| Problem | Cause | Solution |
|
|
549
|
+
| ------------------------------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------- |
|
|
550
|
+
| Resource not appearing in `resources/list` | Not registered in `resources` array | Add resource class to `@App` or `@FrontMcp` `resources` array |
|
|
551
|
+
| URI validation error at startup | Missing or invalid URI scheme | Ensure URI has a scheme like `config://`, `https://`, or `custom://` |
|
|
552
|
+
| Template parameters are empty | Using `@Resource` instead of `@ResourceTemplate` | Switch to `@ResourceTemplate` with `uriTemplate` containing `{param}` placeholders |
|
|
553
|
+
| Binary content is garbled | Returning raw buffer in `text` field | Use `blob: buffer.toString('base64')` instead of `text` for binary data |
|
|
554
|
+
| `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
|
|
555
|
+
|
|
556
|
+
## Reference
|
|
557
|
+
|
|
558
|
+
- [Resources Documentation](https://docs.agentfront.dev/frontmcp/servers/resources)
|
|
559
|
+
- Related skills: `create-tool`, `create-prompt`, `create-provider`, `create-agent`
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-skill-with-tools
|
|
3
|
-
description: Create skills that
|
|
4
|
-
tags: [skill, tools, workflow, instructions]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: name
|
|
7
|
-
description: Skill name in kebab-case
|
|
8
|
-
type: string
|
|
9
|
-
required: true
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Create a deploy skill that uses build and test tools
|
|
12
|
-
expected-outcome: Skill guides AI through build, test, deploy workflow
|
|
13
|
-
- scenario: Create a skill from a SKILL.md file directory
|
|
14
|
-
expected-outcome: Skill loaded with instructions, scripts, references, assets
|
|
15
|
-
priority: 8
|
|
16
|
-
visibility: both
|
|
17
|
-
license: Apache-2.0
|
|
18
|
-
metadata:
|
|
19
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/skills
|
|
3
|
+
description: Create skills that combine structured instructions with MCP tool references for orchestration
|
|
20
4
|
---
|
|
21
5
|
|
|
22
6
|
# Creating a Skill with Tools
|
|
23
7
|
|
|
24
8
|
Skills are knowledge and workflow guides that help LLMs accomplish multi-step tasks using available MCP tools. Unlike tools (which execute actions directly) or agents (which run autonomous LLM loops), skills provide structured instructions, tool references, and context that the AI client uses to orchestrate tool calls on its own.
|
|
25
9
|
|
|
26
|
-
## When to Use
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Teaching an AI client how to accomplish a complex task by combining multiple tools in a defined sequence
|
|
15
|
+
- Building directory-based skills with `SKILL.md`, scripts, references, and assets loaded via `skillDir()`
|
|
16
|
+
- Defining tool-orchestration instructions with explicit tool references, parameters, and examples
|
|
17
|
+
|
|
18
|
+
### Recommended
|
|
19
|
+
|
|
20
|
+
- Creating reusable workflow guides that can be discovered via HTTP (`/llm.txt`, `/skills`) or MCP protocol
|
|
21
|
+
- Wrapping existing tools into a higher-level procedure with step-by-step instructions and validation modes
|
|
22
|
+
- Providing AI clients with structured playbooks for incident response, deployment, or data-processing flows
|
|
23
|
+
|
|
24
|
+
### Skip When
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
- You need a single executable action with direct input/output (see `create-tool`)
|
|
27
|
+
- You need an autonomous LLM loop that reasons across multiple steps on its own (see `create-agent`)
|
|
28
|
+
- You are building a conversational template or system prompt without tool references (see `create-prompt`)
|
|
29
|
+
|
|
30
|
+
> **Decision:** Use this skill when you need to guide an AI client through a multi-tool workflow using structured instructions and tool references, without executing anything directly.
|
|
29
31
|
|
|
30
32
|
| Aspect | @Skill | @Tool | @Agent |
|
|
31
33
|
| ---------- | ------------------------ | -------------------- | -------------------- |
|
|
@@ -215,7 +217,7 @@ class RemoteWorkflowSkill extends SkillContext {}
|
|
|
215
217
|
|
|
216
218
|
Use `skillDir()` to load a skill from a directory structure. The directory is expected to contain a `SKILL.md` file with frontmatter and instructions, plus optional subdirectories for scripts, references, and assets.
|
|
217
219
|
|
|
218
|
-
```
|
|
220
|
+
```text
|
|
219
221
|
skills/
|
|
220
222
|
deploy-service/
|
|
221
223
|
SKILL.md # Instructions with YAML frontmatter
|
|
@@ -344,6 +346,44 @@ Use `hideFromDiscovery: true` to register a skill that is not listed in discover
|
|
|
344
346
|
class AdminMaintenanceSkill extends SkillContext {}
|
|
345
347
|
```
|
|
346
348
|
|
|
349
|
+
## Agent Skills Spec Fields
|
|
350
|
+
|
|
351
|
+
Skills support additional metadata fields from the Anthropic Agent Skills specification:
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
@Skill({
|
|
355
|
+
name: 'deploy-to-prod',
|
|
356
|
+
description: 'Production deployment workflow',
|
|
357
|
+
instructions: { file: './deploy-prod.md' },
|
|
358
|
+
tools: [BuildTool, DeployTool, HealthCheckTool],
|
|
359
|
+
priority: 10, // Higher = earlier in search results
|
|
360
|
+
license: 'MIT', // License identifier
|
|
361
|
+
compatibility: 'Node.js 24+, Docker', // Environment requirements (max 500 chars)
|
|
362
|
+
allowedTools: 'Read Edit Bash(git status)', // Pre-approved tools (space-delimited)
|
|
363
|
+
specMetadata: {
|
|
364
|
+
// Arbitrary key-value metadata
|
|
365
|
+
author: 'platform-team',
|
|
366
|
+
version: '2.0.0',
|
|
367
|
+
},
|
|
368
|
+
resources: {
|
|
369
|
+
// Bundled resource directories
|
|
370
|
+
scripts: './scripts', // Helper scripts
|
|
371
|
+
references: './references', // Reference documents
|
|
372
|
+
assets: './assets', // Static assets
|
|
373
|
+
},
|
|
374
|
+
})
|
|
375
|
+
class DeployToProdSkill extends SkillContext {}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
| Field | Description |
|
|
379
|
+
| --------------- | ---------------------------------------------------------------- |
|
|
380
|
+
| `priority` | Search ranking weight; higher = earlier (default: `0`) |
|
|
381
|
+
| `license` | License identifier (e.g., `'MIT'`, `'Apache-2.0'`) |
|
|
382
|
+
| `compatibility` | Environment requirements (max 500 chars) |
|
|
383
|
+
| `allowedTools` | Space-delimited pre-approved tool names for the skill |
|
|
384
|
+
| `specMetadata` | Arbitrary `Record<string, string>` map (Agent Skills `metadata`) |
|
|
385
|
+
| `resources` | Bundled dirs: `{ scripts?, references?, assets? }` paths |
|
|
386
|
+
|
|
347
387
|
## Function-Style Builder
|
|
348
388
|
|
|
349
389
|
For skills that do not need a class, use the `skill()` function builder:
|
|
@@ -577,3 +617,117 @@ class AuditApp {}
|
|
|
577
617
|
})
|
|
578
618
|
class AuditServer {}
|
|
579
619
|
```
|
|
620
|
+
|
|
621
|
+
## CodeCall Compatibility
|
|
622
|
+
|
|
623
|
+
When the `CodeCallPlugin` is active in `codecall_only` mode, all tools registered on the server are hidden from `list_tools`. The AI client only sees the three CodeCall meta-tools (`codecall:search`, `codecall:describe`, `codecall:execute`). This means skill instructions that reference tool names directly (e.g., "Use the `build_project` tool") become misleading -- the AI cannot call those tools because they do not appear in the tool listing.
|
|
624
|
+
|
|
625
|
+
### When This Matters
|
|
626
|
+
|
|
627
|
+
This is only relevant when the server initializes CodeCall in `codecall_only` mode:
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
CodeCallPlugin.init({ mode: 'codecall_only' });
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
With `codecall_opt_in` or `metadata_driven` modes, tools remain visible in `list_tools` alongside the CodeCall meta-tools. In those modes, standard tool-referencing instructions continue to work without changes.
|
|
634
|
+
|
|
635
|
+
### Writing Dual-Mode Instructions
|
|
636
|
+
|
|
637
|
+
Write skill instructions that work regardless of whether CodeCall is active. Instead of referencing tool names as direct calls, instruct the AI to use the search-describe-execute pattern:
|
|
638
|
+
|
|
639
|
+
```markdown
|
|
640
|
+
## Step 1: Find Available Tools
|
|
641
|
+
|
|
642
|
+
Search for tools related to your task using codecall:search.
|
|
643
|
+
Query: ["build project", "run tests", "deploy"]
|
|
644
|
+
|
|
645
|
+
## Step 2: Describe Tool Interfaces
|
|
646
|
+
|
|
647
|
+
Once you find matching tools, use codecall:describe to understand their input schemas.
|
|
648
|
+
|
|
649
|
+
## Step 3: Execute
|
|
650
|
+
|
|
651
|
+
Use codecall:execute with an AgentScript that calls the tools:
|
|
652
|
+
const build = await callTool('build_project', { target: 'production' });
|
|
653
|
+
const tests = await callTool('run_tests', { suite: 'e2e' });
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Supporting Both Direct and CodeCall Workflows
|
|
657
|
+
|
|
658
|
+
If you want the skill to work with and without CodeCall, list the tool names in the `tools` array (so they are associated with the skill in metadata) AND include instructions for both direct calls and the CodeCall workflow. This way:
|
|
659
|
+
|
|
660
|
+
- In standard mode, the AI sees the tools in `list_tools` and can call them directly using the tool names from the `tools` array.
|
|
661
|
+
- In `codecall_only` mode, the AI follows the search-describe-execute instructions to discover and invoke the same tools through CodeCall.
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
@Skill({
|
|
665
|
+
name: 'deploy-service',
|
|
666
|
+
description: 'Deploy a service through the pipeline',
|
|
667
|
+
instructions: `# Deploy Service
|
|
668
|
+
|
|
669
|
+
## Finding the Tools
|
|
670
|
+
If tools are not directly visible, search for them:
|
|
671
|
+
Use codecall:search with query ["build project", "run tests", "deploy to environment"].
|
|
672
|
+
Then use codecall:describe on each result to confirm the input schema.
|
|
673
|
+
|
|
674
|
+
## Step 1: Build
|
|
675
|
+
Call build_project with the service name and target environment.
|
|
676
|
+
If using CodeCall: codecall:execute with callTool('build_project', { ... }).
|
|
677
|
+
|
|
678
|
+
## Step 2: Test
|
|
679
|
+
Call run_tests with the test suite name.
|
|
680
|
+
If using CodeCall: codecall:execute with callTool('run_tests', { ... }).`,
|
|
681
|
+
tools: [BuildProjectTool, RunTestsTool, DeployToEnvTool],
|
|
682
|
+
})
|
|
683
|
+
class DeployServiceSkill extends SkillContext {}
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
## Common Patterns
|
|
687
|
+
|
|
688
|
+
| Pattern | Correct | Incorrect | Why |
|
|
689
|
+
| ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
690
|
+
| Tool references | `tools: [BuildTool, 'run_tests', { name: 'deploy', purpose: '...', required: true }]` | `tools: [{ class: BuildTool }]` (object with `class` key) | The `tools` array accepts class refs, strings, or `{ name, purpose, required }` objects only |
|
|
691
|
+
| Tool validation | `toolValidation: 'strict'` for production skills | Omitting `toolValidation` for critical workflows | Default is `'warn'`; production skills should fail fast on missing tools with `'strict'` |
|
|
692
|
+
| Instruction source | `instructions: { file: './skills/deploy.md' }` for long content | Inlining hundreds of lines in the decorator string | File-based instructions keep decorator metadata readable and instructions maintainable |
|
|
693
|
+
| Skill visibility | `visibility: 'both'` (default) for public skills | Setting `visibility: 'mcp'` when HTTP discovery is also needed | Skills with `'mcp'` visibility are hidden from `/llm.txt` and `/skills` HTTP endpoints |
|
|
694
|
+
| Parameter types | `parameters: [{ name: 'env', type: 'string', required: true }]` | `parameters: { env: 'string' }` (plain object shape) | Parameters must be an array of `{ name, description, type, required?, default? }` objects |
|
|
695
|
+
| CodeCall compatibility | List tools AND include codecall:search/execute instructions | Only listing tools by name | When CodeCall hides tools, AI can't find them without search instructions |
|
|
696
|
+
|
|
697
|
+
## Verification Checklist
|
|
698
|
+
|
|
699
|
+
### Configuration
|
|
700
|
+
|
|
701
|
+
- [ ] `@Skill` decorator has `name` and `description`
|
|
702
|
+
- [ ] `instructions` are provided via inline string, `{ file }`, or `{ url }`
|
|
703
|
+
- [ ] All tool references in `tools` array resolve to registered tools (when `toolValidation: 'strict'`)
|
|
704
|
+
- [ ] Skill is registered in `skills` array of `@App` or `@FrontMcp`
|
|
705
|
+
|
|
706
|
+
### Runtime
|
|
707
|
+
|
|
708
|
+
- [ ] Skill appears in MCP skill listing (`skills/list`) when `visibility` includes `'mcp'`
|
|
709
|
+
- [ ] Skill appears at `/llm.txt` and `/skills` HTTP endpoints when `visibility` includes `'http'`
|
|
710
|
+
- [ ] `build()` returns complete `SkillContent` with instructions and tool references
|
|
711
|
+
- [ ] `getToolRefs()` returns the correct list of resolved tool references
|
|
712
|
+
- [ ] Hidden skills (`hideFromDiscovery: true`) are invocable but not listed in discovery
|
|
713
|
+
|
|
714
|
+
### Directory-Based Skills
|
|
715
|
+
|
|
716
|
+
- [ ] `SKILL.md` file exists at the root of the skill directory with valid YAML frontmatter
|
|
717
|
+
- [ ] `skillDir()` correctly loads instructions, scripts, references, and assets
|
|
718
|
+
- [ ] Frontmatter `tools` entries match registered tool names
|
|
719
|
+
|
|
720
|
+
## Troubleshooting
|
|
721
|
+
|
|
722
|
+
| Problem | Cause | Solution |
|
|
723
|
+
| -------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
724
|
+
| Skill not appearing in `/llm.txt` | `visibility` is set to `'mcp'` | Change to `'both'` or `'http'` to include HTTP discovery |
|
|
725
|
+
| `toolValidation: 'strict'` throws at startup | A referenced tool is not registered in the scope | Register all referenced tools in the `tools` array of `@App` or `@FrontMcp` |
|
|
726
|
+
| `skillDir()` fails to load | `SKILL.md` file missing or frontmatter is invalid YAML | Ensure the directory contains a `SKILL.md` with valid `---` delimited YAML frontmatter |
|
|
727
|
+
| Instructions are empty at runtime | `{ file: './path.md' }` path is relative to wrong directory | Use a path relative to the skill file's location, not the project root |
|
|
728
|
+
| Parameters not visible to AI client | `parameters` defined as a plain object instead of an array | Use array format: `[{ name, description, type, required }]` |
|
|
729
|
+
|
|
730
|
+
## Reference
|
|
731
|
+
|
|
732
|
+
- [Skills Documentation](https://docs.agentfront.dev/frontmcp/servers/skills)
|
|
733
|
+
- Related skills: `create-skill`, `create-tool`, `create-agent`, `create-prompt`
|