Skip to main content
Glama

get_submission_status

Check the status and result of code submissions to the Orange Juice Online Judge by providing the submission ID.

Instructions

Get the status and result of a previously submitted code.
submission_id: The ID returned when submitting the code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
submission_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The get_submission_status tool handler - decorated with @mcp.tool() for registration. Takes a submission_id parameter, gets an authenticated client, and calls the OJ API to retrieve submission status and results.
    @mcp.tool()
    def get_submission_status(submission_id: str) -> str:
        """
        Get the status and result of a previously submitted code.
        submission_id: The ID returned when submitting the code.
        """
        c = get_authenticated_client()
        try:
            data = c.get_submission(submission_id)
            return str(data)
        except Exception as e:
            return f"Error: {e}"
  • Helper function get_authenticated_client() that ensures the OJClient is authenticated before use. Uses a global flag to track login state and authenticates with credentials from environment variables.
    def get_authenticated_client():
        global is_logged_in
        if not is_logged_in:
            if not OJ_USERNAME or not OJ_PASSWORD:
                raise ValueError("OJ_USERNAME and OJ_PASSWORD environment variables are required.")
            client.login(OJ_USERNAME, OJ_PASSWORD)
            is_logged_in = True
        return client
  • OJClient.get_submission() method that makes the actual HTTP GET request to the /api/submission endpoint with the submission_id parameter and returns the JSON response.
    def get_submission(self, submission_id):
        params = {"id": submission_id}
        resp = self.session.get(self._get_url("/api/submission"), params=params, timeout=15)
        resp.raise_for_status()
        return resp.json()

Tool Definition Quality

Score is being calculated. Check back soon.

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/wangicheng/oj-mcp-server'

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