Skip to main content
Glama
devhub

DevHub CMS MCP

Official
by devhub

site_from_url

Extract DevHub site ID and details from a URL to enable content management operations in the CMS system.

Instructions

Get the DevHub site ID from a URL.

Can prompt the user for the URL instead of passing a site_id.

Returns details about the Site matches the URL that can be used in the other tools.
- Site ID: ID of the DevHub site
- Site URL: URL of the DevHub site
- Site Location IDs: List of location IDs associated with the site

Args:
    url: URL of the DevHub site, all lowercase and ends with a slash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • The handler function for the 'site_from_url' tool. It parses the input URL, queries the DevHub API for matching sites using subdomain, domain, and base_directory, and returns formatted site details including ID, URL, and location IDs if found, or 'No site found' otherwise. Registered via @mcp.tool() decorator.
    @mcp.tool()
    def site_from_url(url: str) -> str:
        """Get the DevHub site ID from a URL.
    
        Can prompt the user for the URL instead of passing a site_id.
    
        Returns details about the Site matches the URL that can be used in the other tools.
        - Site ID: ID of the DevHub site
        - Site URL: URL of the DevHub site
        - Site Location IDs: List of location IDs associated with the site
    
        Args:
            url: URL of the DevHub site, all lowercase and ends with a slash
        """
        parsed_url = urlparse(url)
        subdomain = parsed_url.netloc.split('.', 1)[0] or 'www'
        domain = parsed_url.netloc.split('.', 1)[1]
        base_directory = parsed_url.path
        client, base_url = get_client()
        r = client.get('{}sites/'.format(base_url), params={
            'base_directory': base_directory,
            'deleted': 0,
            'domain': domain,
            'subdomain': subdomain,
        })
        content = json.loads(r.content)
        if len(content['objects']) == 0:
            return 'No site found'
        site = content['objects'][0]
        return f"""
    Site ID: {site['id']}
    Site URL: {site['formatted_url']}
    Site Location IDs: {", ".join([str(location_id) for location_id in site['location_ids']])}
    """
  • The @mcp.tool() decorator registers the site_from_url function as an MCP tool.
    @mcp.tool()
  • Helper function get_client() used by site_from_url to obtain the OAuth client and base URL for API calls.
    def get_client():
        """Get DevHub API client and base_url."""
        client = OAuth1Session(
            os.environ['DEVHUB_API_KEY'],
            client_secret=os.environ['DEVHUB_API_SECRET'])
        base_url = '{}/api/v2/'.format(os.environ['DEVHUB_BASE_URL'])
        return client, base_url
  • Docstring providing schema: input 'url: str', output str with site details.
    """Get the DevHub site ID from a URL.
    
    Can prompt the user for the URL instead of passing a site_id.
    
    Returns details about the Site matches the URL that can be used in the other tools.
    - Site ID: ID of the DevHub site
    - Site URL: URL of the DevHub site
    - Site Location IDs: List of location IDs associated with the site
    
    Args:
        url: URL of the DevHub site, all lowercase and ends with a slash
    """
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool returns site details (ID, URL, location IDs) and can prompt for user input, which adds useful behavioral context. However, it lacks details on error handling, permissions, or rate limits, leaving gaps for a tool that fetches data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized: it starts with the core purpose, adds usage notes, lists return values, and details parameters. Each sentence adds value, but the bulleted return list could be slightly more concise. Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 1 parameter with low schema coverage, the description is moderately complete. It covers the purpose, parameter semantics, and return values, but lacks error handling, authentication needs, or examples. For a data-fetching tool, this leaves some contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 1 parameter with 0% description coverage, so the description must compensate. It adds meaning by specifying the 'url' parameter format: 'all lowercase and ends with a slash.' This provides critical syntax details beyond the schema's basic string type, though it doesn't cover all potential edge cases (e.g., validation rules).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the DevHub site ID from a URL.' This specifies the verb ('Get') and resource ('DevHub site ID'), and distinguishes it from sibling tools like 'get_locations' or 'get_businesses' by focusing on site identification from a URL. However, it doesn't explicitly differentiate from all siblings (e.g., 'get_nearest_location' might also involve URLs), keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context: 'Can prompt the user for the URL instead of passing a site_id.' This implies an alternative input method but doesn't specify when to use this tool versus others (e.g., 'get_locations' for location data). No explicit when/when-not guidance or named alternatives are given, so it's implied rather than clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devhub/devhub-cms-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server