Skip to content

Reading Page Content

import { Aside } from ‘@astrojs/starlight/components’;

Return the rendered content of the current page. Use this when an agent needs to reason about the DOM or extract text.

NameTypeRequiredDefaultDescription
formatenumnotextOne of html, text, markdown
selectorstringnoLimit the extraction to matches of this selector
maxCharsnumberno100000Truncate output to this many characters
FormatDescription
htmlFull rendered HTML including inline scripts and styles
textReadable plain text extracted via the Readability algorithm
markdownReadable content converted to Markdown, preserving headings and links
{
"tool": "ptah_browser_content",
"arguments": {
"format": "markdown",
"selector": "main"
}
}

Run arbitrary JavaScript in the page’s context and return the serialised result.

NameTypeRequiredDescription
scriptstringyesJavaScript source; the last expression or return value is returned
argsany[]noOptional arguments passed to the function
timeoutMsnumbernoDefaults to 5000
{
"tool": "ptah_browser_evaluate",
"arguments": {
"script": "return document.title;"
}
}

You can also pass arguments:

{
"tool": "ptah_browser_evaluate",
"arguments": {
"script": "(selector) => document.querySelectorAll(selector).length",
"args": ["a[href]"]
}
}
  • The script runs in the page, not in Node. Browser globals (window, document, fetch) are available; Node globals (require, process) are not.
  • Return values must be JSON-serialisable. DOM nodes and functions cannot be returned directly.
  • Scripts that throw return an error with the original stack trace.