{{/* Set Database Title */}} {{ $dbTitle := .Page.Title }} {{/* Gather & Pre-filter Native Tools (from the local "tools" sub-folder) */}} {{ $validNativeTools := slice }} {{ $localTools := .Page.GetPage "tools" }} {{ if $localTools }} {{ range $localTools.RegularPages }} {{ if not .Params.is_wrapper }} {{ $validNativeTools = $validNativeTools | append . }} {{ end }} {{ end }} {{ end }} {{/* Track if we've printed the main H3 header yet */}} {{ $headerPrinted := false }} {{/* Display Native Tools ONLY if valid ones exist */}} {{ if gt (len $validNativeTools) 0 }}

{{ $dbTitle }} Tools

{{ $headerPrinted = true }} {{ range $validNativeTools }} {{ end }}
Tool Name Description
{{ .Title }} {{ .Description | default "No description provided." }}
{{ end }} {{/* Gather & Display Inherited Tools */}} {{ $dirsParam := .Get "dirs" }} {{ if $dirsParam }} {{ range split $dirsParam "," }} {{ $dirPath := trim . " " }} {{ $targetDir := site.GetPage $dirPath }} {{ if $targetDir }} {{/* Since $targetDir is the "tools" folder, the DB name is simply its parent */}} {{ $remoteDbTitle := $targetDir.Parent.Title }} {{/* Pre-filter Inherited Tools */}} {{ $validExternalTools := slice }} {{ range $targetDir.RegularPages }} {{ if not .Params.is_wrapper }} {{ $validExternalTools = $validExternalTools | append . }} {{ end }} {{ end }} {{ if gt (len $validExternalTools) 0 }} {{/* Print the main H3 if the native tools block didn't already print it */}} {{ if not $headerPrinted }}

{{ $dbTitle }} Tools

{{ $headerPrinted = true }} {{ end }}

{{ $dbTitle }} maintains full compatibility with {{ $remoteDbTitle }}, allowing you to use the following tools with this connection:

{{ range $validExternalTools }} {{ end }}
Tool Name Description
{{ .Title }} {{ .Description | default "No description provided." }}
{{ end }} {{ else }}

Warning: Tool directory '{{ $dirPath }}' not found.

{{ end }} {{ end }} {{ end }} {{/* Fallback if absolutely NO tools exist anywhere */}} {{ if and (not $headerPrinted) (not $dirsParam) }}

No tools found to display.

{{ end }}