diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index a52daa05b..192ebb612 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -110,6 +110,6 @@ jobs: # Create GitHub release gh release create "v${{ steps.get_version.outputs.beta_version }}" \ - --title "Beta Release v${{ steps.get_version.outputs.beta_version }}" \ + --title "CLI Beta Release v${{ steps.get_version.outputs.beta_version }}" \ --notes "Daily beta release for testing. This version will be promoted to stable after 7 days if no critical issues are found." \ --prerelease diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 6ed9292b7..9c33c822c 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -116,7 +116,7 @@ jobs: # Validate wrapper - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 + uses: gradle/actions/wrapper-validation@v5 # # Set up Java environment for the next steps - name: Setup Java @@ -127,7 +127,7 @@ jobs: # # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v5 with: gradle-home-cache-cleanup: true @@ -444,7 +444,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v5 with: gradle-home-cache-cleanup: true @@ -522,7 +522,7 @@ jobs: # Setup Gradle - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v5 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 6c02f1f17..c24abf8f8 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -208,7 +208,7 @@ jobs: # Create GitHub release gh release create "v${{ steps.final_version.outputs.stable_version }}" \ - --title "Stable Release v${{ steps.final_version.outputs.stable_version }}" \ + --title "CLI Stable Release v${{ steps.final_version.outputs.stable_version }}" \ --notes "${{ steps.final_version.outputs.release_notes }}" \ --latest diff --git a/.github/workflows/submit-github-dependency-graph.yml b/.github/workflows/submit-github-dependency-graph.yml index 08373c66a..b647c6557 100644 --- a/.github/workflows/submit-github-dependency-graph.yml +++ b/.github/workflows/submit-github-dependency-graph.yml @@ -19,7 +19,7 @@ jobs: distribution: "temurin" java-version: 17 - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@v4 + uses: gradle/actions/dependency-submission@v5 with: # The gradle project is not in the root of the repository. build-root-directory: extensions/intellij diff --git a/core/core.ts b/core/core.ts index 270668b17..0d1b5ffba 100644 --- a/core/core.ts +++ b/core/core.ts @@ -83,6 +83,7 @@ import { NextEditProvider } from "./nextEdit/NextEditProvider"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { OnboardingModes } from "./protocol/core"; import type { IMessenger, Message } from "./protocol/messenger"; +import { ContinueError, ContinueErrorReason } from "./util/errors"; import { shareSession } from "./util/historyUtils"; import { Logger } from "./util/Logger.js"; @@ -1131,12 +1132,27 @@ export class Core { if (!tool) { throw new Error(`Tool ${toolName} not found`); } - const preprocessedArgs = await tool.preprocessArgs?.(args, { - ide: this.ide, - }); - return { - preprocessedArgs, - }; + + try { + const preprocessedArgs = await tool.preprocessArgs?.(args, { + ide: this.ide, + }); + return { + preprocessedArgs, + }; + } catch (e) { + let errorReason = + e instanceof ContinueError ? e.reason : ContinueErrorReason.Unknown; + let errorMessage = + e instanceof Error + ? e.message + : `Error preprocessing tool call args for ${toolName}\n${JSON.stringify(args)}`; + return { + preprocessedArgs: undefined, + errorReason, + errorMessage, + }; + } }); on("isItemTooBig", async ({ data: { item } }) => { diff --git a/core/protocol/core.ts b/core/protocol/core.ts index ea8bb388a..c559d9f64 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -54,6 +54,7 @@ import { } from "../control-plane/client"; import { ProcessedItem } from "../nextEdit/NextEditPrefetchQueue"; import { NextEditOutcome } from "../nextEdit/types"; +import { ContinueErrorReason } from "../util/errors"; export enum OnboardingModes { API_KEY = "API Key", @@ -317,7 +318,11 @@ export type ToCoreFromIdeOrWebviewProtocol = { ]; "tools/preprocessArgs": [ { toolName: string; args: Record }, - { preprocessedArgs?: Record }, + { + preprocessedArgs?: Record; + errorReason?: ContinueErrorReason; + errorMessage?: string; + }, ]; "clipboardCache/add": [{ content: string }, void]; "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void]; diff --git a/docs/customization/rules.mdx b/docs/customization/rules.mdx index 75dbfc811..e685e8303 100644 --- a/docs/customization/rules.mdx +++ b/docs/customization/rules.mdx @@ -15,4 +15,28 @@ By implementing rules, you transform the AI from a generic coding agent into a k Your agent detects rules and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes. +## Where to Manage Rules + + + +- Create files in `.continue/rules` folder +- Automatically appear with Hub assistants +- Edit directly in your file system +- Version controlled alongside your code +- Best for project-specific rules (e.g., "remember to generate migrations after modifying the db") + + + +- Manage on [Continue Hub](https://hub.continue.dev) +- Reference in config.yaml with `uses:` +- Share with team and community +- Easy to include in multiple agents +- Best for organization-wide rules (e.g., "always use X library for Y task") + + + + +**Quick Setup**: Start with local rules for immediate use, then promote commonly used rules to the Hub for sharing and reuse. + + Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details. \ No newline at end of file diff --git a/docs/customize/deep-dives/rules.mdx b/docs/customize/deep-dives/rules.mdx index 93631f3ab..449fc272d 100644 --- a/docs/customize/deep-dives/rules.mdx +++ b/docs/customize/deep-dives/rules.mdx @@ -20,6 +20,42 @@ You can view the current rules by clicking the pen icon above the main toolbar: To form the system message, rules are joined with new lines, in the order they appear in the toolbar. This includes the base chat system message ([see below](#how-to-customize-chat-system-message)). +## Understanding Hub vs Local Rules Integration + + +**Important:** Rules created in different locations behave differently and have different synchronization patterns. + + +Continue supports two types of rules with different behaviors: + + + +- **Location**: `.continue/rules` folder in your workspace +- **Visibility**: Automatically visible when using Hub assistants +- **Creation**: Add rules button in VSCode or manual file creation +- **File Management**: Creates actual `.md` files you can edit directly + + + +- **Location**: Stored on Continue Hub, referenced in config.yaml +- **Visibility**: Only appear when referenced in assistant configuration +- **Creation**: Created directly on Hub or copied from local rules +- **File Management**: No local files created, managed through Hub interface + + + +### How Rules Are Applied + +When using Continue, rules are loaded in this order: +1. **Hub assistant rules** (if using a Hub-based assistant) +2. **Referenced Hub rules** (via `uses:` in config.yaml) +3. **Local workspace rules** (from `.continue/rules` folder) +4. **Global rules** (from `~/.continue/rules` folder) + + +**TL;DR**: Local rules show up automatically when using Hub assistants. Hub rules show up automatically when referenced in your config. + + ## Quick Start: How to Create Your First Rule File Below is a quick example of setting up a new rule file: @@ -42,6 +78,8 @@ Now test your rules by asking a question about a file in chat. ## How to Create Rules Blocks +### Creating Local Rules + Rules can be added locally using the "Add Rules" button while viewing the Local Agent's rules. ![add local rules button](/images/add-local-rules.png) @@ -50,12 +88,44 @@ Rules can be added locally using the "Add Rules" button while viewing the Local **Automatically create local rule blocks**: When in Agent mode, you can prompt the agent to create a rule for you using the `create_rule_block` tool if enabled. For example, you can say "Create a rule for this", and a rule will be created for you in `.continue/rules` based on your conversation. - -Rules can also be added to an Agent on the Continue Hub. +### Creating Hub Rules -Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. +Rules can also be created and managed on the Continue Hub: + +1. **Browse existing rules**: [Explore available rules](https://hub.continue.dev) +2. **Create new rules**: [Create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub +3. **Copy from local rules**: Copy/paste content from your `.continue/rules` files to create Hub rules + +### Working Between Hub and Local Rules + + + +To use Hub rules in your local setup: + +1. Reference them in your `config.yaml`: + ```yaml + rules: + - uses: username/my-hub-rule + ``` +2. The rule will automatically appear in your rules toolbar +3. **Note**: No local file is created - the rule exists only on the Hub + + + +To move local rules to the Hub: + +1. Copy the content from your `.continue/rules/rule-name.md` file +2. Go to [Create new rule](https://hub.continue.dev/new?type=block&blockType=rules) +3. Paste the content and configure the rule +4. Optionally, remove the local file and reference the Hub rule in your config + + +**Current Limitation**: There's no automatic sync from local to Hub. You must manually copy/paste rule content. + + + ### How to Configure Rule Properties and Syntax @@ -150,6 +220,42 @@ globs: ["**/*.ts", "**/*.tsx"] - modularize components into smaller, reusable pieces ``` +## Troubleshooting Rules + +### Issue: Rules Created in Different Places Don't Sync + +**Problem**: You created rules in the Hub but don't see them in VSCode, or vice versa. + +**Solution**: +- **Hub rules** only appear when referenced in your config.yaml using the `uses:` syntax +- **Local rules** automatically appear when using Hub assistants +- There's currently no automatic bidirectional sync + +### Issue: "Edit" Links Point to Wrong Location + +**Problem**: When you click "Edit" on a rule in VSCode, it tries to open the Hub even though the rule is local, or shows an incorrect URL. + +**Root Cause**: This happens when you have a mix of local and Hub rules, and Continue can't properly determine where each rule originates. + +**Workaround**: +1. **For local rules**: Navigate directly to `.continue/rules/` folder and edit the `.md` file +2. **For Hub rules**: Go directly to your assistant page on [Continue Hub](https://hub.continue.dev) and edit from there +3. Keep track of which rules are local vs Hub-based to avoid confusion + + +**Known Issue**: This link accuracy problem is tracked in [Linear issue CON-3084](https://linear.app/continue/issue/CON-3084) and will be fixed in a future update. + + +### Issue: Rules Don't Appear in Assistant + +**Problem**: Your rules exist but don't show up in the rules toolbar. + +**Check These**: +1. **File location**: Ensure local rules are in `.continue/rules/` (not `.continue/rule/`) +2. **File format**: Rules should be `.md` files with proper YAML frontmatter +3. **Config reference**: Hub rules must be referenced in `config.yaml` +4. **Assistant type**: Ensure you're using the correct assistant (local vs Hub) + ### How to Customize Chat System Message Continue includes a simple default system message for [Agent](../../features/agent/quick-start) and [Chat](../../features/chat/quick-start) requests, to help the model provide reliable codeblock formats in its output. diff --git a/docs/docs.json b/docs/docs.json index 94be18094..ea42918df 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -260,6 +260,7 @@ "icon": "book-open-cover", "pages": [ "guides/posthog-github-continuous-ai", + "guides/continue-docs-mcp-cookbook", "guides/snyk-mcp-continue-cookbook", "guides/dlt-mcp-continue-cookbook", "guides/netlify-mcp-continuous-deployment" diff --git a/docs/guides/continue-docs-mcp-cookbook.mdx b/docs/guides/continue-docs-mcp-cookbook.mdx new file mode 100644 index 000000000..76c4637dd --- /dev/null +++ b/docs/guides/continue-docs-mcp-cookbook.mdx @@ -0,0 +1,542 @@ +--- +title: "Contributing to Continue with Model Context Protocol (MCP)" +description: "Use the Continue Docs MCP to write cookbooks, guides, and documentation with AI-powered workflows." +sidebarTitle: "Continue Docs MCP Cookbook" +--- + + + Master using the Continue Docs MCP to contribute documentation, create cookbooks, and maintain consistency across Continue's docs - all through natural language prompts. + + +## Prerequisites + +Before starting, ensure you have: + +- Continue account with **Hub access** +- Read: [Contributing to Continue Documentation](/CONTRIBUTING) for setup instructions +- Forked the [continuedev/continue](https://github.com/continuedev/continue) repository +- Node.js 20+ and Continue CLI installed + + + This cookbook assumes you've read the setup in the [CONTRIBUTING guide](/CONTRIBUTING). If you haven't, start there first. + + +## Continue Docs MCP Setup + + + Use the pre-built [Docs Assistant - Mintlify agent](https://hub.continue.dev/continuedev/docs-mintlify) that includes the Continue Docs MCP and is ready to use immediately. + + + + + ```bash + # From your Continue docs directory + cn --config continuedev/docs-mintlify + ``` + + This agent includes: + - **Continue Docs MCP** for searching Continue documentation + - **Mintlify formatting rules** for proper component usage + - **Documentation-focused prompts** for common tasks + + + + If you want to customize, create your own agent and add: + 1. [Continue Docs MCP](https://hub.continue.dev/continuedev/continue-docs-mcp) + 2. [Mintlify Technical Writing Rule](https://hub.continue.dev/mintlify/technical-writing-rule) + + See the [CONTRIBUTING guide](/CONTRIBUTING#option-2-create-your-own-custom-agent) for details. + + + +--- + +## What is the Continue Docs MCP? + + + A Model Context Protocol server built with [Mintlify's MCP generation](https://www.mintlify.com/blog/generate-mcp-servers-for-your-docs) that enables semantic search across Continue documentation. [Learn more →](/reference/continue-mcp) + + +The MCP helps you: +- **Find examples** from existing documentation +- **Maintain consistency** with established patterns +- **Source accurate information** about Continue features +- **Write better documentation** faster + +--- + +## Documentation Workflows with Prompts + +### 🆕 Creating a New Cookbook + +Cookbooks show how to use Continue CLI with specific tools or services. Here's how to create one using the Continue Docs MCP: + + + + ```bash + cn --config continuedev/docs-mintlify + ``` + + **Prompt:** + ``` + "Show me the structure of existing MCP cookbooks in the Continue docs. + I want to create a cookbook for GitHub MCP." + ``` + + The agent will find examples like the dlt, Snyk, and Sanity cookbooks. + + + + **Prompt:** + ``` + "Using the Continue Docs MCP, find information about how GitHub MCP works. + Then search the web for the official GitHub MCP documentation and combine + both sources to create a cookbook following the same structure as the + dlt cookbook." + ``` + + The agent will: + - Search Continue docs for MCP patterns + - Fetch GitHub MCP official documentation + - Combine both sources + - Generate a cookbook with consistent formatting + + + + **Prompt:** + ``` + "Add my new github-mcp-continue-cookbook.mdx to the docs.json navigation + under the Cookbooks section." + ``` + + + + ```bash + npm run dev + # Visit http://localhost:3000 + ``` + + **Refine with prompts:** + ``` + "Add more examples to the troubleshooting section" + "Include a CI/CD workflow example using GitHub Actions" + "Add authentication setup using environment variables" + ``` + + + + + **Pro Tip:** The agent uses the Continue Docs MCP to maintain consistency with existing cookbooks automatically. + + +--- + +### ✏️ Updating Existing Documentation + + + + **Prompt:** + ``` + "Where is the MCP tools documentation located? Show me the file path." + ``` + + + + **Prompt:** + ``` + "Update the MCP tools documentation at docs/customization/mcp-tools.mdx + to include information about the new Slack MCP server. Use the Continue + Docs MCP to find examples of how other MCP servers are documented, then + add a similar section for Slack." + ``` + + + +--- + +### 📝 Adding New Guides + + + + **Prompt:** + ``` + "I want to create a guide for setting up Continue with Amazon Bedrock. + Search the Continue docs for similar model provider setup guides and + show me the common structure they follow." + ``` + + + + **Prompt:** + ``` + "Create a new guide at docs/guides/amazon-bedrock-setup.mdx following + the structure you found. Include: + - Prerequisites + - Step-by-step setup with code examples + - Configuration options + - Troubleshooting common issues + + Use the Continue Docs MCP to find accurate information about Continue's + model provider configuration." + ``` + + + + **Prompt:** + ``` + "Add this guide to docs.json under the Model Providers section" + ``` + + + +--- + +## Real-World Cookbook Examples + +### Example 1: PostgreSQL MCP Cookbook + +**Prompt:** +``` +"Create a cookbook for using Continue with PostgreSQL MCP. Follow the same +structure as the dlt cookbook, but customize it for database operations. + +Include these sections: +1. Quick start with pre-built agent +2. Manual setup with MCP configuration +3. Common database tasks (schema exploration, query writing, migrations) +4. Troubleshooting database connection issues + +Use the Continue Docs MCP to find MCP configuration patterns and search the +web for PostgreSQL MCP documentation." +``` + +### Example 2: Sentry Error Tracking Cookbook + +**Prompt:** +``` +"Create a cookbook showing how to use Continue to analyze Sentry errors. + +The cookbook should demonstrate: +1. Setting up Sentry MCP integration +2. Querying recent errors +3. Analyzing error patterns with AI +4. Generating fixes for common errors +5. CI/CD integration for automated error analysis + +Research the Snyk cookbook structure since it's also about error detection, +and adapt it for Sentry." +``` + +### Example 3: OpenAPI Documentation Cookbook + +**Prompt:** +``` +"I want to create a cookbook for using Continue to work with OpenAPI specs. + +Show how to: +1. Load OpenAPI specs into Continue's context +2. Generate API client code from specs +3. Create tests based on API endpoints +4. Update documentation when APIs change + +Use the Continue Docs MCP to find how context providers work, then combine +that with OpenAPI MCP information." +``` + +--- + +## Advanced Prompt Patterns + + + + ```bash + "Use the Continue Docs MCP to understand how agents + work in Continue, then search the web for Anthropic's + Computer Use MCP. Create a cookbook showing how to + combine Continue agents with Computer Use for + automated testing." + ``` + + + + ```bash + "Find all mentions of MCP servers across Continue + documentation. Then create a comprehensive reference + page that links to all MCP-related guides and + configurations." + ``` + + + + ```bash + "Review all cookbook files in docs/guides/ and check + if they follow the same structure. List any + inconsistencies and suggest updates to make them + uniform." + ``` + + + + ```bash + "Extract all code examples showing MCP server + configuration from the Continue docs. Format them + as a single reference page with explanations for + each pattern." + ``` + + + +--- + +## Testing Your Documentation + +### Local Preview + +```bash +cd docs +npm run dev +# Visit http://localhost:3000 +``` + +### Validation Prompts + +```bash +# Check formatting +"Review this documentation for Mintlify formatting issues and fix any problems" + +# Verify links +"Check all links in this file and ensure they point to existing documentation" + +# Test code examples +"Verify that all code examples in this cookbook are syntactically correct" +``` + +--- + +## Submitting Your Contribution + +**Prompt:** +```bash +"Create a pull request with my documentation changes and use the repo's +PR template to write the description" +``` + +The agent will: +- Create a feature branch +- Stage and commit your changes +- Push to your fork +- Generate a PR description following the template +- Open the PR for review + + + See the full [Contributing Guide](/CONTRIBUTING#submitting-your-contribution) for manual PR submission details. + + +--- + +## Automated Documentation Checks with GitHub Actions + +Add automated documentation checks to your PR workflow using the Continue Docs MCP agent: + +```yaml title=".github/workflows/docs-check.yml" +name: Documentation Check + +on: + pull_request: + types: [opened, synchronize] + paths: + - 'core/**' + - 'extensions/**' + - 'packages/**' + - 'gui/**' + +jobs: + check-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Continue CLI + run: npm i -g @continuedev/cli + + - name: Analyze Changes for Documentation Needs + id: analyze + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} + run: | + echo "🔍 Analyzing code changes for documentation needs..." + + # Get changed files + git diff origin/${{ github.base_ref }}..HEAD --name-only > changed_files.txt + + # Create detailed diff + git diff origin/${{ github.base_ref }}..HEAD > changes.diff + + # Use Continue agent to check if docs need updates + PROMPT="Review these code changes and determine if documentation updates are needed. + + Changed files: $(cat changed_files.txt | tr '\n' ' ') + + Consider: + - New features or APIs + - Breaking changes + - New configuration options + - Modified CLI commands + - New MCP integrations + + If docs updates are needed, specify which files in docs/ should be updated. + If no updates needed, respond with 'NO_DOCS_NEEDED'. + Be specific and concise." + + cn --config continuedev/docs-mintlify -p "$PROMPT" --auto > analysis.md || { + echo "⚠️ Analysis failed" + echo "needs_docs=false" >> $GITHUB_OUTPUT + exit 0 + } + + if grep -q "NO_DOCS_NEEDED" analysis.md; then + echo "needs_docs=false" >> $GITHUB_OUTPUT + else + echo "needs_docs=true" >> $GITHUB_OUTPUT + fi + + - name: Post Documentation Recommendation + if: steps.analyze.outputs.needs_docs == 'true' + env: + GH_TOKEN: ${{ github.token }} + run: | + echo "📝 Creating PR comment with documentation recommendations..." + + cat > pr-comment.md <<'EOF' +## 📚 Documentation Update Recommended + +Based on the code changes in this PR, documentation updates may be needed: + +EOF + + cat analysis.md >> pr-comment.md + + cat >> pr-comment.md <<'EOF' + +--- + +### Next Steps + +1. Review the suggested documentation areas above +2. Update relevant files in the `/docs` folder +3. Consider updating: + - API references for interface changes + - Guides for workflow changes + - Configuration docs for new settings + - MCP cookbooks for new integrations + +### Resources +- [Contributing to Docs](/CONTRIBUTING) +- [Continue Docs MCP Cookbook](/guides/continue-docs-mcp-cookbook) + +*This analysis was generated using the Continue Docs MCP agent.* +EOF + + gh pr comment ${{ github.event.pull_request.number }} --body-file pr-comment.md + + - name: Add Label + if: steps.analyze.outputs.needs_docs == 'true' + env: + GH_TOKEN: ${{ github.token }} + run: | + gh pr edit ${{ github.event.pull_request.number }} --add-label "docs-needed" +``` + + + This workflow uses the Continue Docs MCP agent to analyze code changes and automatically comment on PRs when documentation updates are recommended. + + +--- + +## Documentation MCP for Other Projects + +Want to create documentation MCPs for your own projects? Mintlify makes it easy: + + + + ```bash + npm i -g mintlify + mintlify init + ``` + + + + Mintlify automatically generates an MCP server for your documentation, enabling semantic search. + + [Learn more about Mintlify MCP generation →](https://www.mintlify.com/blog/generate-mcp-servers-for-your-docs) + + + + Share your docs MCP on [Continue Hub](https://hub.continue.dev/new?type=mcp) so others can use it with Continue agents. + + + + + The [Continue Docs MCP](/reference/continue-mcp) itself was built this way! + + +--- + +## Key Prompts Cheat Sheet + +| Task | Prompt | +|:-----|:-------| +| **Find structure** | "Show me the structure of existing cookbooks in Continue docs" | +| **Create cookbook** | "Create a cookbook for [tool] MCP following the dlt cookbook structure" | +| **Update docs** | "Update [file] to include information about [feature], using Continue Docs MCP to find examples" | +| **Add navigation** | "Add [file] to docs.json under the [section] section" | +| **Check consistency** | "Review this file for consistency with other Continue documentation" | +| **Fix formatting** | "Review for Mintlify formatting issues and fix any problems" | +| **Extract examples** | "Find all examples of [topic] in Continue docs" | +| **Research feature** | "Use Continue Docs MCP to explain how [feature] works in Continue" | + +--- + +## Resources + +### Continue Documentation +- [Contributing Guide](/CONTRIBUTING) - Setup and submission process +- [Continue Docs MCP Reference](/reference/continue-mcp) - MCP server details +- [Understanding Agents](/guides/understanding-agents) - How agents work + +### Mintlify +- [MCP Generation Guide](https://www.mintlify.com/blog/generate-mcp-servers-for-your-docs) +- [Mintlify Documentation](https://mintlify.com/docs) + +### Community +- [Continue Discord](https://discord.gg/continue) - #documentation channel +- [GitHub Discussions](https://github.com/continuedev/continue/discussions) + +--- + +## Next Steps + + + + Set up your environment + + + + Install pre-built agent + + + + See cookbook examples + + + + Get help from community + + diff --git a/docs/guides/overview.mdx b/docs/guides/overview.mdx index 3ca80dae0..d84ffe0a1 100644 --- a/docs/guides/overview.mdx +++ b/docs/guides/overview.mdx @@ -19,9 +19,11 @@ description: "Comprehensive collection of practical guides for Continue includin Step-by-step guides for integrating Model Context Protocol (MCP) servers with Continue: +- [Continue Docs MCP Cookbook](/guides/continue-docs-mcp-cookbook) - Use the Continue Docs MCP to write cookbooks, guides, and documentation with AI-powered workflows - [PostHog Session Analysis Cookbook](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation - [Netlify Performance Optimization Cookbook](/guides/netlify-mcp-continuous-deployment) - Optimize web performance with A/B testing and automated monitoring using Netlify MCP - [Snyk + Continue Hub Agent Cookbook (MCP)](/guides/snyk-mcp-continue-cookbook) - Integrate Snyk MCP via Continue Hub to scan code, deps, IaC, and containers +- [dlt Data Pipelines Cookbook](/guides/dlt-mcp-continue-cookbook) - Build AI-powered data pipelines with dlt MCP for pipeline inspection, schema management, and debugging ## What Advanced Tutorials Are Available diff --git a/docs/guides/posthog-github-continuous-ai.mdx b/docs/guides/posthog-github-continuous-ai.mdx index e74e798c5..b5aac1a1b 100644 --- a/docs/guides/posthog-github-continuous-ai.mdx +++ b/docs/guides/posthog-github-continuous-ai.mdx @@ -67,6 +67,7 @@ First, you'll need to gather your PostHog and GitHub API credentials and add the 3. Name it "Continue CLI Session Analysis" 4. Select these scopes: - `session_recording:read` - **Required** for accessing session data + - `feature_flag:read` - **Required** for feature flag auditing - `insight:read` - `query:read` - `session_recording_playlist:read` @@ -212,9 +213,9 @@ You only need to configure the PostHog MCP credential - it automatically handles **Repository Labels Required**: Make sure your GitHub repository has these labels: -- `bug`, `enhancement` +- `bug`, `enhancement`, `technical-debt` - `high-priority`, `medium-priority`, `low-priority` -- `user-experience`, `automated` +- `user-experience`, `automated`, `feature-flag`, `cleanup` Create missing labels in your repo at: **Settings → Labels → New label** @@ -266,7 +267,57 @@ After completing this guide, you have a complete **Continuous AI system** that: -## Advanced Prompts +## Example Use Cases + +Here are practical examples of what you can build with PostHog MCP and Continue CLI: + +### Session Recording Analysis (Current Implementation) + +The main workflow above focuses on analyzing session recordings to identify UX issues and create GitHub issues automatically. + +### Feature Flag Audit and Cleanup + + + Automatically audit your feature flags to identify unused, outdated, or problematic flags that need attention. + + +**What this workflow does:** +- Fetches all feature flags from your PostHog project +- Analyzes flag usage, rollout status, and configuration +- Identifies flags that may be candidates for removal or updates +- Creates GitHub issues for flag cleanup tasks + +**Example Continue CLI prompts:** + +```bash +# Get all feature flags and analyze them +cn "Use PostHog MCP to fetch all feature flags with mcp__posthog__feature-flag-get-all. Then analyze each flag to identify: 1) Flags that are 100% rolled out and could be removed, 2) Flags that haven't been updated in 90+ days, 3) Flags with complex targeting that might need simplification, 4) Experimental flags that should be cleaned up." + +# Create cleanup issues for identified flags +cn "For each problematic feature flag identified, create a GitHub issue using gh CLI: +- Title: '🏁 Feature Flag Cleanup: [flag_name]' +- Include flag details: rollout percentage, last modified date, targeting rules +- Add labels: 'technical-debt', 'feature-flag', 'cleanup' +- Set priority based on risk level (high for 100% rollouts, medium for stale flags) +- Include specific recommendations for each flag" + +# Audit flag performance impact +cn "Cross-reference feature flags with PostHog performance metrics to identify flags that may be impacting user experience or site performance. Create performance-focused GitHub issues for flags showing negative impact." +``` + +**Required PostHog MCP Tools:** +- `feature-flag-get-all` - Retrieve all feature flags +- `feature-flag-get-definition` - Get detailed flag configuration +- `query-run` - Run analytics queries to check flag usage +- `insights-get-all` - Get insights related to flag performance + +**Sample Output:** +This workflow creates GitHub issues like: +- "🏁 Feature Flag Cleanup: dark-mode-toggle" (100% rollout, safe to remove) +- "🏁 Feature Flag Review: experimental-checkout" (unused for 120 days) +- "🏁 Feature Flag Simplify: complex-user-targeting" (overly complex rules) + +### Advanced Prompts Consider enhancing your workflow with these advanced Continue CLI prompts: @@ -280,13 +331,12 @@ Consider enhancing your workflow with these advanced Continue CLI prompts: "Cross-reference JavaScript console errors with user actions to identify the root cause of UX issues" - - "Analyze how [PostHog feature flags](https://posthog.com/docs/feature-flags) - impact user behavior in session recordings" + + "Use PostHog MCP to correlate feature flag rollouts with performance metrics and user behavior changes to identify flags causing issues" "Create Slack alerts when critical UX issues are detected in PostHog - sessions" + sessions or when feature flags need attention" diff --git a/docs/guides/sanity-mcp-continue-cookbook.mdx b/docs/guides/sanity-mcp-continue-cookbook.mdx new file mode 100644 index 000000000..8af21df8d --- /dev/null +++ b/docs/guides/sanity-mcp-continue-cookbook.mdx @@ -0,0 +1,610 @@ +--- +title: "Content Management with Sanity MCP and Continue" +description: "Set up an AI-powered content management workflow that helps you manage schemas, run GROQ queries, handle documentation, and perform migrations using natural language commands." +sidebarTitle: "Sanity CMS with Continue" +--- + + + An AI-powered content management system workflow that uses Continue's AI agent with Sanity + MCP to manage schemas, execute GROQ queries, handle migrations, and maintain documentation - all through simple natural language prompts + + +## Prerequisites + +Before starting, ensure you have: + +- Continue account with **Hub access** +- Read: [Understanding Agents — How to get started with Hub agents](/guides/understanding-agents#how-to-get-started-with-hub-agents) +- Node.js 20+ installed locally +- A [Sanity account](https://www.sanity.io/) and project (free tier works) +- Basic understanding of content management systems + +For all options, first: + + + ```bash + npm i -g @continuedev/cli + ``` + + + + ```bash + npm install -g @sanity/cli + ``` + + + + To use agents in headless mode, you need a [Continue API key](https://hub.continue.dev/settings/api-keys) and proper environment variable configuration. + + +## Getting Started with Sanity + + + +New to Sanity? Follow the [Sanity Getting Started Guide](https://www.sanity.io/docs/getting-started) to set up your first project. + +**Quick setup:** +```bash +npm create sanity@latest +cd your-project-name +npm run dev +``` + +**Key resources:** +- [Sanity Studio](https://www.sanity.io/docs/sanity-studio) - Content editing interface +- [Schema Types](https://www.sanity.io/docs/schema-types) - Define content structure +- [GROQ](https://www.sanity.io/docs/groq) - Query language for fetching content +- [Content Lake](https://www.sanity.io/docs/datastore) - Real-time data store + + + +## Sanity MCP Workflow Options + + + Skip the manual setup and use our pre-built Sanity Assistant agent that includes + the Sanity MCP and optimized content management workflows for more consistent results. You can [remix this agent](/guides/understanding-agents#how-to-get-started-with-hub-agents) to customize it for your specific needs. + + + +After ensuring you meet the **Prerequisites** above, you have two paths to get started: + + + + + + Visit the [Sanity Agent Config](https://hub.continue.dev/continuedev/sanity-agent-config) on Continue Hub and click **"Install Agent"** or run: + + ```bash + cn --config continuedev/sanity-agent-config + ``` + + This agent includes: + - **[Sanity MCP](https://hub.continue.dev/sanity/sanity-mcp)** pre-configured and ready to use + - **Content management rules** for best practices + - **Schema optimization** guidelines + + + + Start with these beginner-friendly prompts to explore your content: + + ```bash + # Content exploration + "Show me all blog posts published in the last month" + + # Schema understanding + "Show me all the document types in my Sanity schema and explain their relationships" + + # Content management + "Create a new product page for our upcoming feature" + ``` + + That's it! The agent handles everything automatically. For more starter prompts and examples, see the [official Sanity MCP blog post](https://www.sanity.io/blog/model-context-protocol). + + + + + **Why Use the Agent?** The pre-built Sanity Assistant agent provides consistent content management workflows and handles MCP configuration automatically, making it easier to get started with AI-powered CMS operations. Results are more consistent and debugging is easier thanks to the [Sanity MCP](https://hub.continue.dev/sanity/sanity-mcp) integration and pre-tested prompts. + + + + + + + + Go to the [Continue Hub](https://hub.continue.dev) and [create a new agent](https://hub.continue.dev/new?type=agent). + + + + Visit the [Sanity MCP on Continue Hub](https://hub.continue.dev/sanity/sanity-mcp) and click **"Install"** to add it to the agent you created in the step above. + + This will add Sanity MCP to your agent's available tools. The Hub listing automatically configures the MCP connection. + + + **Alternative installation methods:** + 1. **Quick CLI install**: `cn --mcp sanity/sanity-mcp` + 2. **With config**: Use [Sanity MCP Config](https://hub.continue.dev/sanity/sanity-mcp-config) for environment variable setup + 3. **Manual configuration**: Add the MCP to your agent configuration + + Once installed, Sanity MCP tools become available to your Continue agent for all prompts. + + + + **Authentication Options:** + - **Interactive mode**: OAuth authentication via browser (expires after 7 days) + - **Headless/CI mode**: Uses environment variables (SANITY_API_TOKEN, SANITY_PROJECT_ID, etc.) + + See [Sanity MCP Config](https://hub.continue.dev/sanity/sanity-mcp-config) for environment variable setup. + + + + + + Start with these beginner-friendly prompts: + ```bash + cn + # Try these starter prompts: + # "Show me all blog posts published in the last month" + # "Show me all the document types in my Sanity schema and explain their relationships" + # "Create a new product page for our upcoming feature" + ``` + + For more examples, see the [Sanity MCP blog post](https://www.sanity.io/blog/model-context-protocol). + + + + + + + + To use the pre-built Sanity Assistant agent, you need either: + - **Continue CLI Pro Plan** with the models add-on, OR + - **Your own API keys** added to Continue Hub secrets + + The agent will automatically detect and use your configuration along with the pre-configured Sanity MCP for content operations. Note that OAuth authentication will be required on first use. + + + +--- + +## Sanity MCP Capabilities + + + **Sanity MCP** provides comprehensive tools for content management: + - Execute [GROQ queries](https://www.sanity.io/docs/groq) to fetch and analyze content + - Explore and modify [document schemas](https://www.sanity.io/docs/schema-types) + - Manage [content releases](https://www.sanity.io/docs/release-schedules) and versions + - Handle content [migrations](https://www.sanity.io/docs/migrating-data) between environments + - Automate documentation generation + - Perform bulk content operations + - Manage [localization](https://www.sanity.io/docs/localization) and translations + + The MCP integrates seamlessly with your existing Sanity workspace, providing AI-powered assistance for both development and content operations. + + +--- + +## Your First MCP Conversation + +With everything set up, you're ready for your first AI-powered content conversation! Try these beginner-friendly starter prompts: + + + + ``` + "Show me all blog posts published in the last month" + ``` + + + ``` + "Create a new product page for our upcoming feature" + ``` + + + ``` + "Update our pricing information across all service pages" + ``` + + + ``` + "Schedule the Easter marketing campaign content release for next Tuesday" + ``` + + + + +**New to MCP?** These prompts demonstrate the power of natural language content management. For more examples and detailed explanations, check out the [official Sanity MCP blog post](https://www.sanity.io/blog/model-context-protocol). + + +## Content Management Recipes + +Now you can use natural language prompts to manage your Sanity content and schemas. The Continue agent automatically calls the appropriate Sanity MCP tools. + + +You can add prompts to your agent's configuration for easy access in future sessions. Go to your agent in the [Continue Hub](https://hub.continue.dev), click **Edit**, and add prompts under the **Prompts** section. + + + + **Where to run these workflows:** + - **IDE Extensions**: Use Continue in VS Code, JetBrains, or other supported IDEs + - **Terminal (TUI mode)**: Run `cn` to enter interactive mode, then type your prompts + - **CLI (headless mode)**: Use `cn -p "your prompt"` for headless commands + + **Test in Plan Mode First**: Before running operations that might make + changes, test your prompts in plan mode (see the [Plan Mode + Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes in TUI/IDE). This + shows you what the agent will do without executing it. + + + + + **About the --auto flag**: The `--auto` flag enables tools to run continuously without manual confirmation. This is essential for headless mode where the agent needs to execute multiple tools automatically to complete tasks like schema exploration, GROQ execution, and content migration. + + + +### Schema Management + + + Review and understand your content schema structure. + +**TUI Mode Prompt:** +``` +Show me all document types in my Sanity schema with their fields, +validation rules, and relationships to other types. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Show me all document types in my Sanity schema with their fields, validation rules, and relationships to other types." --auto +``` + + + +### GROQ Queries + + + Run GROQ queries to fetch and analyze content. + +**TUI Mode Prompt:** +``` +Run a GROQ query to fetch all articles published in the last 30 days, +including their titles, authors, categories, and view counts. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Run a GROQ query to fetch all articles published in the last 30 days, including their titles, authors, categories, and view counts." --auto +``` + + + +### Content Operations + + + Perform bulk operations on your content. + +**TUI Mode Prompt:** +``` +Find all blog posts with the category "News" and update their +status to "archived" if they are older than 6 months. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Find all blog posts with the category 'News' and update their status to 'archived' if they are older than 6 months." --auto +``` + + + +### Localization + + + Set up and manage content translations. + +**TUI Mode Prompt:** +``` +Add localization support to my article document type for +Spanish and French languages with appropriate field configurations. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Add localization support to my article document type for Spanish and French languages with appropriate field configurations." --auto +``` + + + +### Content Migration + + + Migrate content between different schemas or environments. + +**TUI Mode Prompt:** +``` +Help me migrate my blog posts from the old schema structure +to the new one, mapping the deprecated fields to the new format. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Help me migrate my blog posts from the old schema structure to the new one, mapping the deprecated fields to the new format." --auto +``` + + + +### Documentation Generation + + + Automatically generate documentation for your content model. + +**TUI Mode Prompt:** +``` +Generate comprehensive documentation for my Sanity schema including +all document types, their purposes, field descriptions, and usage examples. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Generate comprehensive documentation for my Sanity schema including all document types, their purposes, field descriptions, and usage examples." --auto +``` + + + +### Content Releases + + + Work with Sanity's content release feature. + +**TUI Mode Prompt:** +``` +List all active releases in my dataset and show me the content +changes scheduled for each release. +``` + +**Headless Mode Prompt:** +```bash +cn -p "List all active releases in my dataset and show me the content changes scheduled for each release." --auto +``` + + + +### Performance Analysis + + + Optimize GROQ queries for better performance. + +**TUI Mode Prompt:** +``` +Analyze the performance of my most frequent GROQ queries and +suggest optimizations to improve response times. +``` + +**Headless Mode Prompt:** +```bash +cn -p "Analyze the performance of my most frequent GROQ queries and suggest optimizations to improve response times." --auto +``` + + + +## Continuous Content Management with GitHub Actions + +This example demonstrates a **Continuous AI workflow** where content validation and schema checks run automatically in your CI/CD pipeline in headless mode using the Sanity agent config. Consider [remixing this agent](/guides/understanding-agents#how-to-get-started-with-hub-agents) to add your organization's specific content governance rules. + +### Add GitHub Secrets + +Navigate to **Repository Settings → Secrets and variables → Actions** and add: + +- `CONTINUE_API_KEY`: Your Continue API key from [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys) +- `SANITY_PROJECT_ID`: Your Sanity project ID +- `SANITY_DATASET`: Your Sanity dataset name (usually "production") +- `SANITY_API_TOKEN`: Your Sanity API token with appropriate permissions +- `MCP_USER_ROLE`: Your MCP user role (typically "admin" or "editor") + + + The workflow uses the [Sanity Agent Config](https://hub.continue.dev/continuedev/sanity-agent-config) with environment variable authentication via [Sanity MCP Config](https://hub.continue.dev/sanity/sanity-mcp-config). This enables headless mode operation without OAuth browser authentication. + + +### Create Workflow File + +This workflow automatically validates your Sanity schemas and content on pull requests using the Continue CLI in [headless mode](/cli/overview#headless-mode%3A-production-automation). It checks schema integrity, validates content relationships, and posts a summary report as a PR comment. + +Create `.github/workflows/sanity-content-validation.yml` in your repository: + +```yaml +name: Sanity Content Validation with MCP + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + validate-content: + runs-on: ubuntu-latest + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} + SANITY_PROJECT_ID: ${{ secrets.SANITY_PROJECT_ID }} + SANITY_DATASET: ${{ secrets.SANITY_DATASET }} + SANITY_API_TOKEN: ${{ secrets.SANITY_API_TOKEN }} + MCP_USER_ROLE: ${{ secrets.MCP_USER_ROLE }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "18" + + - name: Install Sanity CLI + run: | + npm install -g @sanity/cli + echo "✅ Sanity CLI installed" + + - name: Install Continue CLI + run: | + npm install -g @continuedev/cli + echo "✅ Continue CLI installed" + + - name: Validate Schema Structure + run: | + echo "🔍 Validating schema structure..." + cn --config continuedev/sanity-agent-config \ + -p "Analyze the Sanity schema for any structural issues, + missing required fields, or broken references between document types." \ + --auto + + - name: Check Content Integrity + run: | + echo "📊 Checking content integrity..." + cn --config continuedev/sanity-agent-config \ + -p "Run GROQ queries to identify any orphaned documents, + broken references, or missing required fields in the content." \ + --auto + + - name: Generate Schema Documentation + run: | + echo "📝 Generating schema documentation..." + cn --config continuedev/sanity-agent-config \ + -p "Generate a markdown summary of all schema changes + in this PR and their potential impact on existing content." \ + --auto > schema-changes.md + + - name: Comment Report on PR + if: always() && github.event_name == 'pull_request' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + REPORT=$(cn --config continuedev/sanity-agent-config \ + -p "Generate a concise summary (200 words or less) of: + - Schema validation results + - Content integrity checks + - Any breaking changes detected + - Recommended actions before merging" \ + --auto) + + gh pr comment ${{ github.event.pull_request.number }} --body "$REPORT" +``` + + + Environment variables enable the MCP to authenticate without OAuth browser prompts. The [Sanity MCP Config](https://hub.continue.dev/sanity/sanity-mcp-config) documentation provides detailed setup instructions for all required variables. + + +## Content Management Best Practices + +Implement automated content quality checks using Continue's rule system. See the [Rules deep dive](/customize/deep-dives/rules) for authoring tips. + + + ```bash + "Before deploying schema changes, validate that all required fields + are present and that no breaking changes affect existing content." + ``` + + + + ```bash + "When creating new content types, ensure they follow the existing + naming conventions and field patterns established in the schema." + ``` + + + + ```bash + "Review GROQ queries for performance issues and suggest indexes + or query restructuring to improve response times." + ``` + + + + ```bash + "Ensure all user-facing content fields have proper localization + support configured for the required languages." + ``` + + +## Troubleshooting + +### Authentication Issues + +```bash +"Check if I'm properly authenticated with Sanity. +If not, help me set up OAuth or API token authentication." +``` + +### Schema Not Found + +```bash +"Verify that the Sanity project is properly configured +and that the schema files are accessible in the current directory." +``` + +### GROQ Query Errors + +```bash +"Debug this GROQ query and explain why it's failing, +then provide a corrected version that achieves the intended result." +``` + +### Migration Conflicts + + + **Verification Steps:** + - Sanity MCP is installed via [Continue Hub](https://hub.continue.dev/sanity/sanity-mcp) + - Project is authenticated with Sanity + - Schema files are present and valid + - Dataset permissions are correctly configured + + +## What You've Built + +After completing this guide, you have a complete **AI-powered content management system** that: + +- ✅ Uses natural language — Simple prompts instead of complex CMS commands +- ✅ Manages schemas automatically — AI handles schema evolution and migrations +- ✅ Runs continuously — Automated validation in CI/CD pipelines +- ✅ Ensures quality — Content checks prevent broken references and invalid data + + + Your content management workflow now operates at **[Level 2 Continuous + AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** - + AI handles routine content operations and schema management with human oversight + through review and approval of changes. + + +## Next Steps + +1. **Explore your schema** - Try the schema exploration prompt on your current project +2. **Run GROQ queries** - Use natural language to query your content +3. **Set up CI validation** - Add the GitHub Actions workflow to your repo +4. **Create documentation** - Generate comprehensive docs for your content model +5. **Optimize performance** - Analyze and improve query performance + +## Additional Resources + + + + Complete Sanity platform documentation + + + Explore more MCP integrations and agents + + + Learn GROQ query language + + + Official Sanity MCP introduction with examples + + + Official Sanity MCP documentation + + \ No newline at end of file diff --git a/extensions/cli/src/shared-options.ts b/extensions/cli/src/shared-options.ts index d30455c1c..54a2a4154 100644 --- a/extensions/cli/src/shared-options.ts +++ b/extensions/cli/src/shared-options.ts @@ -14,6 +14,7 @@ export function addCommonOptions(command: Command): Command { .option("--readonly", "Start in plan mode (read-only tools)") .option("--auto", "Start in auto mode (all tools allowed)") .option("--verbose", "Enable verbose logging") + .option("--beta-status-tool", "Enable beta status tool") .option( "--rule ", "Add a rule (can be a file path, hub slug, or string content). Can be specified multiple times.", diff --git a/extensions/cli/src/tools/status.ts b/extensions/cli/src/tools/status.ts index ff85dcd93..3cdaf6a62 100644 --- a/extensions/cli/src/tools/status.ts +++ b/extensions/cli/src/tools/status.ts @@ -24,12 +24,14 @@ export const statusTool: Tool = { displayName: "Status", description: `Set the current status of your task for the user to see -The available statuses are: +The default available statuses are: - PLANNING: You are creating a plan before beginning implementation - WORKING: The task is in progress - DONE: The task is complete - BLOCKED: You need further information from the user in order to proceed +However, if the user explicitly specifies in their prompt to use one or more different statuses, you can use those as well. + You should use this tool to notify the user whenever the state of your work changes. By default, the status is assumed to be "PLANNING" prior to you setting a different status.`, parameters: { type: "object", diff --git a/gui/src/redux/thunks/preprocessToolCallArgs.ts b/gui/src/redux/thunks/preprocessToolCallArgs.ts index f6b973323..fd6a9e52d 100644 --- a/gui/src/redux/thunks/preprocessToolCallArgs.ts +++ b/gui/src/redux/thunks/preprocessToolCallArgs.ts @@ -1,4 +1,6 @@ import { ToolCallState } from "core"; +import { ContinueErrorReason } from "core/util/errors"; +import posthog from "posthog-js"; import { IIdeMessenger } from "../../context/IdeMessenger"; import { errorToolCall, @@ -15,25 +17,29 @@ export async function preprocessToolCalls( // Tool call pre-processing await Promise.all( generatedToolCalls.map(async (tcState) => { - try { - const result = await ideMessenger.request("tools/preprocessArgs", { + let errorReason: ContinueErrorReason | undefined = undefined; + let errorMessage: string | undefined = undefined; + let preprocessedArgs: Record | undefined = undefined; + const result = await ideMessenger.request("tools/preprocessArgs", { + toolName: tcState.toolCall.function.name, + args: tcState.parsedArgs, + }); + if (result.status === "success") { + preprocessedArgs = result.content.preprocessedArgs; + errorMessage = result.content.errorMessage; + errorReason = result.content.errorReason; + } else { + errorMessage = result.error; + errorReason = ContinueErrorReason.Unknown; + } + if (errorReason) { + posthog.capture("tool_call_outcome", { + // model: , TODO + succeeded: false, toolName: tcState.toolCall.function.name, - args: tcState.parsedArgs, + errorReason, + duration_ms: 0, // preprocessing is more or less instantaneous }); - if (result.status === "success") { - if (result.content.preprocessedArgs) { - dispatch( - setToolCallArgs({ - toolCallId: tcState.toolCallId, - newArgs: result.content.preprocessedArgs, - }), - ); - } - } else { - throw new Error(result.error); - } - } catch (e) { - let errorMessage = e instanceof Error ? e.message : `Unknown error`; dispatch( errorToolCall({ toolCallId: tcState.toolCallId, @@ -53,6 +59,13 @@ export async function preprocessToolCalls( ], }), ); + } else if (preprocessedArgs) { + dispatch( + setToolCallArgs({ + toolCallId: tcState.toolCallId, + newArgs: preprocessedArgs, + }), + ); } }), ); diff --git a/packages/config-yaml/src/schemas/mcp/index.ts b/packages/config-yaml/src/schemas/mcp/index.ts index 64445ffc0..0f1778882 100644 --- a/packages/config-yaml/src/schemas/mcp/index.ts +++ b/packages/config-yaml/src/schemas/mcp/index.ts @@ -3,6 +3,7 @@ import { requestOptionsSchema } from "../../schemas/models.js"; const baseMcpServerSchema = z.object({ name: z.string(), + serverName: z.string().optional(), faviconUrl: z.string().optional(), sourceFile: z.string().optional(), // Added during loading connectionTimeout: z.number().gt(0).optional(),