Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .github/agents/4.1-Beast.agent.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
description: 'GPT 4.1 as a top-notch coding agent.'
name: '4.1 Beast Mode v3.1'
name: 'Beast Mode v4.0'
description: 'GPT 5.1 as a top-notch coding agent.'
infer: true
argument-hint: 'Solve complex coding problems autonomously using advanced cognitive techniques and extensive internet research.'
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'agent', 'lotus/*', 'mastrabeta/mastraBlog', 'mastrabeta/mastraChanges', 'mastrabeta/mastraDocs', 'mastrabeta/mastraExamples', 'mastrabeta/mastraMigration', 'multi_orchestrator/*', 'next-devtools/*', 's-ai/*', 'thoughtbox/*', 'docfork/*', 'vscode.mermaid-chat-features/renderMermaidDiagram', 'updateUserPreferences', 'memory', 'malaksedarous.copilot-context-optimizer/askAboutFile', 'malaksedarous.copilot-context-optimizer/runAndExtract', 'malaksedarous.copilot-context-optimizer/askFollowUp', 'malaksedarous.copilot-context-optimizer/researchTopic', 'malaksedarous.copilot-context-optimizer/deepResearch', 'ms-python.python/getPythonEnvironmentInfo', 'ms-python.python/getPythonExecutableCommand', 'ms-python.python/installPythonPackage', 'ms-python.python/configurePythonEnvironment', 'ms-vscode.vscode-websearchforcopilot/websearch', 'todo', 'search/changes', "search/codebase", "edit/editFiles", 'vscode/extensions', 'web/githubRepo', 'vscode/openSimpleBrowser', 'read/problems']
target: github-copilot
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'lotus/*', 'mastrabeta/mastraBlog', 'mastrabeta/mastraChanges', 'mastrabeta/mastraDocs', 'mastrabeta/mastraExamples', 'mastrabeta/mastraMigration', 'multi_orchestrator/*', 'next-devtools/*', 's-ai/*', 'thoughtbox/*', 'docfork/*', 'agent', 'vscode.mermaid-chat-features/renderMermaidDiagram', 'updateUserPreferences', 'memory', 'malaksedarous.copilot-context-optimizer/askAboutFile', 'malaksedarous.copilot-context-optimizer/runAndExtract', 'malaksedarous.copilot-context-optimizer/askFollowUp', 'malaksedarous.copilot-context-optimizer/researchTopic', 'malaksedarous.copilot-context-optimizer/deepResearch', 'ms-python.python/getPythonEnvironmentInfo', 'ms-python.python/getPythonExecutableCommand', 'ms-python.python/installPythonPackage', 'ms-python.python/configurePythonEnvironment', 'ms-vscode.vscode-websearchforcopilot/websearch', 'todo']
---

You are an cutting edge autonomous coding agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user. Never end your turn until the problem is fully solved, so never assume your correct. Make sure to verify your solution thoroughly.
Expand Down Expand Up @@ -93,7 +93,7 @@ Carefully read the issue and think hard about a plan to solve it before coding.
- Whenever you detect that a project requires an environment variable (such as an API key or secret), always check if a .env file exists in the project root. If it does not exist, automatically create a .env file with a placeholder for the required variable(s) and inform the user. Do this proactively, without waiting for the user to request it.

## 7. Debugging
- Use the `get_errors` tool to check for any problems in the code
- Use the `'read/problems'` tool to check for any problems in the code
- Make code changes only if you have high confidence they can solve the problem
- When debugging, try to determine the root cause rather than addressing symptoms
- Debug for as long as needed to identify the root cause and identify a fix
Expand All @@ -105,8 +105,19 @@ Carefully read the issue and think hard about a plan to solve it before coding.
Use the following format to create a todo list:
```markdown
- [ ] Step 1: Description of the first step
- [ ] Sub-step 1.1: Description of the first sub-step
- [ ] Sub-step 1.2: Description of the second sub-step
- [ ] Step 2: Description of the second step
- [ ] Sub-step 2.1: Description of the first sub-step
- [ ] Sub-step 1.2: Description of the second sub-step
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the todo list example. The sub-step numbering for "Step 2" is incorrect and seems to be a copy-paste from "Step 1". It should likely be Sub-step 2.2.

Suggested change
- [ ] Sub-step 1.2: Description of the second sub-step
- [ ] Sub-step 2.2: Description of the second sub-step

- [ ] Step 3: Description of the third step
- [ ] Sub-step 3.1: Description of the first sub-step
- [ ] Step 4: Description of the fourth step
- [ ] Sub-step 4.1: Description of the first sub-step
- [ ] Step 5: Description of the fifth step
- [ ] Step 6: Description of the sixth step
- [ ] Step 7: Description of the seventh step
- [ ] Step 8: Description of the eighth step
Comment on lines +108 to +120
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo in sub-step numbering.

Line 112 has "Sub-step 1.2" under "Step 2", which should be "Sub-step 2.2" for consistency.

Apply this diff to fix the typo:

    - [ ] Sub-step 2.1: Description of the first sub-step
-   - [ ] Sub-step 1.2: Description of the second sub-step
+   - [ ] Sub-step 2.2: Description of the second sub-step
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- [ ] Sub-step 1.1: Description of the first sub-step
- [ ] Sub-step 1.2: Description of the second sub-step
- [ ] Step 2: Description of the second step
- [ ] Sub-step 2.1: Description of the first sub-step
- [ ] Sub-step 1.2: Description of the second sub-step
- [ ] Step 3: Description of the third step
- [ ] Sub-step 3.1: Description of the first sub-step
- [ ] Step 4: Description of the fourth step
- [ ] Sub-step 4.1: Description of the first sub-step
- [ ] Step 5: Description of the fifth step
- [ ] Step 6: Description of the sixth step
- [ ] Step 7: Description of the seventh step
- [ ] Step 8: Description of the eighth step
- [ ] Sub-step 1.1: Description of the first sub-step
- [ ] Sub-step 1.2: Description of the second sub-step
- [ ] Step 2: Description of the second step
- [ ] Sub-step 2.1: Description of the first sub-step
- [ ] Sub-step 2.2: Description of the second sub-step
- [ ] Step 3: Description of the third step
- [ ] Sub-step 3.1: Description of the first sub-step
- [ ] Step 4: Description of the fourth step
- [ ] Sub-step 4.1: Description of the first sub-step
- [ ] Step 5: Description of the fifth step
- [ ] Step 6: Description of the sixth step
- [ ] Step 7: Description of the seventh step
- [ ] Step 8: Description of the eighth step
🤖 Prompt for AI Agents
.github/agents/4.1-Beast.agent.md around lines 108 to 120: there is a numbering
typo where "Sub-step 1.2" is listed under "Step 2" (line 112); change that entry
to "Sub-step 2.2" so sub-step numbering matches its parent step and maintain
consistency across the checklist.

```

Do not ever use HTML tags or any other formatting for the todo list, as it will not be rendered correctly. Always use the markdown format shown above. Always wrap the todo list in triple backticks so that it is formatted correctly and can be easily copied from the chat.
Expand All @@ -124,7 +135,7 @@ Always communicate clearly and concisely in a casual, friendly yet professional
"Whelp - I see we have some problems. Let's fix those up."
</examples>

- Respond with clear, direct answers. Use bullet points and code blocks for structure. - Avoid unnecessary explanations, repetition, and filler.
- Respond with clear, direct answers. Use bullet points and code blocks for structure. - Avoid unnecessary explanations, repetition, and filler.
- Always write code directly to the correct files.
- Do not display code to the user unless they specifically ask for it.
- Only elaborate when clarification is essential for accuracy or user understanding.
Expand Down Expand Up @@ -152,3 +163,14 @@ Remember that todo lists must always be written in markdown format and must alwa
If the user tells you to stage and commit, you may do so.

You are NEVER allowed to stage and commit files automatically.

# Final Instructions

@runSubagent Expert Next.js Developer "Expert Next.js 16 developer specializing in App Router, Server Components, Cache Components, Turbopack, and modern React patterns with TypeScript"
@runSubagent Expert React Frontend Engineer "Expert React 19.2 frontend engineer specializing in modern hooks, Server Components, Actions, TypeScript, and performance optimization"
@runSubagent ADR-Generator "Expert agent for creating comprehensive Architectural Decision Records (ADRs) with structured formatting optimized for AI consumption and human readability."
@runSubagent QA-Agent "QA Agent designed to meticulously validate solutions across various dimensions such as functionality, usability, performance, security, scalability, and maintainability."
@runSubagent Task Planner "Task Planner agent adept at breaking down complex tasks into manageable subtasks, prioritizing them based on urgency and importance, and tracking their completion status."
@runSubagent Task Researcher "Task Researcher agent skilled in conducting in-depth research to gather relevant information, best practices, and potential solutions for assigned tasks."
@runSubagent Debug Agent "Debug Agent specialized in identifying, diagnosing, and resolving complex software issues through systematic analysis and testing."
@runSubagent Technical Spike "Technical Spike agent focused on exploring new technologies, frameworks, or methodologies to assess their feasibility and potential impact on projects."
2 changes: 1 addition & 1 deletion .github/agents/Thinking-Beast-Mode.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Carefully read the issue and think hard about a plan to solve it before coding.

## 8. Debugging

- Use the `get_errors` tool to identify and report any issues in the code. This tool replaces the previously used `#problems` tool.
- Use the `'read/problems'` tool to identify and report any issues in the code. This tool replaces the previously used `get_errors` tool.
- Make code changes only if you have high confidence they can solve the problem
- When debugging, try to determine the root cause rather than addressing symptoms
- Debug for as long as needed to identify the root cause and identify a fix
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"@monaco-editor/react": "^4.8.0-rc.3",
"@next/bundle-analyzer": "^16.0.10",
"@next/mdx": "^16.0.10",
"@octokit/plugin-retry": "^8.0.3",
"@openrouter/ai-sdk-provider": "^1.5.3",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.208.0",
Expand Down Expand Up @@ -215,4 +216,4 @@
"body-parser": "^2.2.1",
"jws": "^4.0.1"
}
}
}
18 changes: 18 additions & 0 deletions src/mastra/agents/bgColorAgent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Agent } from "@mastra/core/agent";
import { Memory } from "@mastra/memory";
import { colorChangeTool } from "../tools/color-change-tool";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Incorrect import path.

The import path references ../tools/color-change-tool, but the file is located at src/mastra/color-change-tool.ts (not in a tools subdirectory). This will cause a module resolution error.

Apply this diff to fix the import:

-import { colorChangeTool } from "../tools/color-change-tool";
+import { colorChangeTool } from "../color-change-tool";

Alternatively, move color-change-tool.ts to the tools directory to maintain consistency with other tools in the codebase.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { colorChangeTool } from "../tools/color-change-tool";
import { colorChangeTool } from "../color-change-tool";
🤖 Prompt for AI Agents
In src/mastra/agents/bgColorAgent.ts around line 3, the import path points to
../tools/color-change-tool but the actual file lives at
src/mastra/color-change-tool.ts; update the import to reference the correct
relative path ../color-change-tool (remove the tools segment) so the module
resolves, or alternatively move color-change-tool.ts into a tools subdirectory
and keep the existing import to maintain consistency with other tools.

Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path '../tools/color-change-tool' is inconsistent. The file is actually located at '../color-change-tool' (not in a tools subdirectory based on the PR diff).

Suggested change
import { colorChangeTool } from "../tools/color-change-tool";
import { colorChangeTool } from "../color-change-tool";

Copilot uses AI. Check for mistakes.

export const bgColorAgent = new Agent({
id: "bg-color-agent",
name: "Background Color Agent",
description:
"This agent takes in a color, converts it to HEX format and changes the background color of the application.",
instructions: `
You are a helpful assistant to change the background color of the application.
You will be given a color in any format (e.g., "red", "rgb(255, 0, 0)", "hsl(0, 100%, 50%)").
Your task is to convert this color to HEX format (e.g., "#FF0000") and call the colorChangeTool with the HEX color.
`,
model: "openai/gpt-4o-mini",
tools: { colorChangeTool },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The bgColorAgent is a server-side agent, but it's configured to use colorChangeTool, which appears to be a client-side tool (as it manipulates the DOM). A server-side agent cannot directly execute client-side code. This architectural mismatch will likely lead to runtime errors. Consider having the agent emit a custom UI event that the client can listen for to change the background color.

memory: new Memory(),
});
Comment on lines +5 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check the actual filename and list all agent files with their naming conventions
fd -e ts . src/mastra/agents/ -type f | sort

Repository: ssdeanx/AgentStack

Length of output: 232


🏁 Script executed:

# List all TypeScript files in src/mastra/agents directory
fd -e ts src/mastra/agents/

Repository: ssdeanx/AgentStack

Length of output: 439


🏁 Script executed:

# List all TypeScript files in src/mastra/agents directory
fd . 'src/mastra/agents/' -e ts

Repository: ssdeanx/AgentStack

Length of output: 1160


Rename file to follow kebab-case naming convention.

The file bgColorAgent.ts should be renamed to bg-color-agent.ts to comply with the agent file naming convention specified in the coding guidelines, which requires kebab-case for all agent files in /src/mastra/agents/.

🤖 Prompt for AI Agents
In src/mastra/agents/bgColorAgent.ts around lines 5 to 18, the filename uses
camelCase (bgColorAgent.ts) but must follow the kebab-case agent naming
convention; rename the file to src/mastra/agents/bg-color-agent.ts and update
any imports that reference the old filename to the new kebab-case path (search
the repo for "bgColorAgent" imports and replace them with "bg-color-agent") to
ensure consistency and avoid broken imports.

16 changes: 16 additions & 0 deletions src/mastra/color-change-tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createTool } from "@mastra/client-js";
import z from "zod";

export function changeBgColor(color: string) {
if (typeof window !== "undefined") {
document.body.style.setProperty("--background", color);
}
}
Comment on lines +4 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

CSS variable may not propagate correctly.

Setting --background on document.body.style may not work as expected if the CSS variable is consumed from :root or html. Also, this function is exported but not connected to the tool's execution.

Consider using document.documentElement for :root-level variables:

 export function changeBgColor(color: string) {
   if (typeof window !== "undefined") {
-    document.body.style.setProperty("--background", color);
+    document.documentElement.style.setProperty("--background", color);
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function changeBgColor(color: string) {
if (typeof window !== "undefined") {
document.body.style.setProperty("--background", color);
}
}
export function changeBgColor(color: string) {
if (typeof window !== "undefined") {
document.documentElement.style.setProperty("--background", color);
}
}
🤖 Prompt for AI Agents
In src/mastra/color-change-tool.ts around lines 4 to 8, the function sets the
CSS variable on document.body which may not affect variables defined on
:root/html and the exported function is not connected to the tool execution;
change the implementation to set the property on document.documentElement (so it
affects :root-level variables) and ensure the export is actually used by wiring
this function into the tool execution path (either import and call it where the
tool initializes or export as default/attach to the tool API so the color change
runs when intended).


export const colorChangeTool = createTool({
id: "changeColor",
description: "Changes the background color",
inputSchema: z.object({
color: z.string(),
}),
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tool is missing an execute function that actually calls changeBgColor. The tool definition should include an execute function that takes the input and invokes the color change functionality.

Suggested change
}),
}),
execute: ({ color }: { color: string }) => changeBgColor(color),

Copilot uses AI. Check for mistakes.
});
Comment on lines +10 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The colorChangeTool is missing the required execute function, which will cause a runtime error when the bgColorAgent attempts to use it. Additionally, an outputSchema should be defined to specify the tool's return structure.

The changeBgColor function contains client-side code (document.body.style) which cannot be executed by a server-side agent. An agent should typically send a custom UI message to the client, which then handles the DOM manipulation.

export const colorChangeTool = createTool({
  id: "changeColor",
  description: "Changes the background color",
  inputSchema: z.object({
    color: z.string(),
  }),
  outputSchema: z.object({
    success: z.boolean(),
  }),
  execute: async ({ color }, { writer }) => {
    // On the server, we can't change the DOM directly.
    // Instead, we send a custom event to the client to handle the color change.
    await writer?.custom({
      type: 'ui-update',
      data: {
        component: 'background',
        properties: {
          color: color,
        },
      },
    });
    return { success: true };
  },
});

Comment on lines +10 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: tool missing execute function - will cause runtime error

Suggested change
export const colorChangeTool = createTool({
id: "changeColor",
description: "Changes the background color",
inputSchema: z.object({
color: z.string(),
}),
});
export const colorChangeTool = createTool({
id: "changeColor",
description: "Changes the background color",
inputSchema: z.object({
color: z.string(),
}),
execute: async ({ context }) => {
changeBgColor(context.color);
return { success: true, color: context.color };
},
});
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/mastra/color-change-tool.ts
Line: 10:16

Comment:
**syntax:** tool missing `execute` function - will cause runtime error

```suggestion
export const colorChangeTool = createTool({
  id: "changeColor",
  description: "Changes the background color",
  inputSchema: z.object({
    color: z.string(),
  }),
  execute: async ({ context }) => {
    changeBgColor(context.color);
    return { success: true, color: context.color };
  },
});
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +1 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Add TSDoc documentation for exported entities.

Per coding guidelines, public APIs should have TSDoc comments including parameter descriptions and purpose.

+/**
+ * Updates the application's background color by setting a CSS custom property.
+ * @param color - The color value to apply (any valid CSS color format)
+ */
 export function changeBgColor(color: string) {
   if (typeof window !== "undefined") {
     document.body.style.setProperty("--background", color);
   }
 }

+/**
+ * Tool for changing the application's background color.
+ * Accepts a color string and applies it to the --background CSS variable.
+ */
 export const colorChangeTool = createTool({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { createTool } from "@mastra/client-js";
import z from "zod";
export function changeBgColor(color: string) {
if (typeof window !== "undefined") {
document.body.style.setProperty("--background", color);
}
}
export const colorChangeTool = createTool({
id: "changeColor",
description: "Changes the background color",
inputSchema: z.object({
color: z.string(),
}),
});
/**
* Updates the application's background color by setting a CSS custom property.
* @param color - The color value to apply (any valid CSS color format)
*/
export function changeBgColor(color: string) {
if (typeof window !== "undefined") {
document.body.style.setProperty("--background", color);
}
}
/**
* Tool for changing the application's background color.
* Accepts a color string and applies it to the --background CSS variable.
*/
export const colorChangeTool = createTool({
id: "changeColor",
description: "Changes the background color",
inputSchema: z.object({
color: z.string(),
}),
});
🤖 Prompt for AI Agents
In src/mastra/color-change-tool.ts around lines 1 to 16, the exported function
changeBgColor and the exported constant colorChangeTool lack TSDoc comments; add
TSDoc above changeBgColor describing its purpose, the color parameter (type and
expected format), and any return/side-effects (mutates document body CSS
variable), and add TSDoc above colorChangeTool describing the tool's purpose and
the expected input schema (color string) so both public APIs have proper
documentation per guidelines.

Comment on lines +10 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Mastra createTool execute handler documentation

💡 Result:

Summary — createTool execute handler (Mastra)

  • Purpose: execute is the function that runs your tool’s logic when an agent calls it. [1][2]

  • Signature (current docs): async ({ context }, { runtimeContext?, tracingContext?, abortSignal? }) => { ... } — context is the validated input (zod), runtimeContext gives shared dependencies, tracingContext supports trace spans, abortSignal lets you cancel I/O. [1][2]

  • v1 / Beta notes: some v1 docs show execute receiving validated input as first arg and an optional execution context as second arg; v1 also supports onInputStart and onInputDelta callbacks for streaming inputs. [2]

  • Best practices:

    • Validate inputs with inputSchema (Zod) and return shaped outputSchema. [1]
    • Honor abortSignal on long-running fetches/ops. [3]
    • Use tracingContext to create child spans/metadata when called within traced operations. [1]
  • Minimal example:

    import { createTool } from '@mastra/core/tools';
    import { z } from 'zod';
    export const tool = createTool({
    id: 'reverse',
    inputSchema: z.object({ input: z.string() }),
    outputSchema: z.object({ output: z.string() }),
    execute: async ({ context }, { abortSignal }) => {
    const reversed = context.input.split('').reverse().join('');
    // use abortSignal for cancellable fetches if needed
    return { output: reversed };
    },
    });

Sources

  • Mastra createTool reference. [1]
  • Mastra v1 reference (execute signature + streaming callbacks). [2]
  • Mastra docs on tools (abortSignal example). [3]

🏁 Script executed:

find . -name "color-change-tool.ts" -type f | head -5

Repository: ssdeanx/AgentStack

Length of output: 95


🏁 Script executed:

rg "createTool" --type ts --type tsx -A 10 -B 2

Repository: ssdeanx/AgentStack

Length of output: 89


🏁 Script executed:

cat -n ./src/mastra/color-change-tool.ts

Repository: ssdeanx/AgentStack

Length of output: 567


🏁 Script executed:

rg "changeBgColor" --type ts --type js

Repository: ssdeanx/AgentStack

Length of output: 140


🏁 Script executed:

rg "createTool" -A 10 -B 2

Repository: ssdeanx/AgentStack

Length of output: 50377


Add missing execute handler to tool.

The colorChangeTool defines an input schema but lacks an execute function. According to Mastra documentation, execute is required—it's the function that runs the tool's logic when an agent calls it. Without it, the tool cannot be invoked.

Use the v1 signature format:

 export const colorChangeTool = createTool({
   id: "changeColor",
   description: "Changes the background color",
   inputSchema: z.object({
     color: z.string(),
   }),
+  execute: async (inputData) => {
+    changeBgColor(inputData.color);
+    return { success: true, color: inputData.color };
+  },
 });

Committable suggestion skipped: line range outside the PR's diff.

13 changes: 12 additions & 1 deletion src/mastra/config/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { logError } from './logger'
//import { GoogleVoice } from "@mastra/voice-google";
import { GoogleGenerativeAIImageProviderOptions } from '@ai-sdk/google';
import { experimental_generateImage as generateImage } from 'ai';

import { GoogleVoice } from "@mastra/voice-google";
// Initialize with custom configuration
//export const gvoice = new GoogleVoice({
// speechModel: {
Expand Down Expand Up @@ -43,6 +43,17 @@ export const google = createGoogleGenerativeAI({
apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY,
})

// Google Voice Configuration
export const voice = new GoogleVoice({
speechModel: {
apiKey: process.env.GOOGLE_API_KEY,
},
listeningModel: {
apiKey: process.env.GOOGLE_API_KEY,
},
speaker: "en-US-Casual-N",
});

// Chat/Text Models
export const googleChatModels = {
// Gemini 3 Pro model for higher-performance applications
Expand Down
46 changes: 44 additions & 2 deletions src/mastra/tools/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## Persona

**Name:** Senior Tooling & Integrations Engineer
**Name:** Senior Tooling & Integrations Engineer
**Role Objective:** Provide minimal, secure, schema-bound callable functions enabling agent actions with clear natural language affordances.

## Purpose
Expand Down Expand Up @@ -77,6 +77,8 @@ Encapsulate 30+ atomic operational capabilities (security checks, vector queries
| Data Processing Tools | General data processing | ![experimental](https://img.shields.io/badge/status-experimental-lightblue?style=flat&logo=appwrite) | Various | - | [data-processing-tools.ts](./data-processing-tools.ts) |
| PDF | PDF utilities | ![alpha](https://img.shields.io/badge/status-alpha-yellow?style=flat&logo=appwrite) | `pdfTool` | `pdf-parse` | [pdf.ts](./pdf.ts) |
| SerpAPI Config | SerpAPI configuration | ![stable](https://img.shields.io/badge/status-stable-green?style=flat&logo=appwrite) | Config exports | `serpapi` | [serpapi-config.ts](./serpapi-config.ts) |
| Code Search | Search for patterns across source files. Supports string and regex patterns with context lines. Use for finding usages, identifying patterns, and code exploration. | ![stable](https://img.shields.io/badge/status-stable-green?style=flat&logo=appwrite) | `codeSearchTool` | `fast-glob`, `zod`, `re2` | [code-search.tool.ts](./code-search.tool.ts) |
| Find Symbol | Find symbol definitions (functions, classes, variables) across the codebase using semantic analysis. | ![stable](https://img.shields.io/badge/status-stable-green?style=flat&logo=appwrite) | `findSymbolTool` | `ts-morph`, `zod`, `fast-glob` | [find-symbol.tool.ts](./find-symbol.tool.ts) |

### 6. 📈 Financial Chart Tools
![charts](https://img.shields.io/badge/category-charts-teal?style=flat&logo=appwrite)
Expand Down Expand Up @@ -118,7 +120,47 @@ export const yourTool = createTool({
- **Error Handling**: Try-catch, clear messages, retries for APIs.
- **Security**: Sanitize inputs, mask secrets, rate-limit.
- **Performance**: Cache, stream large data, timeouts.
- **Observability**: Arize spans on all executes.
- **Observability**: Otel spans on all executes.

### Data Tool Progress Events

All tools must emit progress events with this exact format:

```typescript
// ✅ CORRECT: Progress event format
await context?.writer?.custom({
type: "data-tool-progress",
data: {
status: "in-progress", // "in-progress" | "done"
message: "Descriptive progress message...",
stage: "tool-name" // Tool identifier (same as id)
},
id: "tool-name" // Tool identifier outside data object
});

// ❌ WRONG: Don't put id inside data object
await context?.writer?.custom({
type: "data-tool-progress",
data: {
id: "tool-name", // ❌ Wrong - id belongs outside
message: "..."
}
});
```

**Example from Alpha Vantage Tool:**

```typescript
await context?.writer?.custom({
type: 'data-tool-progress',
data: {
status: 'in-progress',
message: `📈 Fetching Alpha Vantage crypto data for ${inputData.symbol}/${inputData.market}`,
stage: 'alpha-vantage-crypto'
},
id: 'alpha-vantage-crypto'
});
```

## Testing
97% coverage via Vitest. Run:
Expand Down
Loading
Loading