@frontmcp/skills 0.0.1 → 1.0.0-beta.9
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/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +140 -0
- package/catalog/frontmcp-config/references/configure-auth.md +238 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
- package/catalog/frontmcp-config/references/configure-http.md +205 -0
- package/catalog/frontmcp-config/references/configure-session.md +205 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
- package/catalog/frontmcp-config/references/configure-transport.md +195 -0
- package/catalog/frontmcp-config/references/setup-redis.md +4 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
- package/catalog/frontmcp-deployment/SKILL.md +124 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +73 -60
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +11 -2
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +65 -37
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
- package/catalog/frontmcp-development/SKILL.md +118 -0
- package/catalog/frontmcp-development/references/create-adapter.md +165 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
- package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +71 -20
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
- package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
- package/catalog/frontmcp-development/references/official-adapters.md +194 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +68 -22
- package/catalog/frontmcp-guides/SKILL.md +417 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
- package/catalog/frontmcp-setup/SKILL.md +127 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
- package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
- package/catalog/frontmcp-testing/SKILL.md +121 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
- package/catalog/skills-manifest.json +34 -383
- package/package.json +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +1 -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/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
- /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
- /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
- /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
- /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
- /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-prompt
|
|
3
|
-
description: Create MCP prompts for reusable AI interaction patterns. Use when building prompts, defining prompt arguments, or creating conversation templates.
|
|
4
|
-
tags: [prompts, mcp, templates, messages, decorator]
|
|
5
|
-
tools:
|
|
6
|
-
- name: create_prompt
|
|
7
|
-
purpose: Scaffold a new prompt class
|
|
8
|
-
parameters:
|
|
9
|
-
- name: name
|
|
10
|
-
description: Prompt name in kebab-case
|
|
11
|
-
type: string
|
|
12
|
-
required: true
|
|
13
|
-
examples:
|
|
14
|
-
- scenario: Create a code review prompt with language argument
|
|
15
|
-
expected-outcome: Prompt registered and callable via MCP
|
|
16
|
-
- scenario: Create a multi-turn debugging prompt with assistant priming
|
|
17
|
-
expected-outcome: Prompt producing structured message sequences
|
|
18
|
-
priority: 10
|
|
19
|
-
visibility: both
|
|
20
|
-
license: Apache-2.0
|
|
21
|
-
metadata:
|
|
22
|
-
docs: https://docs.agentfront.dev/frontmcp/servers/prompts
|
|
23
|
-
---
|
|
24
|
-
|
|
25
1
|
# Creating MCP Prompts
|
|
26
2
|
|
|
27
3
|
Prompts define reusable AI interaction patterns in the MCP protocol. They produce structured message sequences that clients use to guide LLM conversations. In FrontMCP, prompts are classes extending `PromptContext`, decorated with `@Prompt`, that return `GetPromptResult` objects.
|
|
28
4
|
|
|
29
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Building a reusable conversation template that AI clients invoke with arguments
|
|
10
|
+
- Defining structured multi-turn message sequences (user/assistant patterns)
|
|
11
|
+
- Creating domain-specific prompt patterns (code review, debugging, RAG queries)
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Standardizing message formats across multiple tools or agents
|
|
16
|
+
- Embedding MCP resource content into prompt messages for context
|
|
17
|
+
- Generating dynamic prompts that perform async lookups (knowledge base, APIs)
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- You need an executable action that performs work and returns results (see `create-tool`)
|
|
22
|
+
- You need to expose read-only data at a URI (see `create-resource`)
|
|
23
|
+
- The task requires autonomous multi-step reasoning with inner tools (see `create-agent`)
|
|
24
|
+
|
|
25
|
+
> **Decision:** Use this skill when you need a reusable, parameterized conversation template that produces structured `GetPromptResult` messages.
|
|
32
26
|
|
|
33
27
|
## Class-Based Pattern
|
|
34
28
|
|
|
@@ -398,3 +392,45 @@ nx generate @frontmcp/nx:prompt
|
|
|
398
392
|
```
|
|
399
393
|
|
|
400
394
|
This creates the prompt file, spec file, and updates barrel exports.
|
|
395
|
+
|
|
396
|
+
## Common Patterns
|
|
397
|
+
|
|
398
|
+
| Pattern | Correct | Incorrect | Why |
|
|
399
|
+
| ------------------- | ----------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------- |
|
|
400
|
+
| Return type | `execute()` returns `Promise<GetPromptResult>` | Returning a plain string or array of strings | MCP protocol requires `{ messages: [...] }` structure |
|
|
401
|
+
| Argument validation | Mark arguments as `required: true` in `arguments` array | Manually checking `args.field` inside `execute()` | Framework validates required arguments before `execute()` runs |
|
|
402
|
+
| Multi-turn priming | Use `assistant` role messages to prime expected response patterns | Putting all instructions in a single `user` message | Alternating roles guides the LLM toward structured output |
|
|
403
|
+
| Resource embedding | Use `type: 'resource'` content with a resource URI | Inlining resource data as raw text in the prompt | Resource references let clients resolve content dynamically |
|
|
404
|
+
| Error handling | Use `this.fail(err)` for validation failures in execute | `throw new Error(...)` directly | `this.fail` triggers the error flow with proper MCP error propagation |
|
|
405
|
+
|
|
406
|
+
## Verification Checklist
|
|
407
|
+
|
|
408
|
+
### Configuration
|
|
409
|
+
|
|
410
|
+
- [ ] Prompt class extends `PromptContext` and implements `execute(args)`
|
|
411
|
+
- [ ] `@Prompt` decorator has `name` and `arguments` array with correct `required` flags
|
|
412
|
+
- [ ] Prompt is registered in `prompts` array of `@App` or `@FrontMcp`
|
|
413
|
+
- [ ] All required arguments have `required: true`
|
|
414
|
+
|
|
415
|
+
### Runtime
|
|
416
|
+
|
|
417
|
+
- [ ] Prompt appears in `prompts/list` MCP response
|
|
418
|
+
- [ ] Calling prompt with valid arguments returns well-formed `GetPromptResult`
|
|
419
|
+
- [ ] Missing required arguments trigger `MissingPromptArgumentError`
|
|
420
|
+
- [ ] Multi-turn messages have correct `user`/`assistant` role alternation
|
|
421
|
+
- [ ] DI dependencies resolve correctly via `this.get()`
|
|
422
|
+
|
|
423
|
+
## Troubleshooting
|
|
424
|
+
|
|
425
|
+
| Problem | Cause | Solution |
|
|
426
|
+
| ------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
427
|
+
| Prompt not appearing in `prompts/list` | Not registered in `prompts` array | Add prompt class to `@App` or `@FrontMcp` `prompts` array |
|
|
428
|
+
| `MissingPromptArgumentError` on optional argument | Argument marked `required: true` incorrectly | Set `required: false` for optional arguments in the `arguments` array |
|
|
429
|
+
| LLM ignores priming messages | Only using `user` role messages | Add `assistant` role messages to prime the conversation pattern |
|
|
430
|
+
| Type error on `execute()` return | Returning plain string instead of `GetPromptResult` | Wrap return in `{ messages: [{ role: 'user', content: { type: 'text', text: '...' } }] }` |
|
|
431
|
+
| `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
|
|
432
|
+
|
|
433
|
+
## Reference
|
|
434
|
+
|
|
435
|
+
- [Prompts Documentation](https://docs.agentfront.dev/frontmcp/servers/prompts)
|
|
436
|
+
- Related skills: `create-tool`, `create-resource`, `create-agent`, `create-provider`
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-provider
|
|
3
|
-
description: Create dependency injection providers for database connections, API clients, and singleton services. Use when tools and resources need shared services, DB pools, or configuration objects.
|
|
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
|
|
20
|
-
---
|
|
21
|
-
|
|
22
1
|
# Creating Providers (Dependency Injection)
|
|
23
2
|
|
|
24
3
|
Providers are singleton services — database pools, API clients, config objects — that tools, resources, prompts, and agents can access via `this.get(token)`.
|
|
25
4
|
|
|
26
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Multiple tools, resources, or agents need a shared database connection pool
|
|
10
|
+
- API clients or external service connections must be singleton (not recreated per request)
|
|
11
|
+
- You need lifecycle management with `onInit()` at startup and `onDestroy()` at shutdown
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Centralizing configuration values as a type-safe injectable object
|
|
16
|
+
- Sharing a cache layer (Map, Redis) across all execution contexts
|
|
17
|
+
- Providing environment-specific settings (API URLs, feature flags) via DI
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
### Skip When
|
|
29
20
|
|
|
30
|
-
-
|
|
31
|
-
- You
|
|
32
|
-
-
|
|
33
|
-
|
|
21
|
+
- The service is only used by a single tool and has no lifecycle (inline it in the tool)
|
|
22
|
+
- You need to build an executable action for AI clients (see `create-tool`)
|
|
23
|
+
- You need autonomous LLM-driven orchestration (see `create-agent`)
|
|
24
|
+
|
|
25
|
+
> **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
26
|
|
|
35
27
|
## Step 1: Define a Token
|
|
36
28
|
|
|
@@ -231,3 +223,46 @@ frontmcp dev
|
|
|
231
223
|
# Call a tool that uses the provider
|
|
232
224
|
# If provider fails to init, you'll see an error at startup
|
|
233
225
|
```
|
|
226
|
+
|
|
227
|
+
## Common Patterns
|
|
228
|
+
|
|
229
|
+
| Pattern | Correct | Incorrect | Why |
|
|
230
|
+
| ------------------ | ---------------------------------------------------------------------- | --------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
231
|
+
| 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()` |
|
|
232
|
+
| 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 |
|
|
233
|
+
| Lifecycle | Use `onInit()` for async setup, `onDestroy()` for cleanup | Initializing connections in the constructor | Constructor runs synchronously; `onInit()` supports async operations |
|
|
234
|
+
| 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 |
|
|
235
|
+
| Config provider | `readonly` properties from `process.env` | Mutable properties that change at runtime | Providers are singletons; mutable state can cause race conditions |
|
|
236
|
+
|
|
237
|
+
## Verification Checklist
|
|
238
|
+
|
|
239
|
+
### Configuration
|
|
240
|
+
|
|
241
|
+
- [ ] Provider class has `@Provider` decorator with `name`
|
|
242
|
+
- [ ] Token is defined with `Token<T>` using a `Symbol` and typed interface
|
|
243
|
+
- [ ] Provider is registered in `providers` array of `@App` or `@FrontMcp`
|
|
244
|
+
- [ ] `onInit()` handles async setup (DB connections, API clients)
|
|
245
|
+
- [ ] `onDestroy()` cleans up resources (close connections, flush buffers)
|
|
246
|
+
|
|
247
|
+
### Runtime
|
|
248
|
+
|
|
249
|
+
- [ ] Server starts without provider initialization errors
|
|
250
|
+
- [ ] `this.get(TOKEN)` resolves the provider in tools, resources, and agents
|
|
251
|
+
- [ ] Provider is a singleton (same instance across all contexts)
|
|
252
|
+
- [ ] Server shutdown calls `onDestroy()` and cleans up resources
|
|
253
|
+
- [ ] Missing provider throws `DependencyNotFoundError` with a clear message
|
|
254
|
+
|
|
255
|
+
## Troubleshooting
|
|
256
|
+
|
|
257
|
+
| Problem | Cause | Solution |
|
|
258
|
+
| ------------------------------------ | --------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
259
|
+
| `DependencyNotFoundError` at runtime | Provider not registered in scope | Add provider to `providers` array in `@App` or `@FrontMcp` |
|
|
260
|
+
| Provider `onInit()` fails at startup | Missing environment variable or unreachable service | Check environment variables and service connectivity before starting |
|
|
261
|
+
| Multiple instances of same provider | Registered in multiple apps instead of server level | Move to `@FrontMcp` `providers` for shared, server-scoped access |
|
|
262
|
+
| Type mismatch on `this.get(TOKEN)` | Token typed with wrong interface | Ensure `Token<T>` generic matches the provider's implemented interface |
|
|
263
|
+
| Provider not destroyed on shutdown | Missing `onDestroy()` method | Implement `onDestroy()` to close connections and release resources |
|
|
264
|
+
|
|
265
|
+
## Reference
|
|
266
|
+
|
|
267
|
+
- [Providers Documentation](https://docs.agentfront.dev/frontmcp/extensibility/providers)
|
|
268
|
+
- Related skills: `create-tool`, `create-resource`, `create-agent`, `create-prompt`
|
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-resource
|
|
3
|
-
description: Create MCP resources and resource templates with URI-based access. Use when exposing data via URIs, creating resource templates, or serving dynamic content.
|
|
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
|
|
27
|
-
---
|
|
28
|
-
|
|
29
1
|
# Creating MCP Resources
|
|
30
2
|
|
|
31
3
|
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
4
|
|
|
33
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Exposing data to AI clients through URI-based access following the MCP protocol
|
|
10
|
+
- Serving dynamic or static content that clients read on demand (config, status, files)
|
|
11
|
+
- Creating parameterized URI patterns for families of related data (user profiles, repo files)
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Providing binary assets (images, PDFs) to AI clients via base64 blob encoding
|
|
16
|
+
- Centralizing read-only data sources that multiple tools or prompts reference
|
|
17
|
+
- Replacing ad-hoc tool responses with structured, cacheable resource URIs
|
|
34
18
|
|
|
35
|
-
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- The client needs to perform an action, not read data (see `create-tool`)
|
|
22
|
+
- You are building a reusable conversation template (see `create-prompt`)
|
|
23
|
+
- The data requires autonomous multi-step reasoning to produce (see `create-agent`)
|
|
24
|
+
|
|
25
|
+
> **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
26
|
|
|
37
27
|
## Static Resources with @Resource
|
|
38
28
|
|
|
@@ -435,3 +425,45 @@ nx generate @frontmcp/nx:resource
|
|
|
435
425
|
```
|
|
436
426
|
|
|
437
427
|
This creates the resource file, spec file, and updates barrel exports.
|
|
428
|
+
|
|
429
|
+
## Common Patterns
|
|
430
|
+
|
|
431
|
+
| Pattern | Correct | Incorrect | Why |
|
|
432
|
+
| ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
433
|
+
| 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 |
|
|
434
|
+
| Resource vs template | `@Resource` for fixed URIs, `@ResourceTemplate` for `{param}` URIs | Using `@Resource` with `{param}` placeholders | Framework selects matching strategy based on decorator type |
|
|
435
|
+
| 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` |
|
|
436
|
+
| 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 |
|
|
437
|
+
| 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 |
|
|
438
|
+
|
|
439
|
+
## Verification Checklist
|
|
440
|
+
|
|
441
|
+
### Configuration
|
|
442
|
+
|
|
443
|
+
- [ ] Resource class extends `ResourceContext` and implements `execute(uri, params)`
|
|
444
|
+
- [ ] `@Resource` has `name` and `uri` with a valid scheme, or `@ResourceTemplate` has `name` and `uriTemplate`
|
|
445
|
+
- [ ] Resource is registered in `resources` array of `@App` or `@FrontMcp`
|
|
446
|
+
- [ ] `mimeType` is set when the content type is not plain text
|
|
447
|
+
|
|
448
|
+
### Runtime
|
|
449
|
+
|
|
450
|
+
- [ ] Resource appears in `resources/list` MCP response
|
|
451
|
+
- [ ] Reading the resource URI returns the expected `ReadResourceResult`
|
|
452
|
+
- [ ] Template parameters are extracted correctly from the URI
|
|
453
|
+
- [ ] Binary resources return valid base64 in the `blob` field
|
|
454
|
+
- [ ] DI dependencies resolve correctly via `this.get()`
|
|
455
|
+
|
|
456
|
+
## Troubleshooting
|
|
457
|
+
|
|
458
|
+
| Problem | Cause | Solution |
|
|
459
|
+
| ------------------------------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------- |
|
|
460
|
+
| Resource not appearing in `resources/list` | Not registered in `resources` array | Add resource class to `@App` or `@FrontMcp` `resources` array |
|
|
461
|
+
| URI validation error at startup | Missing or invalid URI scheme | Ensure URI has a scheme like `config://`, `https://`, or `custom://` |
|
|
462
|
+
| Template parameters are empty | Using `@Resource` instead of `@ResourceTemplate` | Switch to `@ResourceTemplate` with `uriTemplate` containing `{param}` placeholders |
|
|
463
|
+
| Binary content is garbled | Returning raw buffer in `text` field | Use `blob: buffer.toString('base64')` instead of `text` for binary data |
|
|
464
|
+
| `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
|
|
465
|
+
|
|
466
|
+
## Reference
|
|
467
|
+
|
|
468
|
+
- [Resources Documentation](https://docs.agentfront.dev/frontmcp/servers/resources)
|
|
469
|
+
- Related skills: `create-tool`, `create-prompt`, `create-provider`, `create-agent`
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-skill-with-tools
|
|
3
|
-
description: Create skills that reference and orchestrate MCP tools for multi-step workflows. Use when building skills with tool references, SKILL.md directories, or workflow instructions.
|
|
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
|
|
20
|
-
---
|
|
21
|
-
|
|
22
1
|
# Creating a Skill with Tools
|
|
23
2
|
|
|
24
3
|
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
4
|
|
|
26
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
27
6
|
|
|
28
|
-
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Teaching an AI client how to accomplish a complex task by combining multiple tools in a defined sequence
|
|
10
|
+
- Building directory-based skills with `SKILL.md`, scripts, references, and assets loaded via `skillDir()`
|
|
11
|
+
- Defining tool-orchestration instructions with explicit tool references, parameters, and examples
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Creating reusable workflow guides that can be discovered via HTTP (`/llm.txt`, `/skills`) or MCP protocol
|
|
16
|
+
- Wrapping existing tools into a higher-level procedure with step-by-step instructions and validation modes
|
|
17
|
+
- Providing AI clients with structured playbooks for incident response, deployment, or data-processing flows
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- You need a single executable action with direct input/output (see `create-tool`)
|
|
22
|
+
- You need an autonomous LLM loop that reasons across multiple steps on its own (see `create-agent`)
|
|
23
|
+
- You are building a conversational template or system prompt without tool references (see `create-prompt`)
|
|
24
|
+
|
|
25
|
+
> **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
26
|
|
|
30
27
|
| Aspect | @Skill | @Tool | @Agent |
|
|
31
28
|
| ---------- | ------------------------ | -------------------- | -------------------- |
|
|
@@ -215,7 +212,7 @@ class RemoteWorkflowSkill extends SkillContext {}
|
|
|
215
212
|
|
|
216
213
|
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
214
|
|
|
218
|
-
```
|
|
215
|
+
```text
|
|
219
216
|
skills/
|
|
220
217
|
deploy-service/
|
|
221
218
|
SKILL.md # Instructions with YAML frontmatter
|
|
@@ -577,3 +574,51 @@ class AuditApp {}
|
|
|
577
574
|
})
|
|
578
575
|
class AuditServer {}
|
|
579
576
|
```
|
|
577
|
+
|
|
578
|
+
## Common Patterns
|
|
579
|
+
|
|
580
|
+
| Pattern | Correct | Incorrect | Why |
|
|
581
|
+
| ------------------ | ------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
582
|
+
| 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 |
|
|
583
|
+
| 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'` |
|
|
584
|
+
| 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 |
|
|
585
|
+
| 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 |
|
|
586
|
+
| 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 |
|
|
587
|
+
|
|
588
|
+
## Verification Checklist
|
|
589
|
+
|
|
590
|
+
### Configuration
|
|
591
|
+
|
|
592
|
+
- [ ] `@Skill` decorator has `name` and `description`
|
|
593
|
+
- [ ] `instructions` are provided via inline string, `{ file }`, or `{ url }`
|
|
594
|
+
- [ ] All tool references in `tools` array resolve to registered tools (when `toolValidation: 'strict'`)
|
|
595
|
+
- [ ] Skill is registered in `skills` array of `@App` or `@FrontMcp`
|
|
596
|
+
|
|
597
|
+
### Runtime
|
|
598
|
+
|
|
599
|
+
- [ ] Skill appears in MCP skill listing (`skills/list`) when `visibility` includes `'mcp'`
|
|
600
|
+
- [ ] Skill appears at `/llm.txt` and `/skills` HTTP endpoints when `visibility` includes `'http'`
|
|
601
|
+
- [ ] `build()` returns complete `SkillContent` with instructions and tool references
|
|
602
|
+
- [ ] `getToolRefs()` returns the correct list of resolved tool references
|
|
603
|
+
- [ ] Hidden skills (`hideFromDiscovery: true`) are invocable but not listed in discovery
|
|
604
|
+
|
|
605
|
+
### Directory-Based Skills
|
|
606
|
+
|
|
607
|
+
- [ ] `SKILL.md` file exists at the root of the skill directory with valid YAML frontmatter
|
|
608
|
+
- [ ] `skillDir()` correctly loads instructions, scripts, references, and assets
|
|
609
|
+
- [ ] Frontmatter `tools` entries match registered tool names
|
|
610
|
+
|
|
611
|
+
## Troubleshooting
|
|
612
|
+
|
|
613
|
+
| Problem | Cause | Solution |
|
|
614
|
+
| -------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
615
|
+
| Skill not appearing in `/llm.txt` | `visibility` is set to `'mcp'` | Change to `'both'` or `'http'` to include HTTP discovery |
|
|
616
|
+
| `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` |
|
|
617
|
+
| `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 |
|
|
618
|
+
| 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 |
|
|
619
|
+
| Parameters not visible to AI client | `parameters` defined as a plain object instead of an array | Use array format: `[{ name, description, type, required }]` |
|
|
620
|
+
|
|
621
|
+
## Reference
|
|
622
|
+
|
|
623
|
+
- [Skills Documentation](https://docs.agentfront.dev/frontmcp/servers/skills)
|
|
624
|
+
- Related skills: `create-skill`, `create-tool`, `create-agent`, `create-prompt`
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-skill
|
|
3
|
-
description: Create instruction-only skills that guide AI through workflows without tool references. Use when building knowledge packages, coding guidelines, or workflow templates.
|
|
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
|
|
10
|
-
---
|
|
11
|
-
|
|
12
1
|
# Creating Instruction-Only Skills
|
|
13
2
|
|
|
14
3
|
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
4
|
|
|
16
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- You need to package knowledge, conventions, or workflow steps as a reusable skill that AI clients can follow
|
|
10
|
+
- You are creating a SKILL.md catalog entry or a class/function-based skill with no tool dependencies
|
|
11
|
+
- You want to enforce coding standards, onboarding steps, or review criteria through structured AI guidance
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
- You are building a deployment runbook, architecture decision record, or quality gate checklist
|
|
16
|
+
- You want to share workflow templates across teams via MCP or HTTP discovery endpoints
|
|
17
|
+
- You need parameterized instructions that callers can customize per invocation
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
- Architecture decision records
|
|
22
|
-
- Onboarding checklists
|
|
23
|
-
- Deployment runbooks without automated steps
|
|
24
|
-
- Review criteria and quality gates
|
|
19
|
+
### Skip When
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
- The skill must invoke MCP tools during execution -- use `create-skill-with-tools` instead
|
|
22
|
+
- You need an autonomous agent loop rather than static instructions -- use an agent pattern instead
|
|
23
|
+
- The content is a one-off prompt with no reuse value -- a plain prompt template is simpler
|
|
24
|
+
|
|
25
|
+
> **Decision:** Pick this skill when you need a reusable, instruction-only knowledge package that guides AI through a workflow without requiring tool calls.
|
|
27
26
|
|
|
28
27
|
## Class-Based Pattern
|
|
29
28
|
|
|
@@ -217,7 +216,7 @@ Use `skillDir()` to load a skill from a directory containing a `SKILL.md` file w
|
|
|
217
216
|
|
|
218
217
|
### Directory Structure
|
|
219
218
|
|
|
220
|
-
```
|
|
219
|
+
```text
|
|
221
220
|
skills/
|
|
222
221
|
coding-standards/
|
|
223
222
|
SKILL.md # Instructions with YAML frontmatter
|
|
@@ -524,3 +523,55 @@ class OnboardingApp {}
|
|
|
524
523
|
})
|
|
525
524
|
class DevServer {}
|
|
526
525
|
```
|
|
526
|
+
|
|
527
|
+
## Common Patterns
|
|
528
|
+
|
|
529
|
+
| Pattern | Correct | Incorrect | Why |
|
|
530
|
+
| ----------------------------------- | ------------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
531
|
+
| 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 |
|
|
532
|
+
| 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 |
|
|
533
|
+
| 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 |
|
|
534
|
+
| Visibility for internal runbooks | `visibility: 'mcp'` | `visibility: 'both'` for sensitive content | Internal procedures should not be exposed on public HTTP endpoints like `/llm.txt` |
|
|
535
|
+
| 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 |
|
|
536
|
+
|
|
537
|
+
## Verification Checklist
|
|
538
|
+
|
|
539
|
+
### Structure
|
|
540
|
+
|
|
541
|
+
- [ ] Skill has a unique kebab-case `name`
|
|
542
|
+
- [ ] `description` is a single sentence explaining what the skill teaches
|
|
543
|
+
- [ ] `instructions` field is set (inline string, file reference, or URL reference)
|
|
544
|
+
- [ ] No tool references appear in the instructions (instruction-only skill)
|
|
545
|
+
|
|
546
|
+
### Metadata
|
|
547
|
+
|
|
548
|
+
- [ ] `tags` array includes relevant categorization keywords
|
|
549
|
+
- [ ] `visibility` is set appropriately (`'mcp'`, `'http'`, or `'both'`)
|
|
550
|
+
- [ ] `parameters` have `name`, `description`, and `type` defined if present
|
|
551
|
+
- [ ] `examples` include `scenario` and `expectedOutcome` if present
|
|
552
|
+
|
|
553
|
+
### Registration
|
|
554
|
+
|
|
555
|
+
- [ ] Skill class or function is added to the `skills` array in `@App` or `@FrontMcp`
|
|
556
|
+
- [ ] Barrel export (`index.ts`) is updated if the skill is part of a publishable library
|
|
557
|
+
- [ ] Test file (`*.spec.ts`) exists and covers metadata and build output
|
|
558
|
+
|
|
559
|
+
### Discovery
|
|
560
|
+
|
|
561
|
+
- [ ] Skill appears in `GET /skills` or MCP tool listing based on visibility setting
|
|
562
|
+
- [ ] `hideFromDiscovery` is only set to `true` when the skill must be invoked by name only
|
|
563
|
+
|
|
564
|
+
## Troubleshooting
|
|
565
|
+
|
|
566
|
+
| Problem | Cause | Fix |
|
|
567
|
+
| ------------------------------------------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
568
|
+
| Skill does not appear in `/llm.txt` or `/skills` | `visibility` is set to `'mcp'` or `hideFromDiscovery` is `true` | Set `visibility: 'both'` and `hideFromDiscovery: false` |
|
|
569
|
+
| `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 |
|
|
570
|
+
| `build()` throws "instructions required" | The `instructions` field is missing or `undefined` in `@Skill` metadata | Provide an inline string, `{ file: '...' }`, or `{ url: '...' }` |
|
|
571
|
+
| 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 |
|
|
572
|
+
| 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 |
|
|
573
|
+
|
|
574
|
+
## Reference
|
|
575
|
+
|
|
576
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/servers/skills>
|
|
577
|
+
- **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,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-tool
|
|
3
|
-
description: Create and register an MCP tool with Zod input validation and typed output. Use when building tools, defining input schemas, adding output validation, or registering tools in an app.
|
|
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
|
|
23
|
-
---
|
|
24
|
-
|
|
25
1
|
# Creating an MCP Tool
|
|
26
2
|
|
|
27
3
|
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
4
|
|
|
29
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Building a new executable action that AI clients can invoke via MCP
|
|
10
|
+
- Defining typed input schemas with Zod validation for tool parameters
|
|
11
|
+
- Adding output schema validation to prevent data leaks from tool responses
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Adding rate limiting, concurrency control, or timeouts to existing tools
|
|
16
|
+
- Integrating dependency injection into tool execution
|
|
17
|
+
- Converting raw function handlers into class-based `ToolContext` patterns
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- Exposing read-only data that does not require execution logic (see `create-resource`)
|
|
22
|
+
- Building conversational templates or system prompts (see `create-prompt`)
|
|
23
|
+
- Orchestrating multi-tool workflows with conditional logic (see `create-agent`)
|
|
24
|
+
|
|
25
|
+
> **Decision:** Use this skill when you need an AI-callable action that accepts validated input, performs work, and returns structured output.
|
|
32
26
|
|
|
33
27
|
## Class-Based Pattern
|
|
34
28
|
|
|
@@ -416,3 +410,45 @@ class ExpensiveOperationTool extends ToolContext {
|
|
|
416
410
|
}
|
|
417
411
|
}
|
|
418
412
|
```
|
|
413
|
+
|
|
414
|
+
## Common Patterns
|
|
415
|
+
|
|
416
|
+
| Pattern | Correct | Incorrect | Why |
|
|
417
|
+
| -------------- | ----------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
|
|
418
|
+
| Input schema | `inputSchema: { name: z.string() }` (raw shape) | `inputSchema: z.object({ name: z.string() })` | Framework wraps in `z.object()` internally |
|
|
419
|
+
| Output schema | Always define `outputSchema` | Omit `outputSchema` | Prevents data leaks and enables CodeCall chaining |
|
|
420
|
+
| 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 |
|
|
421
|
+
| Error handling | `this.fail(new ResourceNotFoundError(...))` | `throw new Error(...)` | `this.fail` triggers the error flow with MCP error codes |
|
|
422
|
+
| Tool naming | `snake_case` names: `get_weather` | `camelCase` or `PascalCase`: `getWeather` | MCP protocol convention for tool names |
|
|
423
|
+
|
|
424
|
+
## Verification Checklist
|
|
425
|
+
|
|
426
|
+
### Configuration
|
|
427
|
+
|
|
428
|
+
- [ ] Tool class extends `ToolContext` and implements `execute()`
|
|
429
|
+
- [ ] `@Tool` decorator has `name`, `description`, and `inputSchema`
|
|
430
|
+
- [ ] `outputSchema` is defined to validate and restrict output fields
|
|
431
|
+
- [ ] Tool is registered in `tools` array of `@App` or `@FrontMcp`
|
|
432
|
+
|
|
433
|
+
### Runtime
|
|
434
|
+
|
|
435
|
+
- [ ] Tool appears in `tools/list` MCP response
|
|
436
|
+
- [ ] Valid input returns expected output
|
|
437
|
+
- [ ] Invalid input returns Zod validation error (not a crash)
|
|
438
|
+
- [ ] `this.fail()` triggers proper MCP error response
|
|
439
|
+
- [ ] DI dependencies resolve correctly via `this.get()`
|
|
440
|
+
|
|
441
|
+
## Troubleshooting
|
|
442
|
+
|
|
443
|
+
| Problem | Cause | Solution |
|
|
444
|
+
| ------------------------------------------------ | ------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
445
|
+
| Tool not appearing in `tools/list` | Not registered in `tools` array | Add tool class to `@App` or `@FrontMcp` `tools` array |
|
|
446
|
+
| Zod validation error on valid input | Using `z.object()` wrapper in `inputSchema` | Use raw shape: `{ field: z.string() }` not `z.object({ field: z.string() })` |
|
|
447
|
+
| `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
|
|
448
|
+
| Output contains unexpected fields | No `outputSchema` defined | Add `outputSchema` to strip unvalidated fields from response |
|
|
449
|
+
| Tool times out | No timeout configured for long operation | Add `timeout: { executeMs: 30_000 }` to `@Tool` options |
|
|
450
|
+
|
|
451
|
+
## Reference
|
|
452
|
+
|
|
453
|
+
- [Tools Documentation](https://docs.agentfront.dev/frontmcp/servers/tools)
|
|
454
|
+
- Related skills: `create-resource`, `create-prompt`, `configure-throttle`, `create-agent`
|