List all available repositories?

import pkgcore.config
config = pkgcore.config.load_config()
domain = config.get_default('domain')
repos = domain.repos

for repo in repos:

   print repo

List all available packages in a given repository?

import pkgcore.config
from pkgcore.restrictions import packages

config = pkgcore.config.load_config()
domain = config.get_default('domain')
repos = domain.repos

# Always match a package
restrict = packages.AlwaysTrue

# You may have a better way to get a specific repo

pkgs = repos[0].itermatch(restrict, sorter=sorted)
for pkg in pkgs:
   print pkg

Query a package's metadata?

A packages metadata is available through an instance of that package; thus step one is getting an instance so we can query through it.

Search through all available packages?

Construct a Restriction object?