mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Expose console messages via tool call.
This commit is contained in:
1 parent
8108407478
commit
804efb4d23
5 files changed
+120
-7
No files matched your search
@@ -51,6 +51,49 @@ Shakespeare provides AI agents with specialized tools for project development (n
|
||||
- **NostrReadNipsIndexTool**: Read the full list of NIPs, kinds, and tags
|
||||
- **NostrFetchEventTool**: Fetch Nostr events using NIP-19 identifiers
|
||||
- **NostrGenerateKindTool**: Generate unused Nostr event kind numbers
|
||||
- **ReadConsoleMessagesTool**: Read console messages from project preview with filtering capabilities
|
||||
|
||||
#### Console Message Reading
|
||||
|
||||
The `ReadConsoleMessagesTool` allows you to access console messages from the project preview iframe, enabling proactive error detection and debugging assistance.
|
||||
|
||||
**Usage Examples:**
|
||||
|
||||
```typescript
|
||||
// Read all console messages
|
||||
const allMessages = await read_console_messages({});
|
||||
|
||||
// Read only error messages
|
||||
const errorMessages = await read_console_messages({ filter: 'error' });
|
||||
|
||||
// Read last 10 messages of any type
|
||||
const recentMessages = await read_console_messages({ limit: 10 });
|
||||
|
||||
// Read last 5 warning messages
|
||||
const recentWarnings = await read_console_messages({ filter: 'warn', limit: 5 });
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `filter` (optional): `'error' | 'warn' | 'info' | 'debug' | 'log' | 'all'` - defaults to `'all'`
|
||||
- `limit` (optional): `number` - maximum number of messages to return, defaults to all messages
|
||||
|
||||
**Use Cases:**
|
||||
- **Proactive Error Detection**: Automatically detect and fix console errors
|
||||
- **Debugging Assistance**: Correlate console errors with code changes
|
||||
- **Build Validation**: Check for runtime errors after building
|
||||
- **Performance Monitoring**: Identify performance-related warnings
|
||||
|
||||
**Example Workflow:**
|
||||
```
|
||||
User: Fix the errors in my app
|
||||
AI: Let me check the console for errors first...
|
||||
read_console_messages({ filter: 'error' })
|
||||
// Returns: Found 2 errors (level: error):
|
||||
// [14:32:15] [ERROR] Failed to load module 'react'
|
||||
// [14:32:16] [ERROR] Network timeout at https://api.example.com/data
|
||||
|
||||
AI: I can see there are 2 errors in the console. Let me fix the module loading issue first...
|
||||
```
|
||||
|
||||
#### Shell Commands
|
||||
|
||||
|
||||
Reference in new issue
Block a user