Skip to main content
Glama

search_object

Find design objects by name within Penpot files using search queries, including regex patterns, to locate specific elements quickly.

Instructions

Search for objects within a Penpot file by name.

        Args:
            file_id: The ID of the Penpot file to search in
            query: Search string (supports regex patterns)
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYes
queryYes

Implementation Reference

  • Main handler implementation for the 'search_object' tool. Searches object names case-insensitively using regex within the file's pagesIndex, returns matching objects with id, name, page_id, page_name, object_type.
    def search_object(file_id: str, query: str) -> dict:
        """Search for objects within a Penpot file by name.
        
        Args:
            file_id: The ID of the Penpot file to search in
            query: Search string (supports regex patterns)
        """
        try:
            file_data = get_cached_file(file_id)
            if "error" in file_data:
                return file_data
            pattern = re.compile(query, re.IGNORECASE)
            matches = []
            data = file_data.get('data', {})
            for page_id, page_data in data.get('pagesIndex', {}).items():
                page_name = page_data.get('name', 'Unnamed')
                for obj_id, obj_data in page_data.get('objects', {}).items():
                    obj_name = obj_data.get('name', '')
                    if pattern.search(obj_name):
                        matches.append({
                            'id': obj_id,
                            'name': obj_name,
                            'page_id': page_id,
                            'page_name': page_name,
                            'object_type': obj_data.get('type', 'unknown')
                        })
            return {'objects': matches}
        except Exception as e:
            return self._handle_api_error(e)
    if include_resource_tools:
  • Helper function used by search_object to retrieve and cache file data from Penpot API.
    def get_cached_file(file_id: str) -> dict:
        """Internal helper to retrieve a file, using cache if available.
        
        Args:
            file_id: The ID of the Penpot file
        """
        cached_data = self.file_cache.get(file_id)
        if cached_data is not None:
            return cached_data
        try:
            file_data = self.api.get_file(file_id=file_id)
            self.file_cache.set(file_id, file_data)
            return file_data
        except Exception as e:
            return self._handle_api_error(e)
  • The _register_tools method where search_object is registered via @self.mcp.tool() decorator.
    """Register all MCP tools. If include_resource_tools is True, also register resource logic as tools."""
    @self.mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches for objects by name and supports regex patterns, which adds some context. However, it doesn't cover critical aspects like whether this is a read-only operation, what happens if no matches are found, if there are rate limits, or the format of the return value (especially since there's no output schema). For a search tool with zero annotation coverage, this leaves significant gaps.

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 appropriately sized and front-loaded, with the main purpose stated first in a clear sentence. The Args section is structured and adds necessary details without redundancy. However, the use of triple quotes and extra whitespace slightly detracts from efficiency, but overall, it's concise and well-organized.

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

Completeness2/5

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

Given the complexity of a search operation with 2 parameters, no annotations, and no output schema, the description is incomplete. It explains the parameters but lacks information on behavioral traits (e.g., error handling, performance), output format, or how results are returned. Without annotations or an output schema, more context is needed for the agent to use the tool effectively.

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 description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'file_id' is 'The ID of the Penpot file to search in' and 'query' is a 'Search string (supports regex patterns)', providing clarity on their roles. Since the schema only lists titles ('File Id', 'Query') without descriptions, this compensates well, though it doesn't detail constraints like format or length.

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: 'Search for objects within a Penpot file by name.' It specifies the verb ('Search'), resource ('objects within a Penpot file'), and method ('by name'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_object_tree' or 'get_file', which might also retrieve objects or file data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions searching by name but doesn't compare to siblings like 'get_object_tree' (which might list all objects) or 'get_file' (which might retrieve file metadata). There's no mention of prerequisites, such as needing a valid file ID, or exclusions, leaving the agent to infer usage context.

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/montevive/penpot-mcp'

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