X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/blobdiff_plain/8131771c2637405493978a03e3a9acddd516e3dd..945b6a7c9792a9f3d12c4b15c0c1cc46b54daaf1:/skill.py?ds=sidebyside diff --git a/skill.py b/skill.py index bc99032..7776130 100644 --- a/skill.py +++ b/skill.py @@ -19,7 +19,40 @@ mcp = FastMCP("Shop Bot") def add_item(name: str) -> str: return '\n'.join(Data().add_item(name)) - +@mcp.tool +def buy(items:str) -> str: + return '\n'.join(Data().purchase_items(items)) + +@mcp.tool +def list_bought(store:str) -> str: + return '\n'.join(Data().list_purchases(store)) + +#@mcp.tool +#def clear(store_name: str, clear_all:bool=False) -> 'list[str]': +# return Data().clear_list(store_name, clear_all) + + +@mcp.tool +def shop_at(store_name:str) -> str: + '''Select store to shop at''' + return '\n'.join(Data().get_shopping_list(store_name)) + + +@mcp.tool +def list() -> str: + '''Use previous store''' + return '\n'.join(Data().get_last_shopping_list() + + +#@mcp.tool +#def list_stores() -> 'list[str]': +# return Data().get_stores() + + +#@mcp.tool +#def list_purchases(store: str) -> 'list[str]': +# return Data().list_purchases(store) + # Configure CORS for browser-based clients middleware = [ Middleware( @@ -36,51 +69,9 @@ middleware = [ ) ] -# if __name__ == "__main__": - - -#@mcp.tool -#def buy(items:str) -> 'list[str]': -# return Data().purchase_items(items) -# -#@mcp.tool -#def list_bought(store:str) -> 'list[str]': -# return Data().list_purchases(store) -# -#@mcp.tool -#def clear(store_name: str, clear_all:bool=False) -> 'list[str]': -# return Data().clear_list(store_name, clear_all) -# -# -#@mcp.tool -#def shop_at(store_name:str) -> 'list[str]': -# '''Select store to shop at''' -# return Data().get_shopping_list(store_name) -# -# -#@mcp.tool -#def list() -> 'list[str]': -# '''Use previous store''' -# return Data().get_last_shopping_list() -# -# -#@mcp.tool -#def list_stores() -> 'list[str]': -# return Data().get_stores() -# -# -#@mcp.tool -#def list_purchases(store: str) -> 'list[str]': -# return Data().list_purchases(store) if __name__ == "__main__": -# mcp.run( -# transport="http", -# host=MY_IP, -# stateless_http=True, -# port=9000) - # Create the ASGI app mcp_app = mcp.http_app(