Skip to main content
Glama

build

Compile Android project source code into an executable APK file for testing and deployment.

Instructions

Build the Android project in the folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderYesThe full path of the current folder that the Android project sits

Implementation Reference

  • The @server.call_tool() handler that parses arguments using Folder schema, sets command to run build.sh for the 'build' tool, executes subprocess, and returns result as TextContent.
    @server.call_tool()
    async def call_tool(name, arguments: dict) -> list[TextContent]:
        try:
            args = Folder(**arguments)
        except ValueError as e:
            raise McpError(ErrorData(code=INVALID_PARAMS, message=str(e)))
        # os.chdir(args.folder)
        script_dir = os.path.dirname(os.path.abspath(__file__))
    
        command = [""]
        if name == "build":
            command = [os.path.join(script_dir, "build.sh"), args.folder]
        elif name == "test":
            command = [os.path.join(script_dir, "test.sh"), args.folder]
        else:
            command = [os.path.join(script_dir, "instrumentedTest.sh"), args.folder]
    
        result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
        stdout_lines = result.stdout.decode("utf-8").splitlines()
        stderr_lines = result.stderr.decode("utf-8").splitlines()
        all_lines = stdout_lines + stderr_lines
        
        
        error_lines = [line for line in all_lines if "failure: " in line.lower() or "e: " in line.lower() or " failed" in line.lower()]
        error_message = "\n".join(error_lines)
        if not error_message:
            error_message = "Successful"
        return [
            TextContent(type="text", text=f"{error_message}")
            ]
  • Pydantic model defining the input schema for the 'build' tool: requires 'folder' path.
    class Folder(BaseModel):
        """Parameters"""
        folder: Annotated[str, Field(description="The full path of the current folder that the Android project sits")]
  • Registration of the 'build' tool in the list_tools() function, specifying name, description, and input schema.
    Tool(
        name = "build",
        description = "Build the Android project in the folder",
        inputSchema = Folder.model_json_schema(),
    ),
  • Server instance named 'build'.
    server = Server("build")
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 action ('Build') but does not describe what this entails—e.g., whether it's a compilation process, if it requires specific dependencies, potential side effects like file generation, or error handling. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, though it could be slightly more structured by including key details like behavioral traits.

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 build operation, lack of annotations, and no output schema, the description is incomplete. It fails to explain what the build process involves, what outputs or errors might occur, or how it interacts with the Android project, leaving the agent with insufficient context for effective use.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'folder' parameter clearly documented. The description adds no additional meaning beyond the schema, such as explaining what constitutes a valid Android project folder or any constraints. Given the high schema coverage, a baseline score of 3 is appropriate.

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 action ('Build') and the target resource ('the Android project in the folder'), making the purpose understandable. However, it does not explicitly differentiate from sibling tools like 'instrumentedTest' or 'test', which likely involve testing rather than building, so it misses full sibling distinction.

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, such as the sibling tools 'instrumentedTest' or 'test'. It lacks context about prerequisites, timing, or exclusions, leaving the agent without clear usage instructions.

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/ShenghaiWang/androidbuild'

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