Skip to main content
Glama

get_code

Retrieve code information from the Vibe system by providing a query ID and version ID.

Instructions

Get code information from the Vibe system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYes
version_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The _execute_get_code method is the internal handler that validates required parameters (query_id, version_id), calls vibe_client.get_code(), and formats the JSON response.
    async def _execute_get_code(
        self,
        tool_input: dict[str, Any],
        log: structlog.stdlib.BoundLogger,
    ) -> list[TextContent]:
        """Execute get_code tool."""
        required = ["query_id", "version_id"]
        missing = [p for p in required if p not in tool_input]
        if missing:
            raise MCPToolValidationError(
                f"Missing required parameters: {', '.join(missing)}"
            )
    
        response = await self.vibe_client.get_code(
            query_id=tool_input["query_id"],
            version_id=tool_input["version_id"],
        )
    
        result = {
            "status": "success",
            "data": response.model_dump(),
        }
    
        log.info("Tool executed successfully", result=result)
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The get_code method in VibeAPIClient creates a GetCodeRequest, makes the HTTP GET call to the GET_CODE endpoint, and returns a validated GetCodeResponse.
    async def get_code(
        self,
        query_id: str,
        version_id: str,
    ) -> GetCodeResponse:
        """
        Get code by query/code ID.
    
        Args:
            query_id: Query/Code ID
            version_id: Version ID
    
        Returns:
            GetCodeResponse with code details
    
        Raises:
            MCPToolExecutionError: If API call fails
        """
        log = self.logger.bind(
            method="get_code",
            query_id=query_id,
            version_id=version_id,
        )
    
        try:
            # Create request object (validates input)
            request = GetCodeRequest(
                query_id=query_id,
                version_id=version_id,
            )
    
            log.debug("Fetching code", request=request.model_dump(by_alias=True))
    
            # Make API call
            response_data = await self.http_client.get(
                endpoint=API_ENDPOINTS["GET_CODE"],
                params=request.model_dump(
                    by_alias=True,
                    exclude_none=True,
                ),
            )
    
            # Validate and transform response
            response = GetCodeResponse(**response_data)
            log.debug("Code retrieved successfully")
    
            return response
    
        except Exception as e:
            log.error("Failed to get code", error=str(e))
            raise MCPToolExecutionError(
                f"Failed to retrieve code: {str(e)}"
            ) from e
  • GetCodeRequest model with query_id (QueryID) and version_id (versionId) fields.
    class GetCodeRequest(BaseModel):
        """Request model for GetCodeById endpoint."""
    
        model_config = ConfigDict(extra="forbid", populate_by_name=True)
    
        query_id: str = Field(
            alias="QueryID",
            description="Query/Code ID to retrieve",
        )
        version_id: str = Field(
            alias="versionId",
            description="Version ID",
        )
  • GetCodeResponse model containing success flag, optional CodeDto, and optional message.
    class GetCodeResponse(BaseModel):
        """Response model for GetCodeById endpoint."""
    
        model_config = ConfigDict(extra="allow")
    
        success: bool = Field(description="Success indicator")
        code: Optional[CodeDto] = Field(
            default=None,
            description="Code details",
        )
        message: Optional[str] = Field(
            default=None,
            description="Response message",
        )
  • Registration of the 'get_code' MCP tool using @mcp.tool decorator with name='get_code' and description, wiring it to _execute_get_code.
    @mcp.tool(
        name="get_code",
        description="Get code information from the Vibe system",
    )
    async def get_code(query_id: str, version_id: str) -> str:
        try:
            result = await _tools()._execute_get_code(
                {"query_id": query_id, "version_id": version_id},
                logger.bind(tool="get_code"),
            )
            return result[0].text
        except Exception as e:
            log = logger.bind(tool="get_code")
            log.error("Tool execution failed", error=str(e))
            raise MCPToolExecutionError(f"Tool execution failed: {str(e)}") from e
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It only states the action (get) but omits details like idempotency, auth needs, or side effects. The simplicity of a get operation partially mitigates, but the burden is unmet.

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?

Single sentence, no unnecessary words. Front-loaded with the action. However, it could be slightly expanded without losing conciseness.

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?

While output schema exists (so return values are covered), the description is too vague for a tool with two required params. It doesn't explain what 'code information' entails, leaving ambiguity. Minimal completeness for a simple read tool.

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

Parameters1/5

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

Schema has two required string parameters (query_id, version_id) with 0% description coverage. The description adds no meaning to these parameters—does not explain what each ID represents or how they relate.

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 'Get code information from the Vibe system' uses a verb+resource pattern that clearly indicates retrieving code data. It distinguishes from sibling tools like create_bucket or get_activity, but is somewhat generic—could specify whether it's for a query or version.

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?

No guidance on when to use this tool vs alternatives. The description lacks context on prerequisites, typical use cases, or when other tools would be more appropriate.

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/Coding-Professional/McpServer_Vibe'

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