check_status
Track service request status using the request ID to monitor progress and view completion state.
Instructions
Check the status of a Soma request.
request_id: the ID returned by submit_requestInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:181-196 (handler)The main handler function for the 'check_status' MCP tool. It takes a request_id, loads requests from storage, checks if the request exists, and returns formatted status information including the request status, text, quoted sats (if any), and contact information.
@mcp.tool() def check_status(request_id: str) -> str: """Check the status of a Soma request. request_id: the ID returned by submit_request""" reqs = load_requests() if request_id not in reqs: return f"Request '{request_id}' not found." r = reqs[request_id] lines = [f"Request {request_id}: {r['status']}", f" {r['text']}"] if r.get("sats"): lines.append(f" Quoted: {r['sats']} sats") if r.get("contact"): lines.append(f" Contact: {r['contact']}") return "\n".join(lines) - server.py:181-181 (registration)The MCP tool registration decorator. The @mcp.tool() decorator registers the check_status function as an MCP tool named 'check_status' in the FastMCP server.
@mcp.tool() - server.py:182-185 (schema)The input schema is defined through the function signature (request_id: str) and docstring. The docstring describes the parameter and serves as documentation for the LLM.
def check_status(request_id: str) -> str: """Check the status of a Soma request. request_id: the ID returned by submit_request""" - server.py:17-23 (helper)Helper functions used by check_status. load_requests() reads the requests.json file and load_requests() saves data back. These are used to persist and retrieve request data.
def load_requests(): if REQUESTS_FILE.exists(): return json.loads(REQUESTS_FILE.read_text()) return {} def save_requests(data): REQUESTS_FILE.write_text(json.dumps(data, indent=2, ensure_ascii=False))